[Java] Update auto-generated Java files
[ldk-java] / src / main / jni / bindings.c.body
1 #include <jni.h>
2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
3 #define int64_t jlong
4 #include "org_ldk_impl_bindings.h"
5 #include <lightning.h>
6 #include <string.h>
7 #include <stdatomic.h>
8 #include <stdlib.h>
9
10 #define LIKELY(v) __builtin_expect(!!(v), 1)
11 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
12
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define MALLOC(a, _) malloc(a)
15 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
16 #define CHECK_ACCESS(p)
17 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
18 #define DO_ASSERT(a) (void)(a)
19 #define CHECK(a)
20
21 static jmethodID ordinal_meth = NULL;
22 static jmethodID slicedef_meth = NULL;
23 static jclass slicedef_cls = NULL;
24 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
25         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
26         CHECK(ordinal_meth != NULL);
27         slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
28         CHECK(slicedef_meth != NULL);
29         slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
30         CHECK(slicedef_cls != NULL);
31 }
32
33 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
34         return *((bool*)ptr);
35 }
36 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
37         return *((long*)ptr);
38 }
39 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
40         FREE((void*)ptr);
41 }
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
43         jbyteArray ret_arr = (*env)->NewByteArray(env, len);
44         (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
45         return ret_arr;
46 }
47 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
48         LDKu8slice *slice = (LDKu8slice*)slice_ptr;
49         jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
50         (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
51         return ret_arr;
52 }
53 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
54         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
55         vec->datalen = (*env)->GetArrayLength(env, bytes);
56         vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
57         (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
58         return (uint64_t)vec;
59 }
60 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
61         LDKTransaction *txdata = (LDKTransaction*)ptr;
62         LDKu8slice slice;
63         slice.data = txdata->data;
64         slice.datalen = txdata->datalen;
65         return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
66 }
67 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
68         LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
69         txdata->datalen = (*env)->GetArrayLength(env, bytes);
70         txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
71         txdata->data_is_owned = false;
72         (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
73         return (uint64_t)txdata;
74 }
75 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
76         LDKTransaction *tx = (LDKTransaction*)ptr;
77         tx->data_is_owned = true;
78         Transaction_free(*tx);
79         FREE((void*)ptr);
80 }
81 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
82         // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
83         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
84         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
85         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
86         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
87         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
88         return (uint64_t)vec->datalen;
89 }
90 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
91         // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
92         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
93         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
94         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
95         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
96         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
97         vec->data = NULL;
98         vec->datalen = 0;
99         return (uint64_t)vec;
100 }
101
102 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
103 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
105 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
106
107 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
108 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
109 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
110
111 typedef jlongArray int64_tArray;
112 typedef jbyteArray int8_tArray;
113
114 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
115         // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
116         char* conv_buf = MALLOC(len + 1, "str conv buf");
117         memcpy(conv_buf, chars, len);
118         conv_buf[len] = 0;
119         jstring ret = (*env)->NewStringUTF(env, conv_buf);
120         FREE(conv_buf);
121         return ret;
122 }
123 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
124         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
125         char* newchars = MALLOC(str_len + 1, "String chars");
126         const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
127         memcpy(newchars, jchars, str_len);
128         newchars[str_len] = 0;
129         (*env)->ReleaseStringUTFChars(env, str, jchars);
130         LDKStr res = {
131                 .chars = newchars,
132                 .len = str_len,
133                 .chars_is_owned = true
134         };
135         return res;
136 }
137
138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
139         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
140 }
141 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
142         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
143 }
144 #include "version.c"
145 static jclass arr_of_B_clz = NULL;
146 static jclass arr_of_J_clz = NULL;
147 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
148         arr_of_B_clz = (*env)->FindClass(env, "[B");
149         CHECK(arr_of_B_clz != NULL);
150         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
151         arr_of_J_clz = (*env)->FindClass(env, "[J");
152         CHECK(arr_of_J_clz != NULL);
153         arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
154 }
155 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
156
157 static inline void* untag_ptr(uint64_t ptr) {
158         if (ptr < 4096) return (void*)ptr;
159         if (sizeof(void*) == 4) {
160                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
161                 return (void*)(uintptr_t)ptr;
162         } else {
163                 // For 64-bit systems, assume the top byte is used for tagging, then
164                 // use bit 9 ^ bit 10.
165                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
166                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
167 #ifdef LDK_DEBUG_BUILD
168                 // On debug builds we also use the 11th bit as a debug flag
169                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
170                 CHECK(tenth_bit != eleventh_bit);
171                 p ^= 1ULL << 53;
172 #endif
173                 return (void*)p;
174         }
175 }
176 static inline bool ptr_is_owned(uint64_t ptr) {
177         if(ptr < 4096) return true;
178         if (sizeof(void*) == 4) {
179                 return ptr & (1ULL << 32);
180         } else {
181                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
182                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
183 #ifdef LDK_DEBUG_BUILD
184                 // On debug builds we also use the 11th bit as a debug flag
185                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
186                 CHECK(tenth_bit != eleventh_bit);
187 #endif
188                 return (ninth_bit ^ tenth_bit) ? true : false;
189         }
190 }
191 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
192         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
193         if (sizeof(void*) == 4) {
194                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
195         } else {
196                 CHECK(sizeof(uintptr_t) == 8);
197                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
198                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
199 #ifdef LDK_DEBUG_BUILD
200                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
201                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
202                 CHECK(ninth_bit == tenth_bit);
203                 CHECK(ninth_bit == eleventh_bit);
204                 t ^= 1ULL << 53;
205 #endif
206                 CHECK(ptr_is_owned(t) == is_owned);
207                 CHECK(untag_ptr(t) == ptr);
208                 return t;
209         }
210 }
211
212 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
213         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
214         if (UNLIKELY((*env)->ExceptionCheck(env))) {
215                 (*env)->ExceptionDescribe(env);
216                 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception.");
217         }
218         switch (ord) {
219                 case 0: return LDKAccessError_UnknownChain;
220                 case 1: return LDKAccessError_UnknownTx;
221         }
222         (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value.");
223         abort(); // Unreachable, but will let the compiler know we don't return here
224 }
225 static jclass AccessError_class = NULL;
226 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
227 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
228 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
229         AccessError_class = (*env)->NewGlobalRef(env, clz);
230         CHECK(AccessError_class != NULL);
231         AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
232         CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
233         AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
234         CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
235 }
236 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
237         switch (val) {
238                 case LDKAccessError_UnknownChain:
239                         return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
240                 case LDKAccessError_UnknownTx:
241                         return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
242                 default: abort();
243         }
244 }
245
246 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
247         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
248         if (UNLIKELY((*env)->ExceptionCheck(env))) {
249                 (*env)->ExceptionDescribe(env);
250                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
251         }
252         switch (ord) {
253                 case 0: return LDKCOption_NoneZ_Some;
254                 case 1: return LDKCOption_NoneZ_None;
255         }
256         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
257         abort(); // Unreachable, but will let the compiler know we don't return here
258 }
259 static jclass COption_NoneZ_class = NULL;
260 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
261 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
262 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
263         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
264         CHECK(COption_NoneZ_class != NULL);
265         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
266         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
267         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
268         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
269 }
270 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
271         switch (val) {
272                 case LDKCOption_NoneZ_Some:
273                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
274                 case LDKCOption_NoneZ_None:
275                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
276                 default: abort();
277         }
278 }
279
280 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
281         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
282         if (UNLIKELY((*env)->ExceptionCheck(env))) {
283                 (*env)->ExceptionDescribe(env);
284                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception.");
285         }
286         switch (ord) {
287                 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
288                 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
289         }
290         (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value.");
291         abort(); // Unreachable, but will let the compiler know we don't return here
292 }
293 static jclass ChannelMonitorUpdateErr_class = NULL;
294 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
295 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
296 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
297         ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
298         CHECK(ChannelMonitorUpdateErr_class != NULL);
299         ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
300         CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
301         ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
302         CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
303 }
304 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
305         switch (val) {
306                 case LDKChannelMonitorUpdateErr_TemporaryFailure:
307                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
308                 case LDKChannelMonitorUpdateErr_PermanentFailure:
309                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
310                 default: abort();
311         }
312 }
313
314 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
315         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
316         if (UNLIKELY((*env)->ExceptionCheck(env))) {
317                 (*env)->ExceptionDescribe(env);
318                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
319         }
320         switch (ord) {
321                 case 0: return LDKConfirmationTarget_Background;
322                 case 1: return LDKConfirmationTarget_Normal;
323                 case 2: return LDKConfirmationTarget_HighPriority;
324         }
325         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
326         abort(); // Unreachable, but will let the compiler know we don't return here
327 }
328 static jclass ConfirmationTarget_class = NULL;
329 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
330 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
331 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
333         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
334         CHECK(ConfirmationTarget_class != NULL);
335         ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
336         CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
337         ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
338         CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
339         ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
340         CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
341 }
342 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
343         switch (val) {
344                 case LDKConfirmationTarget_Background:
345                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
346                 case LDKConfirmationTarget_Normal:
347                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
348                 case LDKConfirmationTarget_HighPriority:
349                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
350                 default: abort();
351         }
352 }
353
354 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
355         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
356         if (UNLIKELY((*env)->ExceptionCheck(env))) {
357                 (*env)->ExceptionDescribe(env);
358                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
359         }
360         switch (ord) {
361                 case 0: return LDKCreationError_DescriptionTooLong;
362                 case 1: return LDKCreationError_RouteTooLong;
363                 case 2: return LDKCreationError_TimestampOutOfBounds;
364                 case 3: return LDKCreationError_InvalidAmount;
365                 case 4: return LDKCreationError_MissingRouteHints;
366         }
367         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
368         abort(); // Unreachable, but will let the compiler know we don't return here
369 }
370 static jclass CreationError_class = NULL;
371 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
372 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
373 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
374 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
375 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
376 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
377         CreationError_class = (*env)->NewGlobalRef(env, clz);
378         CHECK(CreationError_class != NULL);
379         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
380         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
381         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
382         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
383         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
384         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
385         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
386         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
387         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
388         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
389 }
390 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
391         switch (val) {
392                 case LDKCreationError_DescriptionTooLong:
393                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
394                 case LDKCreationError_RouteTooLong:
395                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
396                 case LDKCreationError_TimestampOutOfBounds:
397                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
398                 case LDKCreationError_InvalidAmount:
399                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
400                 case LDKCreationError_MissingRouteHints:
401                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
402                 default: abort();
403         }
404 }
405
406 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
407         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
408         if (UNLIKELY((*env)->ExceptionCheck(env))) {
409                 (*env)->ExceptionDescribe(env);
410                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
411         }
412         switch (ord) {
413                 case 0: return LDKCurrency_Bitcoin;
414                 case 1: return LDKCurrency_BitcoinTestnet;
415                 case 2: return LDKCurrency_Regtest;
416                 case 3: return LDKCurrency_Simnet;
417                 case 4: return LDKCurrency_Signet;
418         }
419         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
420         abort(); // Unreachable, but will let the compiler know we don't return here
421 }
422 static jclass Currency_class = NULL;
423 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
424 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
425 static jfieldID Currency_LDKCurrency_Regtest = NULL;
426 static jfieldID Currency_LDKCurrency_Simnet = NULL;
427 static jfieldID Currency_LDKCurrency_Signet = NULL;
428 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
429         Currency_class = (*env)->NewGlobalRef(env, clz);
430         CHECK(Currency_class != NULL);
431         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
432         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
433         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
434         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
435         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
436         CHECK(Currency_LDKCurrency_Regtest != NULL);
437         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
438         CHECK(Currency_LDKCurrency_Simnet != NULL);
439         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
440         CHECK(Currency_LDKCurrency_Signet != NULL);
441 }
442 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
443         switch (val) {
444                 case LDKCurrency_Bitcoin:
445                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
446                 case LDKCurrency_BitcoinTestnet:
447                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
448                 case LDKCurrency_Regtest:
449                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
450                 case LDKCurrency_Simnet:
451                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
452                 case LDKCurrency_Signet:
453                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
454                 default: abort();
455         }
456 }
457
458 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
459         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
460         if (UNLIKELY((*env)->ExceptionCheck(env))) {
461                 (*env)->ExceptionDescribe(env);
462                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
463         }
464         switch (ord) {
465                 case 0: return LDKIOError_NotFound;
466                 case 1: return LDKIOError_PermissionDenied;
467                 case 2: return LDKIOError_ConnectionRefused;
468                 case 3: return LDKIOError_ConnectionReset;
469                 case 4: return LDKIOError_ConnectionAborted;
470                 case 5: return LDKIOError_NotConnected;
471                 case 6: return LDKIOError_AddrInUse;
472                 case 7: return LDKIOError_AddrNotAvailable;
473                 case 8: return LDKIOError_BrokenPipe;
474                 case 9: return LDKIOError_AlreadyExists;
475                 case 10: return LDKIOError_WouldBlock;
476                 case 11: return LDKIOError_InvalidInput;
477                 case 12: return LDKIOError_InvalidData;
478                 case 13: return LDKIOError_TimedOut;
479                 case 14: return LDKIOError_WriteZero;
480                 case 15: return LDKIOError_Interrupted;
481                 case 16: return LDKIOError_Other;
482                 case 17: return LDKIOError_UnexpectedEof;
483         }
484         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
485         abort(); // Unreachable, but will let the compiler know we don't return here
486 }
487 static jclass IOError_class = NULL;
488 static jfieldID IOError_LDKIOError_NotFound = NULL;
489 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
490 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
491 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
492 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
493 static jfieldID IOError_LDKIOError_NotConnected = NULL;
494 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
495 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
496 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
497 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
498 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
499 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
500 static jfieldID IOError_LDKIOError_InvalidData = NULL;
501 static jfieldID IOError_LDKIOError_TimedOut = NULL;
502 static jfieldID IOError_LDKIOError_WriteZero = NULL;
503 static jfieldID IOError_LDKIOError_Interrupted = NULL;
504 static jfieldID IOError_LDKIOError_Other = NULL;
505 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
506 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
507         IOError_class = (*env)->NewGlobalRef(env, clz);
508         CHECK(IOError_class != NULL);
509         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
510         CHECK(IOError_LDKIOError_NotFound != NULL);
511         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
512         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
513         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
514         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
515         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
516         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
517         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
518         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
519         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
520         CHECK(IOError_LDKIOError_NotConnected != NULL);
521         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
522         CHECK(IOError_LDKIOError_AddrInUse != NULL);
523         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
524         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
525         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
526         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
527         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
528         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
529         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
530         CHECK(IOError_LDKIOError_WouldBlock != NULL);
531         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
532         CHECK(IOError_LDKIOError_InvalidInput != NULL);
533         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
534         CHECK(IOError_LDKIOError_InvalidData != NULL);
535         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
536         CHECK(IOError_LDKIOError_TimedOut != NULL);
537         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
538         CHECK(IOError_LDKIOError_WriteZero != NULL);
539         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
540         CHECK(IOError_LDKIOError_Interrupted != NULL);
541         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
542         CHECK(IOError_LDKIOError_Other != NULL);
543         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
544         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
545 }
546 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
547         switch (val) {
548                 case LDKIOError_NotFound:
549                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
550                 case LDKIOError_PermissionDenied:
551                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
552                 case LDKIOError_ConnectionRefused:
553                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
554                 case LDKIOError_ConnectionReset:
555                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
556                 case LDKIOError_ConnectionAborted:
557                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
558                 case LDKIOError_NotConnected:
559                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
560                 case LDKIOError_AddrInUse:
561                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
562                 case LDKIOError_AddrNotAvailable:
563                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
564                 case LDKIOError_BrokenPipe:
565                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
566                 case LDKIOError_AlreadyExists:
567                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
568                 case LDKIOError_WouldBlock:
569                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
570                 case LDKIOError_InvalidInput:
571                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
572                 case LDKIOError_InvalidData:
573                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
574                 case LDKIOError_TimedOut:
575                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
576                 case LDKIOError_WriteZero:
577                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
578                 case LDKIOError_Interrupted:
579                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
580                 case LDKIOError_Other:
581                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
582                 case LDKIOError_UnexpectedEof:
583                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
584                 default: abort();
585         }
586 }
587
588 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
589         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
590         if (UNLIKELY((*env)->ExceptionCheck(env))) {
591                 (*env)->ExceptionDescribe(env);
592                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
593         }
594         switch (ord) {
595                 case 0: return LDKLevel_Gossip;
596                 case 1: return LDKLevel_Trace;
597                 case 2: return LDKLevel_Debug;
598                 case 3: return LDKLevel_Info;
599                 case 4: return LDKLevel_Warn;
600                 case 5: return LDKLevel_Error;
601         }
602         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
603         abort(); // Unreachable, but will let the compiler know we don't return here
604 }
605 static jclass Level_class = NULL;
606 static jfieldID Level_LDKLevel_Gossip = NULL;
607 static jfieldID Level_LDKLevel_Trace = NULL;
608 static jfieldID Level_LDKLevel_Debug = NULL;
609 static jfieldID Level_LDKLevel_Info = NULL;
610 static jfieldID Level_LDKLevel_Warn = NULL;
611 static jfieldID Level_LDKLevel_Error = NULL;
612 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
613         Level_class = (*env)->NewGlobalRef(env, clz);
614         CHECK(Level_class != NULL);
615         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
616         CHECK(Level_LDKLevel_Gossip != NULL);
617         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
618         CHECK(Level_LDKLevel_Trace != NULL);
619         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
620         CHECK(Level_LDKLevel_Debug != NULL);
621         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
622         CHECK(Level_LDKLevel_Info != NULL);
623         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
624         CHECK(Level_LDKLevel_Warn != NULL);
625         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
626         CHECK(Level_LDKLevel_Error != NULL);
627 }
628 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
629         switch (val) {
630                 case LDKLevel_Gossip:
631                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
632                 case LDKLevel_Trace:
633                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
634                 case LDKLevel_Debug:
635                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
636                 case LDKLevel_Info:
637                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
638                 case LDKLevel_Warn:
639                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
640                 case LDKLevel_Error:
641                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
642                 default: abort();
643         }
644 }
645
646 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
647         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
648         if (UNLIKELY((*env)->ExceptionCheck(env))) {
649                 (*env)->ExceptionDescribe(env);
650                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
651         }
652         switch (ord) {
653                 case 0: return LDKNetwork_Bitcoin;
654                 case 1: return LDKNetwork_Testnet;
655                 case 2: return LDKNetwork_Regtest;
656                 case 3: return LDKNetwork_Signet;
657         }
658         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
659         abort(); // Unreachable, but will let the compiler know we don't return here
660 }
661 static jclass Network_class = NULL;
662 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
663 static jfieldID Network_LDKNetwork_Testnet = NULL;
664 static jfieldID Network_LDKNetwork_Regtest = NULL;
665 static jfieldID Network_LDKNetwork_Signet = NULL;
666 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
667         Network_class = (*env)->NewGlobalRef(env, clz);
668         CHECK(Network_class != NULL);
669         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
670         CHECK(Network_LDKNetwork_Bitcoin != NULL);
671         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
672         CHECK(Network_LDKNetwork_Testnet != NULL);
673         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
674         CHECK(Network_LDKNetwork_Regtest != NULL);
675         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
676         CHECK(Network_LDKNetwork_Signet != NULL);
677 }
678 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
679         switch (val) {
680                 case LDKNetwork_Bitcoin:
681                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
682                 case LDKNetwork_Testnet:
683                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
684                 case LDKNetwork_Regtest:
685                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
686                 case LDKNetwork_Signet:
687                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
688                 default: abort();
689         }
690 }
691
692 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
693         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
694         if (UNLIKELY((*env)->ExceptionCheck(env))) {
695                 (*env)->ExceptionDescribe(env);
696                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
697         }
698         switch (ord) {
699                 case 0: return LDKRecipient_Node;
700                 case 1: return LDKRecipient_PhantomNode;
701         }
702         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
703         abort(); // Unreachable, but will let the compiler know we don't return here
704 }
705 static jclass Recipient_class = NULL;
706 static jfieldID Recipient_LDKRecipient_Node = NULL;
707 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
708 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
709         Recipient_class = (*env)->NewGlobalRef(env, clz);
710         CHECK(Recipient_class != NULL);
711         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
712         CHECK(Recipient_LDKRecipient_Node != NULL);
713         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
714         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
715 }
716 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
717         switch (val) {
718                 case LDKRecipient_Node:
719                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
720                 case LDKRecipient_PhantomNode:
721                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
722                 default: abort();
723         }
724 }
725
726 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
727         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
728         if (UNLIKELY((*env)->ExceptionCheck(env))) {
729                 (*env)->ExceptionDescribe(env);
730                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
731         }
732         switch (ord) {
733                 case 0: return LDKSecp256k1Error_IncorrectSignature;
734                 case 1: return LDKSecp256k1Error_InvalidMessage;
735                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
736                 case 3: return LDKSecp256k1Error_InvalidSignature;
737                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
738                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
739                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
740                 case 7: return LDKSecp256k1Error_InvalidTweak;
741                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
742                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
743                 case 10: return LDKSecp256k1Error_InvalidParityValue;
744         }
745         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
746         abort(); // Unreachable, but will let the compiler know we don't return here
747 }
748 static jclass Secp256k1Error_class = NULL;
749 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
750 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
751 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
752 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
753 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
754 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
755 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
756 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
757 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
758 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
759 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
760 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
761         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
762         CHECK(Secp256k1Error_class != NULL);
763         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
764         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
765         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
766         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
767         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
768         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
769         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
770         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
771         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
772         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
773         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
774         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
775         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
776         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
777         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
778         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
779         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
780         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
781         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
782         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
783         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
784         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
785 }
786 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
787         switch (val) {
788                 case LDKSecp256k1Error_IncorrectSignature:
789                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
790                 case LDKSecp256k1Error_InvalidMessage:
791                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
792                 case LDKSecp256k1Error_InvalidPublicKey:
793                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
794                 case LDKSecp256k1Error_InvalidSignature:
795                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
796                 case LDKSecp256k1Error_InvalidSecretKey:
797                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
798                 case LDKSecp256k1Error_InvalidSharedSecret:
799                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
800                 case LDKSecp256k1Error_InvalidRecoveryId:
801                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
802                 case LDKSecp256k1Error_InvalidTweak:
803                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
804                 case LDKSecp256k1Error_NotEnoughMemory:
805                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
806                 case LDKSecp256k1Error_InvalidPublicKeySum:
807                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
808                 case LDKSecp256k1Error_InvalidParityValue:
809                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
810                 default: abort();
811         }
812 }
813
814 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
815         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
816         if (UNLIKELY((*env)->ExceptionCheck(env))) {
817                 (*env)->ExceptionDescribe(env);
818                 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
819         }
820         switch (ord) {
821                 case 0: return LDKSemanticError_NoPaymentHash;
822                 case 1: return LDKSemanticError_MultiplePaymentHashes;
823                 case 2: return LDKSemanticError_NoDescription;
824                 case 3: return LDKSemanticError_MultipleDescriptions;
825                 case 4: return LDKSemanticError_NoPaymentSecret;
826                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
827                 case 6: return LDKSemanticError_InvalidFeatures;
828                 case 7: return LDKSemanticError_InvalidRecoveryId;
829                 case 8: return LDKSemanticError_InvalidSignature;
830                 case 9: return LDKSemanticError_ImpreciseAmount;
831         }
832         (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
833         abort(); // Unreachable, but will let the compiler know we don't return here
834 }
835 static jclass SemanticError_class = NULL;
836 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
837 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
838 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
839 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
840 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
841 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
842 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
843 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
844 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
845 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
846 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
847         SemanticError_class = (*env)->NewGlobalRef(env, clz);
848         CHECK(SemanticError_class != NULL);
849         SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
850         CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
851         SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
852         CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
853         SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
854         CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
855         SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
856         CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
857         SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
858         CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
859         SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
860         CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
861         SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
862         CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
863         SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
864         CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
865         SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
866         CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
867         SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
868         CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
869 }
870 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
871         switch (val) {
872                 case LDKSemanticError_NoPaymentHash:
873                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
874                 case LDKSemanticError_MultiplePaymentHashes:
875                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
876                 case LDKSemanticError_NoDescription:
877                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
878                 case LDKSemanticError_MultipleDescriptions:
879                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
880                 case LDKSemanticError_NoPaymentSecret:
881                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
882                 case LDKSemanticError_MultiplePaymentSecrets:
883                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
884                 case LDKSemanticError_InvalidFeatures:
885                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
886                 case LDKSemanticError_InvalidRecoveryId:
887                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
888                 case LDKSemanticError_InvalidSignature:
889                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
890                 case LDKSemanticError_ImpreciseAmount:
891                         return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
892                 default: abort();
893         }
894 }
895
896 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
897         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
898         if (UNLIKELY((*env)->ExceptionCheck(env))) {
899                 (*env)->ExceptionDescribe(env);
900                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
901         }
902         switch (ord) {
903                 case 0: return LDKSiPrefix_Milli;
904                 case 1: return LDKSiPrefix_Micro;
905                 case 2: return LDKSiPrefix_Nano;
906                 case 3: return LDKSiPrefix_Pico;
907         }
908         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
909         abort(); // Unreachable, but will let the compiler know we don't return here
910 }
911 static jclass SiPrefix_class = NULL;
912 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
913 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
914 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
915 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
916 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
917         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
918         CHECK(SiPrefix_class != NULL);
919         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
920         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
921         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
922         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
923         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
924         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
925         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
926         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
927 }
928 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
929         switch (val) {
930                 case LDKSiPrefix_Milli:
931                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
932                 case LDKSiPrefix_Micro:
933                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
934                 case LDKSiPrefix_Nano:
935                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
936                 case LDKSiPrefix_Pico:
937                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
938                 default: abort();
939         }
940 }
941
942 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
943         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
944         return ret;
945 }
946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
947         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
948         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
949         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
950         return ret_arr;
951 }
952
953 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
955         if (!ptr_is_owned(thing)) return;
956         void* thing_ptr = untag_ptr(thing);
957         CHECK_ACCESS(thing_ptr);
958         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
959         FREE(untag_ptr(thing));
960         BigEndianScalar_free(thing_conv);
961 }
962
963 static jclass LDKBech32Error_MissingSeparator_class = NULL;
964 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
965 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
966 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
967 static jclass LDKBech32Error_InvalidLength_class = NULL;
968 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
969 static jclass LDKBech32Error_InvalidChar_class = NULL;
970 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
971 static jclass LDKBech32Error_InvalidData_class = NULL;
972 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
973 static jclass LDKBech32Error_InvalidPadding_class = NULL;
974 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
975 static jclass LDKBech32Error_MixedCase_class = NULL;
976 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
978         LDKBech32Error_MissingSeparator_class =
979                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
980         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
981         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
982         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
983         LDKBech32Error_InvalidChecksum_class =
984                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
985         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
986         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
987         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
988         LDKBech32Error_InvalidLength_class =
989                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
990         CHECK(LDKBech32Error_InvalidLength_class != NULL);
991         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
992         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
993         LDKBech32Error_InvalidChar_class =
994                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
995         CHECK(LDKBech32Error_InvalidChar_class != NULL);
996         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
997         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
998         LDKBech32Error_InvalidData_class =
999                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1000         CHECK(LDKBech32Error_InvalidData_class != NULL);
1001         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1002         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1003         LDKBech32Error_InvalidPadding_class =
1004                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1005         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1006         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1007         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1008         LDKBech32Error_MixedCase_class =
1009                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1010         CHECK(LDKBech32Error_MixedCase_class != NULL);
1011         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1012         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1013 }
1014 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1015         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1016         switch(obj->tag) {
1017                 case LDKBech32Error_MissingSeparator: {
1018                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1019                 }
1020                 case LDKBech32Error_InvalidChecksum: {
1021                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1022                 }
1023                 case LDKBech32Error_InvalidLength: {
1024                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1025                 }
1026                 case LDKBech32Error_InvalidChar: {
1027                         int32_t invalid_char_conv = obj->invalid_char;
1028                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1029                 }
1030                 case LDKBech32Error_InvalidData: {
1031                         int8_t invalid_data_conv = obj->invalid_data;
1032                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1033                 }
1034                 case LDKBech32Error_InvalidPadding: {
1035                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1036                 }
1037                 case LDKBech32Error_MixedCase: {
1038                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1039                 }
1040                 default: abort();
1041         }
1042 }
1043 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1044         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1045         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1046         return ret;
1047 }
1048 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) {
1049         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1050         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1051         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1052         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1053         CVec_u8Z_free(ret_var);
1054         return ret_arr;
1055 }
1056
1057 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) {
1058         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1059         int64_t ret_conv = TxOut_get_value(thing_conv);
1060         return ret_conv;
1061 }
1062
1063 static inline struct LDKBlindedRoute CResult_BlindedRouteNoneZ_get_ok(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
1064         LDKBlindedRoute ret = *owner->contents.result;
1065         ret.is_owned = false;
1066         return ret;
1067 }
1068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1069         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
1070         LDKBlindedRoute ret_var = CResult_BlindedRouteNoneZ_get_ok(owner_conv);
1071         int64_t ret_ref = 0;
1072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1074         return ret_ref;
1075 }
1076
1077 static inline void CResult_BlindedRouteNoneZ_get_err(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
1078 CHECK(!owner->result_ok);
1079         return *owner->contents.err;
1080 }
1081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1082         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
1083         CResult_BlindedRouteNoneZ_get_err(owner_conv);
1084 }
1085
1086 static inline struct LDKBlindedRoute CResult_BlindedRouteDecodeErrorZ_get_ok(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
1087         LDKBlindedRoute ret = *owner->contents.result;
1088         ret.is_owned = false;
1089         return ret;
1090 }
1091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1092         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
1093         LDKBlindedRoute ret_var = CResult_BlindedRouteDecodeErrorZ_get_ok(owner_conv);
1094         int64_t ret_ref = 0;
1095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1097         return ret_ref;
1098 }
1099
1100 static inline struct LDKDecodeError CResult_BlindedRouteDecodeErrorZ_get_err(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
1101         LDKDecodeError ret = *owner->contents.err;
1102         ret.is_owned = false;
1103         return ret;
1104 }
1105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1106         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
1107         LDKDecodeError ret_var = CResult_BlindedRouteDecodeErrorZ_get_err(owner_conv);
1108         int64_t ret_ref = 0;
1109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1111         return ret_ref;
1112 }
1113
1114 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1115         LDKBlindedHop ret = *owner->contents.result;
1116         ret.is_owned = false;
1117         return ret;
1118 }
1119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1120         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1121         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
1122         int64_t ret_ref = 0;
1123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1125         return ret_ref;
1126 }
1127
1128 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1129         LDKDecodeError ret = *owner->contents.err;
1130         ret.is_owned = false;
1131         return ret;
1132 }
1133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1134         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1135         LDKDecodeError ret_var = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
1136         int64_t ret_ref = 0;
1137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1139         return ret_ref;
1140 }
1141
1142 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1143 CHECK(owner->result_ok);
1144         return *owner->contents.result;
1145 }
1146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1147         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1148         CResult_NoneNoneZ_get_ok(owner_conv);
1149 }
1150
1151 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1152 CHECK(!owner->result_ok);
1153         return *owner->contents.err;
1154 }
1155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1156         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1157         CResult_NoneNoneZ_get_err(owner_conv);
1158 }
1159
1160 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1161         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
1162         ret.is_owned = false;
1163         return ret;
1164 }
1165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1166         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1167         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_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_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *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_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1180         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1181         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_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 LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1189 CHECK(owner->result_ok);
1190         return *owner->contents.result;
1191 }
1192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1193         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1194         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1195         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1196         return ret_arr;
1197 }
1198
1199 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1200 CHECK(!owner->result_ok);
1201         return *owner->contents.err;
1202 }
1203 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1204         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1205         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1206         return ret_conv;
1207 }
1208
1209 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1210 CHECK(owner->result_ok);
1211         return *owner->contents.result;
1212 }
1213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1214         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1215         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1216         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1217         return ret_arr;
1218 }
1219
1220 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1221 CHECK(!owner->result_ok);
1222         return *owner->contents.err;
1223 }
1224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1225         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1226         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1227         return ret_conv;
1228 }
1229
1230 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1231         LDKTxCreationKeys ret = *owner->contents.result;
1232         ret.is_owned = false;
1233         return ret;
1234 }
1235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1236         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1237         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1238         int64_t ret_ref = 0;
1239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1241         return ret_ref;
1242 }
1243
1244 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1245         LDKDecodeError ret = *owner->contents.err;
1246         ret.is_owned = false;
1247         return ret;
1248 }
1249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1250         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1251         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1252         int64_t ret_ref = 0;
1253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1255         return ret_ref;
1256 }
1257
1258 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1259         LDKChannelPublicKeys ret = *owner->contents.result;
1260         ret.is_owned = false;
1261         return ret;
1262 }
1263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1264         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1265         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1266         int64_t ret_ref = 0;
1267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1269         return ret_ref;
1270 }
1271
1272 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1273         LDKDecodeError ret = *owner->contents.err;
1274         ret.is_owned = false;
1275         return ret;
1276 }
1277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1278         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1279         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1280         int64_t ret_ref = 0;
1281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1283         return ret_ref;
1284 }
1285
1286 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1287         LDKTxCreationKeys ret = *owner->contents.result;
1288         ret.is_owned = false;
1289         return ret;
1290 }
1291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1292         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1293         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1294         int64_t ret_ref = 0;
1295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1297         return ret_ref;
1298 }
1299
1300 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1301 CHECK(!owner->result_ok);
1302         return *owner->contents.err;
1303 }
1304 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1305         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1306         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1307         return ret_conv;
1308 }
1309
1310 static jclass LDKCOption_u32Z_Some_class = NULL;
1311 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1312 static jclass LDKCOption_u32Z_None_class = NULL;
1313 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1315         LDKCOption_u32Z_Some_class =
1316                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1317         CHECK(LDKCOption_u32Z_Some_class != NULL);
1318         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1319         CHECK(LDKCOption_u32Z_Some_meth != NULL);
1320         LDKCOption_u32Z_None_class =
1321                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1322         CHECK(LDKCOption_u32Z_None_class != NULL);
1323         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1324         CHECK(LDKCOption_u32Z_None_meth != NULL);
1325 }
1326 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1327         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1328         switch(obj->tag) {
1329                 case LDKCOption_u32Z_Some: {
1330                         int32_t some_conv = obj->some;
1331                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1332                 }
1333                 case LDKCOption_u32Z_None: {
1334                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1335                 }
1336                 default: abort();
1337         }
1338 }
1339 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1340         LDKHTLCOutputInCommitment ret = *owner->contents.result;
1341         ret.is_owned = false;
1342         return ret;
1343 }
1344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1345         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1346         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(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 LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1354         LDKDecodeError ret = *owner->contents.err;
1355         ret.is_owned = false;
1356         return ret;
1357 }
1358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1359         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1360         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(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 LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1368         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
1369         ret.is_owned = false;
1370         return ret;
1371 }
1372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1373         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1374         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(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 LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1382         LDKDecodeError ret = *owner->contents.err;
1383         ret.is_owned = false;
1384         return ret;
1385 }
1386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1387         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1388         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(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 struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1396         LDKChannelTransactionParameters ret = *owner->contents.result;
1397         ret.is_owned = false;
1398         return ret;
1399 }
1400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1401         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1402         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1403         int64_t ret_ref = 0;
1404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1406         return ret_ref;
1407 }
1408
1409 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1410         LDKDecodeError ret = *owner->contents.err;
1411         ret.is_owned = false;
1412         return ret;
1413 }
1414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1415         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1416         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1417         int64_t ret_ref = 0;
1418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1420         return ret_ref;
1421 }
1422
1423 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1424         LDKHolderCommitmentTransaction ret = *owner->contents.result;
1425         ret.is_owned = false;
1426         return ret;
1427 }
1428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1429         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1430         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1431         int64_t ret_ref = 0;
1432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1434         return ret_ref;
1435 }
1436
1437 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1438         LDKDecodeError ret = *owner->contents.err;
1439         ret.is_owned = false;
1440         return ret;
1441 }
1442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1443         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1444         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1445         int64_t ret_ref = 0;
1446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1448         return ret_ref;
1449 }
1450
1451 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1452         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
1453         ret.is_owned = false;
1454         return ret;
1455 }
1456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1457         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1458         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1459         int64_t ret_ref = 0;
1460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1462         return ret_ref;
1463 }
1464
1465 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1466         LDKDecodeError ret = *owner->contents.err;
1467         ret.is_owned = false;
1468         return ret;
1469 }
1470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1471         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1472         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1473         int64_t ret_ref = 0;
1474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1476         return ret_ref;
1477 }
1478
1479 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1480         LDKTrustedClosingTransaction ret = *owner->contents.result;
1481         ret.is_owned = false;
1482         return ret;
1483 }
1484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1485         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1486         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1487         int64_t ret_ref = 0;
1488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1490         return ret_ref;
1491 }
1492
1493 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1494 CHECK(!owner->result_ok);
1495         return *owner->contents.err;
1496 }
1497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1498         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1499         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1500 }
1501
1502 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1503         LDKCommitmentTransaction ret = *owner->contents.result;
1504         ret.is_owned = false;
1505         return ret;
1506 }
1507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1508         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1509         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1510         int64_t ret_ref = 0;
1511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1513         return ret_ref;
1514 }
1515
1516 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1517         LDKDecodeError ret = *owner->contents.err;
1518         ret.is_owned = false;
1519         return ret;
1520 }
1521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1522         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1523         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1524         int64_t ret_ref = 0;
1525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1527         return ret_ref;
1528 }
1529
1530 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1531         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1532         ret.is_owned = false;
1533         return ret;
1534 }
1535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1536         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1537         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1538         int64_t ret_ref = 0;
1539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1541         return ret_ref;
1542 }
1543
1544 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1545 CHECK(!owner->result_ok);
1546         return *owner->contents.err;
1547 }
1548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1549         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1550         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1551 }
1552
1553 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1554 CHECK(owner->result_ok);
1555         return *owner->contents.result;
1556 }
1557 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1558         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1559         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1560         jobjectArray ret_arr = NULL;
1561         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1562         ;
1563         for (size_t i = 0; i < ret_var.datalen; i++) {
1564                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1565                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1566                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1567         }
1568         
1569         return ret_arr;
1570 }
1571
1572 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1573 CHECK(!owner->result_ok);
1574         return *owner->contents.err;
1575 }
1576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1577         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1578         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1579 }
1580
1581 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1582         LDKShutdownScript ret = *owner->contents.result;
1583         ret.is_owned = false;
1584         return ret;
1585 }
1586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1587         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1588         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1589         int64_t ret_ref = 0;
1590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1592         return ret_ref;
1593 }
1594
1595 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1596         LDKDecodeError ret = *owner->contents.err;
1597         ret.is_owned = false;
1598         return ret;
1599 }
1600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1601         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1602         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1603         int64_t ret_ref = 0;
1604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1606         return ret_ref;
1607 }
1608
1609 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1610         LDKShutdownScript ret = *owner->contents.result;
1611         ret.is_owned = false;
1612         return ret;
1613 }
1614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1615         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1616         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1617         int64_t ret_ref = 0;
1618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1620         return ret_ref;
1621 }
1622
1623 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1624         LDKInvalidShutdownScript ret = *owner->contents.err;
1625         ret.is_owned = false;
1626         return ret;
1627 }
1628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1629         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1630         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1631         int64_t ret_ref = 0;
1632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1634         return ret_ref;
1635 }
1636
1637 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1638         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1639         for (size_t i = 0; i < ret.datalen; i++) {
1640                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1641         }
1642         return ret;
1643 }
1644 typedef struct LDKScore_JCalls {
1645         atomic_size_t refcnt;
1646         JavaVM *vm;
1647         jweak o;
1648         jmethodID channel_penalty_msat_meth;
1649         jmethodID payment_path_failed_meth;
1650         jmethodID payment_path_successful_meth;
1651         jmethodID probe_failed_meth;
1652         jmethodID probe_successful_meth;
1653         jmethodID write_meth;
1654 } LDKScore_JCalls;
1655 static void LDKScore_JCalls_free(void* this_arg) {
1656         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1657         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1658                 JNIEnv *env;
1659                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1660                 if (get_jenv_res == JNI_EDETACHED) {
1661                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1662                 } else {
1663                         DO_ASSERT(get_jenv_res == JNI_OK);
1664                 }
1665                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1666                 if (get_jenv_res == JNI_EDETACHED) {
1667                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1668                 }
1669                 FREE(j_calls);
1670         }
1671 }
1672 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
1673         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1674         JNIEnv *env;
1675         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1676         if (get_jenv_res == JNI_EDETACHED) {
1677                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1678         } else {
1679                 DO_ASSERT(get_jenv_res == JNI_OK);
1680         }
1681         int64_t short_channel_id_conv = short_channel_id;
1682         LDKNodeId source_var = *source;
1683         int64_t source_ref = 0;
1684         source_var = NodeId_clone(&source_var);
1685         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
1686         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
1687         LDKNodeId target_var = *target;
1688         int64_t target_ref = 0;
1689         target_var = NodeId_clone(&target_var);
1690         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
1691         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
1692         LDKChannelUsage usage_var = usage;
1693         int64_t usage_ref = 0;
1694         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
1695         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
1696         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1697         CHECK(obj != NULL);
1698         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
1699         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1700                 (*env)->ExceptionDescribe(env);
1701                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
1702         }
1703         if (get_jenv_res == JNI_EDETACHED) {
1704                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1705         }
1706         return ret;
1707 }
1708 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
1709         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1710         JNIEnv *env;
1711         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1712         if (get_jenv_res == JNI_EDETACHED) {
1713                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1714         } else {
1715                 DO_ASSERT(get_jenv_res == JNI_OK);
1716         }
1717         LDKCVec_RouteHopZ path_var = path;
1718         int64_tArray path_arr = NULL;
1719         path_arr = (*env)->NewLongArray(env, path_var.datalen);
1720         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
1721         for (size_t k = 0; k < path_var.datalen; k++) {
1722                 LDKRouteHop path_conv_10_var = path_var.data[k];
1723                 int64_t path_conv_10_ref = 0;
1724                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1725                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
1726                 path_arr_ptr[k] = path_conv_10_ref;
1727         }
1728         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
1729         FREE(path_var.data);
1730         int64_t short_channel_id_conv = short_channel_id;
1731         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1732         CHECK(obj != NULL);
1733         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
1734         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1735                 (*env)->ExceptionDescribe(env);
1736                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
1737         }
1738         if (get_jenv_res == JNI_EDETACHED) {
1739                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1740         }
1741 }
1742 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
1743         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1744         JNIEnv *env;
1745         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1746         if (get_jenv_res == JNI_EDETACHED) {
1747                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1748         } else {
1749                 DO_ASSERT(get_jenv_res == JNI_OK);
1750         }
1751         LDKCVec_RouteHopZ path_var = path;
1752         int64_tArray path_arr = NULL;
1753         path_arr = (*env)->NewLongArray(env, path_var.datalen);
1754         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
1755         for (size_t k = 0; k < path_var.datalen; k++) {
1756                 LDKRouteHop path_conv_10_var = path_var.data[k];
1757                 int64_t path_conv_10_ref = 0;
1758                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1759                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
1760                 path_arr_ptr[k] = path_conv_10_ref;
1761         }
1762         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
1763         FREE(path_var.data);
1764         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1765         CHECK(obj != NULL);
1766         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
1767         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1768                 (*env)->ExceptionDescribe(env);
1769                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
1770         }
1771         if (get_jenv_res == JNI_EDETACHED) {
1772                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1773         }
1774 }
1775 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
1776         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1777         JNIEnv *env;
1778         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1779         if (get_jenv_res == JNI_EDETACHED) {
1780                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1781         } else {
1782                 DO_ASSERT(get_jenv_res == JNI_OK);
1783         }
1784         LDKCVec_RouteHopZ path_var = path;
1785         int64_tArray path_arr = NULL;
1786         path_arr = (*env)->NewLongArray(env, path_var.datalen);
1787         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
1788         for (size_t k = 0; k < path_var.datalen; k++) {
1789                 LDKRouteHop path_conv_10_var = path_var.data[k];
1790                 int64_t path_conv_10_ref = 0;
1791                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1792                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
1793                 path_arr_ptr[k] = path_conv_10_ref;
1794         }
1795         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
1796         FREE(path_var.data);
1797         int64_t short_channel_id_conv = short_channel_id;
1798         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1799         CHECK(obj != NULL);
1800         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv);
1801         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1802                 (*env)->ExceptionDescribe(env);
1803                 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
1804         }
1805         if (get_jenv_res == JNI_EDETACHED) {
1806                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1807         }
1808 }
1809 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
1810         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1811         JNIEnv *env;
1812         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1813         if (get_jenv_res == JNI_EDETACHED) {
1814                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1815         } else {
1816                 DO_ASSERT(get_jenv_res == JNI_OK);
1817         }
1818         LDKCVec_RouteHopZ path_var = path;
1819         int64_tArray path_arr = NULL;
1820         path_arr = (*env)->NewLongArray(env, path_var.datalen);
1821         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
1822         for (size_t k = 0; k < path_var.datalen; k++) {
1823                 LDKRouteHop path_conv_10_var = path_var.data[k];
1824                 int64_t path_conv_10_ref = 0;
1825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1826                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
1827                 path_arr_ptr[k] = path_conv_10_ref;
1828         }
1829         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
1830         FREE(path_var.data);
1831         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1832         CHECK(obj != NULL);
1833         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr);
1834         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1835                 (*env)->ExceptionDescribe(env);
1836                 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
1837         }
1838         if (get_jenv_res == JNI_EDETACHED) {
1839                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1840         }
1841 }
1842 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
1843         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
1844         JNIEnv *env;
1845         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
1846         if (get_jenv_res == JNI_EDETACHED) {
1847                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
1848         } else {
1849                 DO_ASSERT(get_jenv_res == JNI_OK);
1850         }
1851         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1852         CHECK(obj != NULL);
1853         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
1854         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1855                 (*env)->ExceptionDescribe(env);
1856                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
1857         }
1858         LDKCVec_u8Z ret_ref;
1859         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
1860         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1861         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
1862         if (get_jenv_res == JNI_EDETACHED) {
1863                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
1864         }
1865         return ret_ref;
1866 }
1867 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
1868         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
1869         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1870 }
1871 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
1872         jclass c = (*env)->GetObjectClass(env, o);
1873         CHECK(c != NULL);
1874         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
1875         atomic_init(&calls->refcnt, 1);
1876         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1877         calls->o = (*env)->NewWeakGlobalRef(env, o);
1878         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
1879         CHECK(calls->channel_penalty_msat_meth != NULL);
1880         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
1881         CHECK(calls->payment_path_failed_meth != NULL);
1882         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
1883         CHECK(calls->payment_path_successful_meth != NULL);
1884         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V");
1885         CHECK(calls->probe_failed_meth != NULL);
1886         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V");
1887         CHECK(calls->probe_successful_meth != NULL);
1888         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
1889         CHECK(calls->write_meth != NULL);
1890
1891         LDKScore ret = {
1892                 .this_arg = (void*) calls,
1893                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
1894                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
1895                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
1896                 .probe_failed = probe_failed_LDKScore_jcall,
1897                 .probe_successful = probe_successful_LDKScore_jcall,
1898                 .write = write_LDKScore_jcall,
1899                 .free = LDKScore_JCalls_free,
1900         };
1901         return ret;
1902 }
1903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
1904         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
1905         *res_ptr = LDKScore_init(env, clz, o);
1906         return tag_ptr(res_ptr, true);
1907 }
1908 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) {
1909         void* this_arg_ptr = untag_ptr(this_arg);
1910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1911         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
1912         LDKNodeId source_conv;
1913         source_conv.inner = untag_ptr(source);
1914         source_conv.is_owned = ptr_is_owned(source);
1915         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
1916         source_conv.is_owned = false;
1917         LDKNodeId target_conv;
1918         target_conv.inner = untag_ptr(target);
1919         target_conv.is_owned = ptr_is_owned(target);
1920         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
1921         target_conv.is_owned = false;
1922         LDKChannelUsage usage_conv;
1923         usage_conv.inner = untag_ptr(usage);
1924         usage_conv.is_owned = ptr_is_owned(usage);
1925         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
1926         usage_conv = ChannelUsage_clone(&usage_conv);
1927         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
1928         return ret_conv;
1929 }
1930
1931 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) {
1932         void* this_arg_ptr = untag_ptr(this_arg);
1933         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1934         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
1935         LDKCVec_RouteHopZ path_constr;
1936         path_constr.datalen = (*env)->GetArrayLength(env, path);
1937         if (path_constr.datalen > 0)
1938                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
1939         else
1940                 path_constr.data = NULL;
1941         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
1942         for (size_t k = 0; k < path_constr.datalen; k++) {
1943                 int64_t path_conv_10 = path_vals[k];
1944                 LDKRouteHop path_conv_10_conv;
1945                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
1946                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
1947                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
1948                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
1949                 path_constr.data[k] = path_conv_10_conv;
1950         }
1951         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
1952         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
1953 }
1954
1955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
1956         void* this_arg_ptr = untag_ptr(this_arg);
1957         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1958         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
1959         LDKCVec_RouteHopZ path_constr;
1960         path_constr.datalen = (*env)->GetArrayLength(env, path);
1961         if (path_constr.datalen > 0)
1962                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
1963         else
1964                 path_constr.data = NULL;
1965         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
1966         for (size_t k = 0; k < path_constr.datalen; k++) {
1967                 int64_t path_conv_10 = path_vals[k];
1968                 LDKRouteHop path_conv_10_conv;
1969                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
1970                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
1971                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
1972                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
1973                 path_constr.data[k] = path_conv_10_conv;
1974         }
1975         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
1976         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
1977 }
1978
1979 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) {
1980         void* this_arg_ptr = untag_ptr(this_arg);
1981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1982         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
1983         LDKCVec_RouteHopZ path_constr;
1984         path_constr.datalen = (*env)->GetArrayLength(env, path);
1985         if (path_constr.datalen > 0)
1986                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
1987         else
1988                 path_constr.data = NULL;
1989         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
1990         for (size_t k = 0; k < path_constr.datalen; k++) {
1991                 int64_t path_conv_10 = path_vals[k];
1992                 LDKRouteHop path_conv_10_conv;
1993                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
1994                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
1995                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
1996                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
1997                 path_constr.data[k] = path_conv_10_conv;
1998         }
1999         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
2000         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
2001 }
2002
2003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
2004         void* this_arg_ptr = untag_ptr(this_arg);
2005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2006         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2007         LDKCVec_RouteHopZ path_constr;
2008         path_constr.datalen = (*env)->GetArrayLength(env, path);
2009         if (path_constr.datalen > 0)
2010                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
2011         else
2012                 path_constr.data = NULL;
2013         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
2014         for (size_t k = 0; k < path_constr.datalen; k++) {
2015                 int64_t path_conv_10 = path_vals[k];
2016                 LDKRouteHop path_conv_10_conv;
2017                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
2018                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
2019                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
2020                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
2021                 path_constr.data[k] = path_conv_10_conv;
2022         }
2023         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
2024         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
2025 }
2026
2027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2028         void* this_arg_ptr = untag_ptr(this_arg);
2029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2030         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
2031         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2032         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2033         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2034         CVec_u8Z_free(ret_var);
2035         return ret_arr;
2036 }
2037
2038 typedef struct LDKLockableScore_JCalls {
2039         atomic_size_t refcnt;
2040         JavaVM *vm;
2041         jweak o;
2042         jmethodID lock_meth;
2043 } LDKLockableScore_JCalls;
2044 static void LDKLockableScore_JCalls_free(void* this_arg) {
2045         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2046         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2047                 JNIEnv *env;
2048                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2049                 if (get_jenv_res == JNI_EDETACHED) {
2050                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2051                 } else {
2052                         DO_ASSERT(get_jenv_res == JNI_OK);
2053                 }
2054                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2055                 if (get_jenv_res == JNI_EDETACHED) {
2056                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2057                 }
2058                 FREE(j_calls);
2059         }
2060 }
2061 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
2062         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
2063         JNIEnv *env;
2064         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2065         if (get_jenv_res == JNI_EDETACHED) {
2066                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2067         } else {
2068                 DO_ASSERT(get_jenv_res == JNI_OK);
2069         }
2070         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2071         CHECK(obj != NULL);
2072         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
2073         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2074                 (*env)->ExceptionDescribe(env);
2075                 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
2076         }
2077         void* ret_ptr = untag_ptr(ret);
2078         CHECK_ACCESS(ret_ptr);
2079         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
2080         if (ret_conv.free == LDKScore_JCalls_free) {
2081                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2082                 LDKScore_JCalls_cloned(&ret_conv);
2083         }// WARNING: we may need a move here but no clone is available for LDKScore
2084         
2085         if (get_jenv_res == JNI_EDETACHED) {
2086                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2087         }
2088         return ret_conv;
2089 }
2090 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
2091         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
2092         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2093 }
2094 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
2095         jclass c = (*env)->GetObjectClass(env, o);
2096         CHECK(c != NULL);
2097         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
2098         atomic_init(&calls->refcnt, 1);
2099         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2100         calls->o = (*env)->NewWeakGlobalRef(env, o);
2101         calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
2102         CHECK(calls->lock_meth != NULL);
2103
2104         LDKLockableScore ret = {
2105                 .this_arg = (void*) calls,
2106                 .lock = lock_LDKLockableScore_jcall,
2107                 .free = LDKLockableScore_JCalls_free,
2108         };
2109         return ret;
2110 }
2111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
2112         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
2113         *res_ptr = LDKLockableScore_init(env, clz, o);
2114         return tag_ptr(res_ptr, true);
2115 }
2116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
2117         void* this_arg_ptr = untag_ptr(this_arg);
2118         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2119         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
2120         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
2121         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
2122         return tag_ptr(ret_ret, true);
2123 }
2124
2125 typedef struct LDKWriteableScore_JCalls {
2126         atomic_size_t refcnt;
2127         JavaVM *vm;
2128         jweak o;
2129         LDKLockableScore_JCalls* LockableScore;
2130         jmethodID write_meth;
2131 } LDKWriteableScore_JCalls;
2132 static void LDKWriteableScore_JCalls_free(void* this_arg) {
2133         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2134         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2135                 JNIEnv *env;
2136                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2137                 if (get_jenv_res == JNI_EDETACHED) {
2138                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2139                 } else {
2140                         DO_ASSERT(get_jenv_res == JNI_OK);
2141                 }
2142                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2143                 if (get_jenv_res == JNI_EDETACHED) {
2144                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2145                 }
2146                 FREE(j_calls);
2147         }
2148 }
2149 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
2150         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
2151         JNIEnv *env;
2152         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2153         if (get_jenv_res == JNI_EDETACHED) {
2154                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2155         } else {
2156                 DO_ASSERT(get_jenv_res == JNI_OK);
2157         }
2158         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2159         CHECK(obj != NULL);
2160         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2161         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2162                 (*env)->ExceptionDescribe(env);
2163                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
2164         }
2165         LDKCVec_u8Z ret_ref;
2166         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2167         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2168         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2169         if (get_jenv_res == JNI_EDETACHED) {
2170                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2171         }
2172         return ret_ref;
2173 }
2174 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
2175         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
2176         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2177         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
2178 }
2179 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
2180         jclass c = (*env)->GetObjectClass(env, o);
2181         CHECK(c != NULL);
2182         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
2183         atomic_init(&calls->refcnt, 1);
2184         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2185         calls->o = (*env)->NewWeakGlobalRef(env, o);
2186         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2187         CHECK(calls->write_meth != NULL);
2188
2189         LDKWriteableScore ret = {
2190                 .this_arg = (void*) calls,
2191                 .write = write_LDKWriteableScore_jcall,
2192                 .free = LDKWriteableScore_JCalls_free,
2193                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
2194         };
2195         calls->LockableScore = ret.LockableScore.this_arg;
2196         return ret;
2197 }
2198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
2199         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2200         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
2201         return tag_ptr(res_ptr, true);
2202 }
2203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
2204         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
2205         return tag_ptr(&inp->LockableScore, false);
2206 }
2207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2208         void* this_arg_ptr = untag_ptr(this_arg);
2209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2210         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
2211         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2212         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2213         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2214         CVec_u8Z_free(ret_var);
2215         return ret_arr;
2216 }
2217
2218 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
2219 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
2220 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
2221 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
2222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
2223         LDKCOption_WriteableScoreZ_Some_class =
2224                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
2225         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
2226         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
2227         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
2228         LDKCOption_WriteableScoreZ_None_class =
2229                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
2230         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
2231         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
2232         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
2233 }
2234 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2235         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
2236         switch(obj->tag) {
2237                 case LDKCOption_WriteableScoreZ_Some: {
2238                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
2239                         *some_ret = obj->some;
2240                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
2241                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
2242                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2243                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
2244                         }
2245                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
2246                 }
2247                 case LDKCOption_WriteableScoreZ_None: {
2248                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
2249                 }
2250                 default: abort();
2251         }
2252 }
2253 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
2254 CHECK(owner->result_ok);
2255         return *owner->contents.result;
2256 }
2257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2258         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
2259         CResult_NoneErrorZ_get_ok(owner_conv);
2260 }
2261
2262 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
2263 CHECK(!owner->result_ok);
2264         return *owner->contents.err;
2265 }
2266 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2267         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
2268         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
2269         return ret_conv;
2270 }
2271
2272 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2273         LDKRouteHop ret = *owner->contents.result;
2274         ret.is_owned = false;
2275         return ret;
2276 }
2277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2278         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2279         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2280         int64_t ret_ref = 0;
2281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2283         return ret_ref;
2284 }
2285
2286 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2287         LDKDecodeError ret = *owner->contents.err;
2288         ret.is_owned = false;
2289         return ret;
2290 }
2291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2292         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2293         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2294         int64_t ret_ref = 0;
2295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2297         return ret_ref;
2298 }
2299
2300 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
2301         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
2302         for (size_t i = 0; i < ret.datalen; i++) {
2303                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
2304         }
2305         return ret;
2306 }
2307 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2308         LDKRoute ret = *owner->contents.result;
2309         ret.is_owned = false;
2310         return ret;
2311 }
2312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2313         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2314         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2315         int64_t ret_ref = 0;
2316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2318         return ret_ref;
2319 }
2320
2321 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2322         LDKDecodeError ret = *owner->contents.err;
2323         ret.is_owned = false;
2324         return ret;
2325 }
2326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2327         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2328         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2329         int64_t ret_ref = 0;
2330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2332         return ret_ref;
2333 }
2334
2335 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2336         LDKRouteParameters ret = *owner->contents.result;
2337         ret.is_owned = false;
2338         return ret;
2339 }
2340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2341         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2342         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2343         int64_t ret_ref = 0;
2344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2346         return ret_ref;
2347 }
2348
2349 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2350         LDKDecodeError ret = *owner->contents.err;
2351         ret.is_owned = false;
2352         return ret;
2353 }
2354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2355         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2356         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2357         int64_t ret_ref = 0;
2358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2360         return ret_ref;
2361 }
2362
2363 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2364         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2365         for (size_t i = 0; i < ret.datalen; i++) {
2366                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2367         }
2368         return ret;
2369 }
2370 static jclass LDKCOption_u64Z_Some_class = NULL;
2371 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
2372 static jclass LDKCOption_u64Z_None_class = NULL;
2373 static jmethodID LDKCOption_u64Z_None_meth = NULL;
2374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
2375         LDKCOption_u64Z_Some_class =
2376                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
2377         CHECK(LDKCOption_u64Z_Some_class != NULL);
2378         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
2379         CHECK(LDKCOption_u64Z_Some_meth != NULL);
2380         LDKCOption_u64Z_None_class =
2381                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
2382         CHECK(LDKCOption_u64Z_None_class != NULL);
2383         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
2384         CHECK(LDKCOption_u64Z_None_meth != NULL);
2385 }
2386 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2387         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
2388         switch(obj->tag) {
2389                 case LDKCOption_u64Z_Some: {
2390                         int64_t some_conv = obj->some;
2391                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
2392                 }
2393                 case LDKCOption_u64Z_None: {
2394                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
2395                 }
2396                 default: abort();
2397         }
2398 }
2399 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2400         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2401         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2402         return ret;
2403 }
2404 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2405         LDKPaymentParameters ret = *owner->contents.result;
2406         ret.is_owned = false;
2407         return ret;
2408 }
2409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2410         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2411         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2412         int64_t ret_ref = 0;
2413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2415         return ret_ref;
2416 }
2417
2418 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2419         LDKDecodeError ret = *owner->contents.err;
2420         ret.is_owned = false;
2421         return ret;
2422 }
2423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2424         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2425         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2426         int64_t ret_ref = 0;
2427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2429         return ret_ref;
2430 }
2431
2432 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2433         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2434         for (size_t i = 0; i < ret.datalen; i++) {
2435                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2436         }
2437         return ret;
2438 }
2439 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2440         LDKRouteHint ret = *owner->contents.result;
2441         ret.is_owned = false;
2442         return ret;
2443 }
2444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2445         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2446         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2447         int64_t ret_ref = 0;
2448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2450         return ret_ref;
2451 }
2452
2453 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2454         LDKDecodeError ret = *owner->contents.err;
2455         ret.is_owned = false;
2456         return ret;
2457 }
2458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2459         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2460         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2461         int64_t ret_ref = 0;
2462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2464         return ret_ref;
2465 }
2466
2467 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2468         LDKRouteHintHop ret = *owner->contents.result;
2469         ret.is_owned = false;
2470         return ret;
2471 }
2472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2473         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2474         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2475         int64_t ret_ref = 0;
2476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2478         return ret_ref;
2479 }
2480
2481 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2482         LDKDecodeError ret = *owner->contents.err;
2483         ret.is_owned = false;
2484         return ret;
2485 }
2486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2487         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2488         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2489         int64_t ret_ref = 0;
2490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2492         return ret_ref;
2493 }
2494
2495 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2496         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2497         for (size_t i = 0; i < ret.datalen; i++) {
2498                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2499         }
2500         return ret;
2501 }
2502 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2503         LDKRoute ret = *owner->contents.result;
2504         ret.is_owned = false;
2505         return ret;
2506 }
2507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2508         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2509         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2510         int64_t ret_ref = 0;
2511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2513         return ret_ref;
2514 }
2515
2516 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2517         LDKLightningError ret = *owner->contents.err;
2518         ret.is_owned = false;
2519         return ret;
2520 }
2521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2522         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2523         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2524         int64_t ret_ref = 0;
2525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2527         return ret_ref;
2528 }
2529
2530 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
2531 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
2532 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
2533 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
2534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
2535         LDKPaymentPurpose_InvoicePayment_class =
2536                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
2537         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
2538         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
2539         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
2540         LDKPaymentPurpose_SpontaneousPayment_class =
2541                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
2542         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
2543         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
2544         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
2545 }
2546 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2547         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
2548         switch(obj->tag) {
2549                 case LDKPaymentPurpose_InvoicePayment: {
2550                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2551                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
2552                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
2553                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
2554                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
2555                 }
2556                 case LDKPaymentPurpose_SpontaneousPayment: {
2557                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
2558                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
2559                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
2560                 }
2561                 default: abort();
2562         }
2563 }
2564 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2565 CHECK(owner->result_ok);
2566         return PaymentPurpose_clone(&*owner->contents.result);
2567 }
2568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2569         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2570         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
2571         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
2572         int64_t ret_ref = tag_ptr(ret_copy, true);
2573         return ret_ref;
2574 }
2575
2576 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
2577         LDKDecodeError ret = *owner->contents.err;
2578         ret.is_owned = false;
2579         return ret;
2580 }
2581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2582         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
2583         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
2584         int64_t ret_ref = 0;
2585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2587         return ret_ref;
2588 }
2589
2590 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
2591 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
2592 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
2593 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
2594 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
2595 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
2596 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
2597 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
2598 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
2599 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
2600 static jclass LDKClosureReason_ProcessingError_class = NULL;
2601 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
2602 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
2603 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
2604 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
2605 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
2606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
2607         LDKClosureReason_CounterpartyForceClosed_class =
2608                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
2609         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
2610         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2611         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2612         LDKClosureReason_HolderForceClosed_class =
2613                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2614         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2615         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2616         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2617         LDKClosureReason_CooperativeClosure_class =
2618                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2619         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2620         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2621         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2622         LDKClosureReason_CommitmentTxConfirmed_class =
2623                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2624         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2625         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2626         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2627         LDKClosureReason_FundingTimedOut_class =
2628                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2629         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2630         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2631         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2632         LDKClosureReason_ProcessingError_class =
2633                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2634         CHECK(LDKClosureReason_ProcessingError_class != NULL);
2635         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2636         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2637         LDKClosureReason_DisconnectedPeer_class =
2638                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2639         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2640         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2641         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2642         LDKClosureReason_OutdatedChannelManager_class =
2643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2644         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2645         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2646         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2647 }
2648 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2649         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
2650         switch(obj->tag) {
2651                 case LDKClosureReason_CounterpartyForceClosed: {
2652                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2653                         jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2654                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2655                 }
2656                 case LDKClosureReason_HolderForceClosed: {
2657                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2658                 }
2659                 case LDKClosureReason_CooperativeClosure: {
2660                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2661                 }
2662                 case LDKClosureReason_CommitmentTxConfirmed: {
2663                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2664                 }
2665                 case LDKClosureReason_FundingTimedOut: {
2666                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2667                 }
2668                 case LDKClosureReason_ProcessingError: {
2669                         LDKStr err_str = obj->processing_error.err;
2670                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2671                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2672                 }
2673                 case LDKClosureReason_DisconnectedPeer: {
2674                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2675                 }
2676                 case LDKClosureReason_OutdatedChannelManager: {
2677                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2678                 }
2679                 default: abort();
2680         }
2681 }
2682 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2683 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2684 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2685 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2687         LDKCOption_ClosureReasonZ_Some_class =
2688                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2689         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2690         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2691         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2692         LDKCOption_ClosureReasonZ_None_class =
2693                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2694         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2695         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2696         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2697 }
2698 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2699         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
2700         switch(obj->tag) {
2701                 case LDKCOption_ClosureReasonZ_Some: {
2702                         int64_t some_ref = tag_ptr(&obj->some, false);
2703                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2704                 }
2705                 case LDKCOption_ClosureReasonZ_None: {
2706                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2707                 }
2708                 default: abort();
2709         }
2710 }
2711 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2712 CHECK(owner->result_ok);
2713         return COption_ClosureReasonZ_clone(&*owner->contents.result);
2714 }
2715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2716         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2717         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2718         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2719         int64_t ret_ref = tag_ptr(ret_copy, true);
2720         return ret_ref;
2721 }
2722
2723 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2724         LDKDecodeError ret = *owner->contents.err;
2725         ret.is_owned = false;
2726         return ret;
2727 }
2728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2729         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2730         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2731         int64_t ret_ref = 0;
2732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2734         return ret_ref;
2735 }
2736
2737 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
2738 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
2739 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
2740 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
2741 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
2742 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
2743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
2744         LDKHTLCDestination_NextHopChannel_class =
2745                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
2746         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
2747         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
2748         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
2749         LDKHTLCDestination_UnknownNextHop_class =
2750                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
2751         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
2752         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
2753         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
2754         LDKHTLCDestination_FailedPayment_class =
2755                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
2756         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
2757         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
2758         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
2759 }
2760 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2761         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2762         switch(obj->tag) {
2763                 case LDKHTLCDestination_NextHopChannel: {
2764                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2765                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
2766                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2767                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
2768                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
2769                 }
2770                 case LDKHTLCDestination_UnknownNextHop: {
2771                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2772                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
2773                 }
2774                 case LDKHTLCDestination_FailedPayment: {
2775                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2776                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
2777                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
2778                 }
2779                 default: abort();
2780         }
2781 }
2782 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
2783 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
2784 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
2785 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
2786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
2787         LDKCOption_HTLCDestinationZ_Some_class =
2788                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
2789         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
2790         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
2791         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
2792         LDKCOption_HTLCDestinationZ_None_class =
2793                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
2794         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
2795         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
2796         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
2797 }
2798 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2799         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2800         switch(obj->tag) {
2801                 case LDKCOption_HTLCDestinationZ_Some: {
2802                         int64_t some_ref = tag_ptr(&obj->some, false);
2803                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
2804                 }
2805                 case LDKCOption_HTLCDestinationZ_None: {
2806                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
2807                 }
2808                 default: abort();
2809         }
2810 }
2811 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2812 CHECK(owner->result_ok);
2813         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2814 }
2815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2816         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2817         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2818         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
2819         int64_t ret_ref = tag_ptr(ret_copy, true);
2820         return ret_ref;
2821 }
2822
2823 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2824         LDKDecodeError ret = *owner->contents.err;
2825         ret.is_owned = false;
2826         return ret;
2827 }
2828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2829         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2830         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2831         int64_t ret_ref = 0;
2832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2834         return ret_ref;
2835 }
2836
2837 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2838 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2839 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2840 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2841 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2842 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2844         LDKNetworkUpdate_ChannelUpdateMessage_class =
2845                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2846         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2847         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2848         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2849         LDKNetworkUpdate_ChannelFailure_class =
2850                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2851         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2852         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2853         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2854         LDKNetworkUpdate_NodeFailure_class =
2855                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2856         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2857         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2858         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2859 }
2860 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2861         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2862         switch(obj->tag) {
2863                 case LDKNetworkUpdate_ChannelUpdateMessage: {
2864                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2865                         int64_t msg_ref = 0;
2866                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2867                         msg_ref = tag_ptr(msg_var.inner, false);
2868                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2869                 }
2870                 case LDKNetworkUpdate_ChannelFailure: {
2871                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2872                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2873                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2874                 }
2875                 case LDKNetworkUpdate_NodeFailure: {
2876                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2877                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2878                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
2879                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2880                 }
2881                 default: abort();
2882         }
2883 }
2884 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2885 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2886 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2887 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2889         LDKCOption_NetworkUpdateZ_Some_class =
2890                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2891         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2892         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2893         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2894         LDKCOption_NetworkUpdateZ_None_class =
2895                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2896         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2897         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2898         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2899 }
2900 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2901         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2902         switch(obj->tag) {
2903                 case LDKCOption_NetworkUpdateZ_Some: {
2904                         int64_t some_ref = tag_ptr(&obj->some, false);
2905                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2906                 }
2907                 case LDKCOption_NetworkUpdateZ_None: {
2908                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2909                 }
2910                 default: abort();
2911         }
2912 }
2913 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2914 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2915 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2916 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2917 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2918 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2920         LDKSpendableOutputDescriptor_StaticOutput_class =
2921                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2922         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2923         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2924         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2925         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2926                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2927         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2928         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2929         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2930         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2931                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2932         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2933         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2934         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2935 }
2936 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2937         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2938         switch(obj->tag) {
2939                 case LDKSpendableOutputDescriptor_StaticOutput: {
2940                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2941                         int64_t outpoint_ref = 0;
2942                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2943                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2944                         LDKTxOut* output_ref = &obj->static_output.output;
2945                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2946                 }
2947                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2948                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2949                         int64_t delayed_payment_output_ref = 0;
2950                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2951                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2952                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2953                 }
2954                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2955                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2956                         int64_t static_payment_output_ref = 0;
2957                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2958                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2959                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2960                 }
2961                 default: abort();
2962         }
2963 }
2964 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2965         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2966         for (size_t i = 0; i < ret.datalen; i++) {
2967                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2968         }
2969         return ret;
2970 }
2971 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2972 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2973 static jclass LDKEvent_PaymentReceived_class = NULL;
2974 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2975 static jclass LDKEvent_PaymentClaimed_class = NULL;
2976 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
2977 static jclass LDKEvent_PaymentSent_class = NULL;
2978 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2979 static jclass LDKEvent_PaymentFailed_class = NULL;
2980 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2981 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2982 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2983 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2984 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2985 static jclass LDKEvent_ProbeSuccessful_class = NULL;
2986 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
2987 static jclass LDKEvent_ProbeFailed_class = NULL;
2988 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
2989 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2990 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2991 static jclass LDKEvent_SpendableOutputs_class = NULL;
2992 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2993 static jclass LDKEvent_PaymentForwarded_class = NULL;
2994 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2995 static jclass LDKEvent_ChannelClosed_class = NULL;
2996 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2997 static jclass LDKEvent_DiscardFunding_class = NULL;
2998 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2999 static jclass LDKEvent_OpenChannelRequest_class = NULL;
3000 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
3001 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
3002 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
3003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
3004         LDKEvent_FundingGenerationReady_class =
3005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
3006         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
3007         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[BJ)V");
3008         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
3009         LDKEvent_PaymentReceived_class =
3010                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
3011         CHECK(LDKEvent_PaymentReceived_class != NULL);
3012         LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
3013         CHECK(LDKEvent_PaymentReceived_meth != NULL);
3014         LDKEvent_PaymentClaimed_class =
3015                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
3016         CHECK(LDKEvent_PaymentClaimed_class != NULL);
3017         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([BJJ)V");
3018         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
3019         LDKEvent_PaymentSent_class =
3020                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
3021         CHECK(LDKEvent_PaymentSent_class != NULL);
3022         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
3023         CHECK(LDKEvent_PaymentSent_meth != NULL);
3024         LDKEvent_PaymentFailed_class =
3025                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
3026         CHECK(LDKEvent_PaymentFailed_class != NULL);
3027         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
3028         CHECK(LDKEvent_PaymentFailed_meth != NULL);
3029         LDKEvent_PaymentPathSuccessful_class =
3030                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
3031         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
3032         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
3033         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
3034         LDKEvent_PaymentPathFailed_class =
3035                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
3036         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
3037         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
3038         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
3039         LDKEvent_ProbeSuccessful_class =
3040                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
3041         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
3042         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[B[J)V");
3043         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
3044         LDKEvent_ProbeFailed_class =
3045                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
3046         CHECK(LDKEvent_ProbeFailed_class != NULL);
3047         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[B[JJ)V");
3048         CHECK(LDKEvent_ProbeFailed_meth != NULL);
3049         LDKEvent_PendingHTLCsForwardable_class =
3050                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
3051         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
3052         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
3053         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
3054         LDKEvent_SpendableOutputs_class =
3055                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
3056         CHECK(LDKEvent_SpendableOutputs_class != NULL);
3057         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
3058         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
3059         LDKEvent_PaymentForwarded_class =
3060                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
3061         CHECK(LDKEvent_PaymentForwarded_class != NULL);
3062         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
3063         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
3064         LDKEvent_ChannelClosed_class =
3065                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
3066         CHECK(LDKEvent_ChannelClosed_class != NULL);
3067         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
3068         CHECK(LDKEvent_ChannelClosed_meth != NULL);
3069         LDKEvent_DiscardFunding_class =
3070                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
3071         CHECK(LDKEvent_DiscardFunding_class != NULL);
3072         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
3073         CHECK(LDKEvent_DiscardFunding_meth != NULL);
3074         LDKEvent_OpenChannelRequest_class =
3075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
3076         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
3077         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
3078         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
3079         LDKEvent_HTLCHandlingFailed_class =
3080                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
3081         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
3082         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
3083         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
3084 }
3085 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3086         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
3087         switch(obj->tag) {
3088                 case LDKEvent_FundingGenerationReady: {
3089                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
3090                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
3091                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
3092                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
3093                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
3094                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
3095                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
3096                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
3097                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
3098                         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);
3099                 }
3100                 case LDKEvent_PaymentReceived: {
3101                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3102                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
3103                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
3104                         int64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
3105                         return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
3106                 }
3107                 case LDKEvent_PaymentClaimed: {
3108                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3109                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
3110                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
3111                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
3112                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
3113                 }
3114                 case LDKEvent_PaymentSent: {
3115                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3116                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
3117                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
3118                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
3119                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3120                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
3121                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
3122                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
3123                 }
3124                 case LDKEvent_PaymentFailed: {
3125                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3126                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
3127                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3128                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
3129                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
3130                 }
3131                 case LDKEvent_PaymentPathSuccessful: {
3132                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3133                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
3134                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3135                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
3136                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
3137                         int64_tArray path_arr = NULL;
3138                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3139                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3140                         for (size_t k = 0; k < path_var.datalen; k++) {
3141                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3142                                 int64_t path_conv_10_ref = 0;
3143                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3144                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3145                                 path_arr_ptr[k] = path_conv_10_ref;
3146                         }
3147                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3148                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
3149                 }
3150                 case LDKEvent_PaymentPathFailed: {
3151                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3152                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
3153                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3154                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
3155                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
3156                         int64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
3157                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
3158                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
3159                         int64_tArray path_arr = NULL;
3160                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3161                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3162                         for (size_t k = 0; k < path_var.datalen; k++) {
3163                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3164                                 int64_t path_conv_10_ref = 0;
3165                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3166                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3167                                 path_arr_ptr[k] = path_conv_10_ref;
3168                         }
3169                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3170                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
3171                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
3172                         int64_t retry_ref = 0;
3173                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
3174                         retry_ref = tag_ptr(retry_var.inner, false);
3175                         return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, payment_failed_permanently_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref);
3176                 }
3177                 case LDKEvent_ProbeSuccessful: {
3178                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3179                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
3180                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3181                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
3182                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
3183                         int64_tArray path_arr = NULL;
3184                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3185                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3186                         for (size_t k = 0; k < path_var.datalen; k++) {
3187                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3188                                 int64_t path_conv_10_ref = 0;
3189                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3190                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3191                                 path_arr_ptr[k] = path_conv_10_ref;
3192                         }
3193                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3194                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
3195                 }
3196                 case LDKEvent_ProbeFailed: {
3197                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
3198                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
3199                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
3200                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
3201                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
3202                         int64_tArray path_arr = NULL;
3203                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
3204                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
3205                         for (size_t k = 0; k < path_var.datalen; k++) {
3206                                 LDKRouteHop path_conv_10_var = path_var.data[k];
3207                                 int64_t path_conv_10_ref = 0;
3208                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
3209                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
3210                                 path_arr_ptr[k] = path_conv_10_ref;
3211                         }
3212                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
3213                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
3214                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref);
3215                 }
3216                 case LDKEvent_PendingHTLCsForwardable: {
3217                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
3218                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
3219                 }
3220                 case LDKEvent_SpendableOutputs: {
3221                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
3222                         int64_tArray outputs_arr = NULL;
3223                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
3224                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
3225                         for (size_t b = 0; b < outputs_var.datalen; b++) {
3226                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
3227                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
3228                         }
3229                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
3230                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
3231                 }
3232                 case LDKEvent_PaymentForwarded: {
3233                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
3234                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
3235                         int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
3236                         (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
3237                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
3238                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
3239                         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);
3240                 }
3241                 case LDKEvent_ChannelClosed: {
3242                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
3243                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
3244                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
3245                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
3246                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
3247                 }
3248                 case LDKEvent_DiscardFunding: {
3249                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
3250                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
3251                         LDKTransaction transaction_var = obj->discard_funding.transaction;
3252                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
3253                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
3254                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
3255                 }
3256                 case LDKEvent_OpenChannelRequest: {
3257                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
3258                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
3259                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
3260                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
3261                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
3262                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
3263                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
3264                         int64_t channel_type_ref = 0;
3265                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
3266                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
3267                         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);
3268                 }
3269                 case LDKEvent_HTLCHandlingFailed: {
3270                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
3271                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
3272                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
3273                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
3274                 }
3275                 default: abort();
3276         }
3277 }
3278 static jclass LDKCOption_EventZ_Some_class = NULL;
3279 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
3280 static jclass LDKCOption_EventZ_None_class = NULL;
3281 static jmethodID LDKCOption_EventZ_None_meth = NULL;
3282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
3283         LDKCOption_EventZ_Some_class =
3284                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
3285         CHECK(LDKCOption_EventZ_Some_class != NULL);
3286         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
3287         CHECK(LDKCOption_EventZ_Some_meth != NULL);
3288         LDKCOption_EventZ_None_class =
3289                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
3290         CHECK(LDKCOption_EventZ_None_class != NULL);
3291         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
3292         CHECK(LDKCOption_EventZ_None_meth != NULL);
3293 }
3294 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3295         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
3296         switch(obj->tag) {
3297                 case LDKCOption_EventZ_Some: {
3298                         int64_t some_ref = tag_ptr(&obj->some, false);
3299                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
3300                 }
3301                 case LDKCOption_EventZ_None: {
3302                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
3303                 }
3304                 default: abort();
3305         }
3306 }
3307 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3308 CHECK(owner->result_ok);
3309         return COption_EventZ_clone(&*owner->contents.result);
3310 }
3311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3312         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
3313         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
3314         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
3315         int64_t ret_ref = tag_ptr(ret_copy, true);
3316         return ret_ref;
3317 }
3318
3319 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
3320         LDKDecodeError ret = *owner->contents.err;
3321         ret.is_owned = false;
3322         return ret;
3323 }
3324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3325         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
3326         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
3327         int64_t ret_ref = 0;
3328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3330         return ret_ref;
3331 }
3332
3333 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
3334 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
3335 static jclass LDKErrorAction_IgnoreError_class = NULL;
3336 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
3337 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
3338 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
3339 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
3340 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
3341 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
3342 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
3343 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
3344 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
3345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
3346         LDKErrorAction_DisconnectPeer_class =
3347                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
3348         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
3349         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
3350         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
3351         LDKErrorAction_IgnoreError_class =
3352                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
3353         CHECK(LDKErrorAction_IgnoreError_class != NULL);
3354         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
3355         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
3356         LDKErrorAction_IgnoreAndLog_class =
3357                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
3358         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
3359         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
3360         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
3361         LDKErrorAction_IgnoreDuplicateGossip_class =
3362                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
3363         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
3364         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
3365         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
3366         LDKErrorAction_SendErrorMessage_class =
3367                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
3368         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
3369         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
3370         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
3371         LDKErrorAction_SendWarningMessage_class =
3372                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
3373         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
3374         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
3375         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
3376 }
3377 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3378         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
3379         switch(obj->tag) {
3380                 case LDKErrorAction_DisconnectPeer: {
3381                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
3382                         int64_t msg_ref = 0;
3383                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3384                         msg_ref = tag_ptr(msg_var.inner, false);
3385                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
3386                 }
3387                 case LDKErrorAction_IgnoreError: {
3388                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
3389                 }
3390                 case LDKErrorAction_IgnoreAndLog: {
3391                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
3392                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
3393                 }
3394                 case LDKErrorAction_IgnoreDuplicateGossip: {
3395                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
3396                 }
3397                 case LDKErrorAction_SendErrorMessage: {
3398                         LDKErrorMessage msg_var = obj->send_error_message.msg;
3399                         int64_t msg_ref = 0;
3400                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3401                         msg_ref = tag_ptr(msg_var.inner, false);
3402                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
3403                 }
3404                 case LDKErrorAction_SendWarningMessage: {
3405                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
3406                         int64_t msg_ref = 0;
3407                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3408                         msg_ref = tag_ptr(msg_var.inner, false);
3409                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
3410                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
3411                 }
3412                 default: abort();
3413         }
3414 }
3415 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
3416 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
3417 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
3418 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
3419 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
3420 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
3421 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
3422 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
3423 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
3424 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
3425 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
3426 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
3427 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
3428 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
3429 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
3430 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
3431 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
3432 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
3433 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
3434 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
3435 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
3436 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
3437 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
3438 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
3439 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
3440 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
3441 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
3442 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
3443 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
3444 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
3445 static jclass LDKMessageSendEvent_HandleError_class = NULL;
3446 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
3447 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
3448 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
3449 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
3450 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
3451 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
3452 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
3453 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
3454 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
3455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
3456         LDKMessageSendEvent_SendAcceptChannel_class =
3457                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
3458         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
3459         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
3460         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
3461         LDKMessageSendEvent_SendOpenChannel_class =
3462                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
3463         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
3464         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
3465         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
3466         LDKMessageSendEvent_SendFundingCreated_class =
3467                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
3468         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
3469         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
3470         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
3471         LDKMessageSendEvent_SendFundingSigned_class =
3472                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
3473         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
3474         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
3475         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
3476         LDKMessageSendEvent_SendChannelReady_class =
3477                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
3478         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
3479         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
3480         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
3481         LDKMessageSendEvent_SendAnnouncementSignatures_class =
3482                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
3483         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
3484         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
3485         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
3486         LDKMessageSendEvent_UpdateHTLCs_class =
3487                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
3488         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
3489         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
3490         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
3491         LDKMessageSendEvent_SendRevokeAndACK_class =
3492                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
3493         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
3494         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
3495         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
3496         LDKMessageSendEvent_SendClosingSigned_class =
3497                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
3498         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
3499         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
3500         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
3501         LDKMessageSendEvent_SendShutdown_class =
3502                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
3503         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
3504         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
3505         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
3506         LDKMessageSendEvent_SendChannelReestablish_class =
3507                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
3508         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
3509         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
3510         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
3511         LDKMessageSendEvent_SendChannelAnnouncement_class =
3512                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
3513         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
3514         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
3515         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
3516         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
3517                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
3518         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
3519         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
3520         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
3521         LDKMessageSendEvent_BroadcastChannelUpdate_class =
3522                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
3523         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
3524         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
3525         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
3526         LDKMessageSendEvent_SendChannelUpdate_class =
3527                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
3528         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
3529         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
3530         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
3531         LDKMessageSendEvent_HandleError_class =
3532                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
3533         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
3534         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
3535         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
3536         LDKMessageSendEvent_SendChannelRangeQuery_class =
3537                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
3538         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
3539         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
3540         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
3541         LDKMessageSendEvent_SendShortIdsQuery_class =
3542                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
3543         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
3544         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
3545         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
3546         LDKMessageSendEvent_SendReplyChannelRange_class =
3547                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
3548         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
3549         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
3550         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
3551         LDKMessageSendEvent_SendGossipTimestampFilter_class =
3552                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
3553         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
3554         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
3555         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
3556 }
3557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3558         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
3559         switch(obj->tag) {
3560                 case LDKMessageSendEvent_SendAcceptChannel: {
3561                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3562                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
3563                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
3564                         int64_t msg_ref = 0;
3565                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3566                         msg_ref = tag_ptr(msg_var.inner, false);
3567                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
3568                 }
3569                 case LDKMessageSendEvent_SendOpenChannel: {
3570                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3571                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
3572                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
3573                         int64_t msg_ref = 0;
3574                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3575                         msg_ref = tag_ptr(msg_var.inner, false);
3576                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
3577                 }
3578                 case LDKMessageSendEvent_SendFundingCreated: {
3579                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3580                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
3581                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
3582                         int64_t msg_ref = 0;
3583                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3584                         msg_ref = tag_ptr(msg_var.inner, false);
3585                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
3586                 }
3587                 case LDKMessageSendEvent_SendFundingSigned: {
3588                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3589                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
3590                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
3591                         int64_t msg_ref = 0;
3592                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3593                         msg_ref = tag_ptr(msg_var.inner, false);
3594                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
3595                 }
3596                 case LDKMessageSendEvent_SendChannelReady: {
3597                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3598                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
3599                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
3600                         int64_t msg_ref = 0;
3601                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3602                         msg_ref = tag_ptr(msg_var.inner, false);
3603                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
3604                 }
3605                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
3606                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3607                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
3608                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
3609                         int64_t msg_ref = 0;
3610                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3611                         msg_ref = tag_ptr(msg_var.inner, false);
3612                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
3613                 }
3614                 case LDKMessageSendEvent_UpdateHTLCs: {
3615                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3616                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
3617                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3618                         int64_t updates_ref = 0;
3619                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3620                         updates_ref = tag_ptr(updates_var.inner, false);
3621                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
3622                 }
3623                 case LDKMessageSendEvent_SendRevokeAndACK: {
3624                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3625                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
3626                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3627                         int64_t msg_ref = 0;
3628                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3629                         msg_ref = tag_ptr(msg_var.inner, false);
3630                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
3631                 }
3632                 case LDKMessageSendEvent_SendClosingSigned: {
3633                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3634                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
3635                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3636                         int64_t msg_ref = 0;
3637                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3638                         msg_ref = tag_ptr(msg_var.inner, false);
3639                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
3640                 }
3641                 case LDKMessageSendEvent_SendShutdown: {
3642                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3643                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
3644                         LDKShutdown msg_var = obj->send_shutdown.msg;
3645                         int64_t msg_ref = 0;
3646                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3647                         msg_ref = tag_ptr(msg_var.inner, false);
3648                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
3649                 }
3650                 case LDKMessageSendEvent_SendChannelReestablish: {
3651                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3652                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
3653                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3654                         int64_t msg_ref = 0;
3655                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3656                         msg_ref = tag_ptr(msg_var.inner, false);
3657                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
3658                 }
3659                 case LDKMessageSendEvent_SendChannelAnnouncement: {
3660                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3661                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
3662                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
3663                         int64_t msg_ref = 0;
3664                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3665                         msg_ref = tag_ptr(msg_var.inner, false);
3666                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
3667                         int64_t update_msg_ref = 0;
3668                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3669                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3670                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
3671                 }
3672                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
3673                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3674                         int64_t msg_ref = 0;
3675                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3676                         msg_ref = tag_ptr(msg_var.inner, false);
3677                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3678                         int64_t update_msg_ref = 0;
3679                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3680                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
3681                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
3682                 }
3683                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
3684                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3685                         int64_t msg_ref = 0;
3686                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3687                         msg_ref = tag_ptr(msg_var.inner, false);
3688                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
3689                 }
3690                 case LDKMessageSendEvent_SendChannelUpdate: {
3691                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3692                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
3693                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3694                         int64_t msg_ref = 0;
3695                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3696                         msg_ref = tag_ptr(msg_var.inner, false);
3697                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
3698                 }
3699                 case LDKMessageSendEvent_HandleError: {
3700                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3701                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
3702                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
3703                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
3704                 }
3705                 case LDKMessageSendEvent_SendChannelRangeQuery: {
3706                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3707                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
3708                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3709                         int64_t msg_ref = 0;
3710                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3711                         msg_ref = tag_ptr(msg_var.inner, false);
3712                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3713                 }
3714                 case LDKMessageSendEvent_SendShortIdsQuery: {
3715                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3716                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3717                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3718                         int64_t msg_ref = 0;
3719                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3720                         msg_ref = tag_ptr(msg_var.inner, false);
3721                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3722                 }
3723                 case LDKMessageSendEvent_SendReplyChannelRange: {
3724                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3725                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3726                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3727                         int64_t msg_ref = 0;
3728                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3729                         msg_ref = tag_ptr(msg_var.inner, false);
3730                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3731                 }
3732                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3733                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3734                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3735                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3736                         int64_t msg_ref = 0;
3737                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3738                         msg_ref = tag_ptr(msg_var.inner, false);
3739                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3740                 }
3741                 default: abort();
3742         }
3743 }
3744 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3745         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3746         for (size_t i = 0; i < ret.datalen; i++) {
3747                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3748         }
3749         return ret;
3750 }
3751 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3752 CHECK(owner->result_ok);
3753         return TxOut_clone(&*owner->contents.result);
3754 }
3755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3756         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
3757         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3758         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3759         return tag_ptr(ret_ref, true);
3760 }
3761
3762 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3763 CHECK(!owner->result_ok);
3764         return AccessError_clone(&*owner->contents.err);
3765 }
3766 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3767         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
3768         jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
3769         return ret_conv;
3770 }
3771
3772 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3773         return owner->a;
3774 }
3775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3776         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3777         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3778         return ret_conv;
3779 }
3780
3781 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3782         return owner->b;
3783 }
3784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3785         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3786         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3787         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3788         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3789         return ret_arr;
3790 }
3791
3792 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3793         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3794         for (size_t i = 0; i < ret.datalen; i++) {
3795                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3796         }
3797         return ret;
3798 }
3799 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
3800         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
3801         for (size_t i = 0; i < ret.datalen; i++) {
3802                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3803         }
3804         return ret;
3805 }
3806 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3807 CHECK(owner->result_ok);
3808         return *owner->contents.result;
3809 }
3810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3811         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3812         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3813 }
3814
3815 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3816 CHECK(!owner->result_ok);
3817         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3818 }
3819 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3820         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3821         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3822         return ret_conv;
3823 }
3824
3825 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
3826 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
3827 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
3828 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
3829 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
3830 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
3831 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
3832 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
3833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
3834         LDKMonitorEvent_HTLCEvent_class =
3835                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
3836         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
3837         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
3838         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
3839         LDKMonitorEvent_CommitmentTxConfirmed_class =
3840                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
3841         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
3842         LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
3843         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
3844         LDKMonitorEvent_UpdateCompleted_class =
3845                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
3846         CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
3847         LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
3848         CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
3849         LDKMonitorEvent_UpdateFailed_class =
3850                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
3851         CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
3852         LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
3853         CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
3854 }
3855 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3856         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3857         switch(obj->tag) {
3858                 case LDKMonitorEvent_HTLCEvent: {
3859                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3860                         int64_t htlc_event_ref = 0;
3861                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3862                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3863                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
3864                 }
3865                 case LDKMonitorEvent_CommitmentTxConfirmed: {
3866                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3867                         int64_t commitment_tx_confirmed_ref = 0;
3868                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3869                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
3870                         return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
3871                 }
3872                 case LDKMonitorEvent_UpdateCompleted: {
3873                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
3874                         int64_t funding_txo_ref = 0;
3875                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3876                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3877                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
3878                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
3879                 }
3880                 case LDKMonitorEvent_UpdateFailed: {
3881                         LDKOutPoint update_failed_var = obj->update_failed;
3882                         int64_t update_failed_ref = 0;
3883                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3884                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
3885                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
3886                 }
3887                 default: abort();
3888         }
3889 }
3890 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3891         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3892         for (size_t i = 0; i < ret.datalen; i++) {
3893                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3894         }
3895         return ret;
3896 }
3897 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3898         LDKOutPoint ret = owner->a;
3899         ret.is_owned = false;
3900         return ret;
3901 }
3902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3903         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3904         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3905         int64_t ret_ref = 0;
3906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3908         return ret_ref;
3909 }
3910
3911 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3912         return CVec_MonitorEventZ_clone(&owner->b);
3913 }
3914 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3915         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3916         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3917         int64_tArray ret_arr = NULL;
3918         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3919         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3920         for (size_t o = 0; o < ret_var.datalen; o++) {
3921                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3922                 *ret_conv_14_copy = ret_var.data[o];
3923                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3924                 ret_arr_ptr[o] = ret_conv_14_ref;
3925         }
3926         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3927         FREE(ret_var.data);
3928         return ret_arr;
3929 }
3930
3931 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3932         return owner->c;
3933 }
3934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3935         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3936         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3937         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
3938         return ret_arr;
3939 }
3940
3941 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3942         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3943         for (size_t i = 0; i < ret.datalen; i++) {
3944                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3945         }
3946         return ret;
3947 }
3948 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3949         LDKFixedPenaltyScorer ret = *owner->contents.result;
3950         ret.is_owned = false;
3951         return ret;
3952 }
3953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3954         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3955         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3956         int64_t ret_ref = 0;
3957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3959         return ret_ref;
3960 }
3961
3962 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3963         LDKDecodeError ret = *owner->contents.err;
3964         ret.is_owned = false;
3965         return ret;
3966 }
3967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3968         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3969         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3970         int64_t ret_ref = 0;
3971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3973         return ret_ref;
3974 }
3975
3976 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3977         return owner->a;
3978 }
3979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3980         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3981         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3982         return ret_conv;
3983 }
3984
3985 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3986         return owner->b;
3987 }
3988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3989         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3990         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3991         return ret_conv;
3992 }
3993
3994 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
3995 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
3996 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
3997 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
3998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
3999         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4000                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4001         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4002         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4003         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4004         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4006         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4007         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4008         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4009 }
4010 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4011         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4012         switch(obj->tag) {
4013                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4014                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4015                         *some_conv = obj->some;
4016                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4017                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4018                 }
4019                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4020                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4021                 }
4022                 default: abort();
4023         }
4024 }
4025 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4026         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4027         for (size_t i = 0; i < ret.datalen; i++) {
4028                 ret.data[i] = NodeId_clone(&orig->data[i]);
4029         }
4030         return ret;
4031 }
4032 typedef struct LDKLogger_JCalls {
4033         atomic_size_t refcnt;
4034         JavaVM *vm;
4035         jweak o;
4036         jmethodID log_meth;
4037 } LDKLogger_JCalls;
4038 static void LDKLogger_JCalls_free(void* this_arg) {
4039         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4040         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4041                 JNIEnv *env;
4042                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4043                 if (get_jenv_res == JNI_EDETACHED) {
4044                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4045                 } else {
4046                         DO_ASSERT(get_jenv_res == JNI_OK);
4047                 }
4048                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4049                 if (get_jenv_res == JNI_EDETACHED) {
4050                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4051                 }
4052                 FREE(j_calls);
4053         }
4054 }
4055 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4056         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4057         JNIEnv *env;
4058         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4059         if (get_jenv_res == JNI_EDETACHED) {
4060                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4061         } else {
4062                 DO_ASSERT(get_jenv_res == JNI_OK);
4063         }
4064         LDKRecord record_var = *record;
4065         int64_t record_ref = 0;
4066         record_var = Record_clone(&record_var);
4067         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4068         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4069         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4070         CHECK(obj != NULL);
4071         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4072         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4073                 (*env)->ExceptionDescribe(env);
4074                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4075         }
4076         if (get_jenv_res == JNI_EDETACHED) {
4077                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4078         }
4079 }
4080 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4081         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4082         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4083 }
4084 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4085         jclass c = (*env)->GetObjectClass(env, o);
4086         CHECK(c != NULL);
4087         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4088         atomic_init(&calls->refcnt, 1);
4089         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4090         calls->o = (*env)->NewWeakGlobalRef(env, o);
4091         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4092         CHECK(calls->log_meth != NULL);
4093
4094         LDKLogger ret = {
4095                 .this_arg = (void*) calls,
4096                 .log = log_LDKLogger_jcall,
4097                 .free = LDKLogger_JCalls_free,
4098         };
4099         return ret;
4100 }
4101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4102         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4103         *res_ptr = LDKLogger_init(env, clz, o);
4104         return tag_ptr(res_ptr, true);
4105 }
4106 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4107         LDKProbabilisticScorer ret = *owner->contents.result;
4108         ret.is_owned = false;
4109         return ret;
4110 }
4111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4112         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4113         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4114         int64_t ret_ref = 0;
4115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4117         return ret_ref;
4118 }
4119
4120 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4121         LDKDecodeError ret = *owner->contents.err;
4122         ret.is_owned = false;
4123         return ret;
4124 }
4125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4126         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4127         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
4128         int64_t ret_ref = 0;
4129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4131         return ret_ref;
4132 }
4133
4134 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4135         LDKInitFeatures ret = *owner->contents.result;
4136         ret.is_owned = false;
4137         return ret;
4138 }
4139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4140         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4141         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4142         int64_t ret_ref = 0;
4143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4145         return ret_ref;
4146 }
4147
4148 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4149         LDKDecodeError ret = *owner->contents.err;
4150         ret.is_owned = false;
4151         return ret;
4152 }
4153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4154         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4155         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4156         int64_t ret_ref = 0;
4157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4159         return ret_ref;
4160 }
4161
4162 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4163         LDKChannelFeatures ret = *owner->contents.result;
4164         ret.is_owned = false;
4165         return ret;
4166 }
4167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4168         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4169         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4170         int64_t ret_ref = 0;
4171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4173         return ret_ref;
4174 }
4175
4176 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4177         LDKDecodeError ret = *owner->contents.err;
4178         ret.is_owned = false;
4179         return ret;
4180 }
4181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4182         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4183         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4184         int64_t ret_ref = 0;
4185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4187         return ret_ref;
4188 }
4189
4190 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4191         LDKNodeFeatures ret = *owner->contents.result;
4192         ret.is_owned = false;
4193         return ret;
4194 }
4195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4196         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4197         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_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_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *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_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4210         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4211         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_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 LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4219         LDKInvoiceFeatures ret = *owner->contents.result;
4220         ret.is_owned = false;
4221         return ret;
4222 }
4223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4224         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4225         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_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_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *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_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4238         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4239         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_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 LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4247         LDKChannelTypeFeatures ret = *owner->contents.result;
4248         ret.is_owned = false;
4249         return ret;
4250 }
4251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4252         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4253         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4254         int64_t ret_ref = 0;
4255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4257         return ret_ref;
4258 }
4259
4260 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4261         LDKDecodeError ret = *owner->contents.err;
4262         ret.is_owned = false;
4263         return ret;
4264 }
4265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4266         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4267         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4268         int64_t ret_ref = 0;
4269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4271         return ret_ref;
4272 }
4273
4274 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4275         LDKNodeId ret = *owner->contents.result;
4276         ret.is_owned = false;
4277         return ret;
4278 }
4279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4280         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4281         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
4282         int64_t ret_ref = 0;
4283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4285         return ret_ref;
4286 }
4287
4288 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4289         LDKDecodeError ret = *owner->contents.err;
4290         ret.is_owned = false;
4291         return ret;
4292 }
4293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4294         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4295         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
4296         int64_t ret_ref = 0;
4297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4299         return ret_ref;
4300 }
4301
4302 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4303 CHECK(owner->result_ok);
4304         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
4305 }
4306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4307         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4308         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
4309         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
4310         int64_t ret_ref = tag_ptr(ret_copy, true);
4311         return ret_ref;
4312 }
4313
4314 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4315         LDKDecodeError ret = *owner->contents.err;
4316         ret.is_owned = false;
4317         return ret;
4318 }
4319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4320         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4321         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
4322         int64_t ret_ref = 0;
4323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4325         return ret_ref;
4326 }
4327
4328 typedef struct LDKAccess_JCalls {
4329         atomic_size_t refcnt;
4330         JavaVM *vm;
4331         jweak o;
4332         jmethodID get_utxo_meth;
4333 } LDKAccess_JCalls;
4334 static void LDKAccess_JCalls_free(void* this_arg) {
4335         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4336         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4337                 JNIEnv *env;
4338                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4339                 if (get_jenv_res == JNI_EDETACHED) {
4340                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4341                 } else {
4342                         DO_ASSERT(get_jenv_res == JNI_OK);
4343                 }
4344                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4345                 if (get_jenv_res == JNI_EDETACHED) {
4346                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4347                 }
4348                 FREE(j_calls);
4349         }
4350 }
4351 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4352         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4353         JNIEnv *env;
4354         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4355         if (get_jenv_res == JNI_EDETACHED) {
4356                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4357         } else {
4358                 DO_ASSERT(get_jenv_res == JNI_OK);
4359         }
4360         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4361         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4362         int64_t short_channel_id_conv = short_channel_id;
4363         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4364         CHECK(obj != NULL);
4365         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
4366         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4367                 (*env)->ExceptionDescribe(env);
4368                 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
4369         }
4370         void* ret_ptr = untag_ptr(ret);
4371         CHECK_ACCESS(ret_ptr);
4372         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
4373         FREE(untag_ptr(ret));
4374         if (get_jenv_res == JNI_EDETACHED) {
4375                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4376         }
4377         return ret_conv;
4378 }
4379 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
4380         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
4381         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4382 }
4383 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
4384         jclass c = (*env)->GetObjectClass(env, o);
4385         CHECK(c != NULL);
4386         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4387         atomic_init(&calls->refcnt, 1);
4388         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4389         calls->o = (*env)->NewWeakGlobalRef(env, o);
4390         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4391         CHECK(calls->get_utxo_meth != NULL);
4392
4393         LDKAccess ret = {
4394                 .this_arg = (void*) calls,
4395                 .get_utxo = get_utxo_LDKAccess_jcall,
4396                 .free = LDKAccess_JCalls_free,
4397         };
4398         return ret;
4399 }
4400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
4401         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4402         *res_ptr = LDKAccess_init(env, clz, o);
4403         return tag_ptr(res_ptr, true);
4404 }
4405 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) {
4406         void* this_arg_ptr = untag_ptr(this_arg);
4407         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4408         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
4409         unsigned char genesis_hash_arr[32];
4410         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4411         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4412         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4413         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4414         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4415         return tag_ptr(ret_conv, true);
4416 }
4417
4418 static jclass LDKCOption_AccessZ_Some_class = NULL;
4419 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
4420 static jclass LDKCOption_AccessZ_None_class = NULL;
4421 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
4422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
4423         LDKCOption_AccessZ_Some_class =
4424                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
4425         CHECK(LDKCOption_AccessZ_Some_class != NULL);
4426         LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
4427         CHECK(LDKCOption_AccessZ_Some_meth != NULL);
4428         LDKCOption_AccessZ_None_class =
4429                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
4430         CHECK(LDKCOption_AccessZ_None_class != NULL);
4431         LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
4432         CHECK(LDKCOption_AccessZ_None_meth != NULL);
4433 }
4434 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4435         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
4436         switch(obj->tag) {
4437                 case LDKCOption_AccessZ_Some: {
4438                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
4439                         *some_ret = obj->some;
4440                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4441                         if ((*some_ret).free == LDKAccess_JCalls_free) {
4442                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4443                                 LDKAccess_JCalls_cloned(&(*some_ret));
4444                         }
4445                         return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, tag_ptr(some_ret, true));
4446                 }
4447                 case LDKCOption_AccessZ_None: {
4448                         return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
4449                 }
4450                 default: abort();
4451         }
4452 }
4453 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4454 CHECK(owner->result_ok);
4455         return *owner->contents.result;
4456 }
4457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4458         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4459         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4460         return ret_conv;
4461 }
4462
4463 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4464         LDKLightningError ret = *owner->contents.err;
4465         ret.is_owned = false;
4466         return ret;
4467 }
4468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4469         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4470         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4471         int64_t ret_ref = 0;
4472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4474         return ret_ref;
4475 }
4476
4477 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4478         LDKChannelAnnouncement ret = owner->a;
4479         ret.is_owned = false;
4480         return ret;
4481 }
4482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4483         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4484         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4485         int64_t ret_ref = 0;
4486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4488         return ret_ref;
4489 }
4490
4491 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4492         LDKChannelUpdate ret = owner->b;
4493         ret.is_owned = false;
4494         return ret;
4495 }
4496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4497         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4498         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4499         int64_t ret_ref = 0;
4500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4502         return ret_ref;
4503 }
4504
4505 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4506         LDKChannelUpdate ret = owner->c;
4507         ret.is_owned = false;
4508         return ret;
4509 }
4510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
4511         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4512         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4513         int64_t ret_ref = 0;
4514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4516         return ret_ref;
4517 }
4518
4519 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
4520 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
4521 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
4522 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
4523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
4524         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
4525                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
4526         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
4527         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
4528         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
4529         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
4530                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
4531         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
4532         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
4533         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
4534 }
4535 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4536         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4537         switch(obj->tag) {
4538                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
4539                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4540                         *some_conv = obj->some;
4541                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4542                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
4543                 }
4544                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
4545                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
4546                 }
4547                 default: abort();
4548         }
4549 }
4550 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4551 CHECK(owner->result_ok);
4552         return *owner->contents.result;
4553 }
4554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4555         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4556         CResult_NoneLightningErrorZ_get_ok(owner_conv);
4557 }
4558
4559 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4560         LDKLightningError ret = *owner->contents.err;
4561         ret.is_owned = false;
4562         return ret;
4563 }
4564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4565         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4566         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4567         int64_t ret_ref = 0;
4568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4570         return ret_ref;
4571 }
4572
4573 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4574         LDKChannelUpdateInfo ret = *owner->contents.result;
4575         ret.is_owned = false;
4576         return ret;
4577 }
4578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4579         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4580         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
4581         int64_t ret_ref = 0;
4582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4584         return ret_ref;
4585 }
4586
4587 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
4588         LDKDecodeError ret = *owner->contents.err;
4589         ret.is_owned = false;
4590         return ret;
4591 }
4592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4593         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
4594         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
4595         int64_t ret_ref = 0;
4596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4598         return ret_ref;
4599 }
4600
4601 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4602         LDKChannelInfo ret = *owner->contents.result;
4603         ret.is_owned = false;
4604         return ret;
4605 }
4606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4607         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4608         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
4609         int64_t ret_ref = 0;
4610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4612         return ret_ref;
4613 }
4614
4615 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
4616         LDKDecodeError ret = *owner->contents.err;
4617         ret.is_owned = false;
4618         return ret;
4619 }
4620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4621         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
4622         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
4623         int64_t ret_ref = 0;
4624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4626         return ret_ref;
4627 }
4628
4629 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4630         LDKRoutingFees ret = *owner->contents.result;
4631         ret.is_owned = false;
4632         return ret;
4633 }
4634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4635         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4636         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
4637         int64_t ret_ref = 0;
4638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4640         return ret_ref;
4641 }
4642
4643 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
4644         LDKDecodeError ret = *owner->contents.err;
4645         ret.is_owned = false;
4646         return ret;
4647 }
4648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4649         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
4650         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
4651         int64_t ret_ref = 0;
4652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4654         return ret_ref;
4655 }
4656
4657 static jclass LDKNetAddress_IPv4_class = NULL;
4658 static jmethodID LDKNetAddress_IPv4_meth = NULL;
4659 static jclass LDKNetAddress_IPv6_class = NULL;
4660 static jmethodID LDKNetAddress_IPv6_meth = NULL;
4661 static jclass LDKNetAddress_OnionV2_class = NULL;
4662 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
4663 static jclass LDKNetAddress_OnionV3_class = NULL;
4664 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
4665 static jclass LDKNetAddress_Hostname_class = NULL;
4666 static jmethodID LDKNetAddress_Hostname_meth = NULL;
4667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
4668         LDKNetAddress_IPv4_class =
4669                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
4670         CHECK(LDKNetAddress_IPv4_class != NULL);
4671         LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
4672         CHECK(LDKNetAddress_IPv4_meth != NULL);
4673         LDKNetAddress_IPv6_class =
4674                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
4675         CHECK(LDKNetAddress_IPv6_class != NULL);
4676         LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
4677         CHECK(LDKNetAddress_IPv6_meth != NULL);
4678         LDKNetAddress_OnionV2_class =
4679                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
4680         CHECK(LDKNetAddress_OnionV2_class != NULL);
4681         LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
4682         CHECK(LDKNetAddress_OnionV2_meth != NULL);
4683         LDKNetAddress_OnionV3_class =
4684                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
4685         CHECK(LDKNetAddress_OnionV3_class != NULL);
4686         LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
4687         CHECK(LDKNetAddress_OnionV3_meth != NULL);
4688         LDKNetAddress_Hostname_class =
4689                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
4690         CHECK(LDKNetAddress_Hostname_class != NULL);
4691         LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
4692         CHECK(LDKNetAddress_Hostname_meth != NULL);
4693 }
4694 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4695         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
4696         switch(obj->tag) {
4697                 case LDKNetAddress_IPv4: {
4698                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4699                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4700                         int16_t port_conv = obj->i_pv4.port;
4701                         return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
4702                 }
4703                 case LDKNetAddress_IPv6: {
4704                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4705                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4706                         int16_t port_conv = obj->i_pv6.port;
4707                         return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
4708                 }
4709                 case LDKNetAddress_OnionV2: {
4710                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4711                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4712                         return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4713                 }
4714                 case LDKNetAddress_OnionV3: {
4715                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4716                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4717                         int16_t checksum_conv = obj->onion_v3.checksum;
4718                         int8_t version_conv = obj->onion_v3.version;
4719                         int16_t port_conv = obj->onion_v3.port;
4720                         return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
4721                 }
4722                 case LDKNetAddress_Hostname: {
4723                         LDKHostname hostname_var = obj->hostname.hostname;
4724                         int64_t hostname_ref = 0;
4725                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4726                         hostname_ref = tag_ptr(hostname_var.inner, false);
4727                         int16_t port_conv = obj->hostname.port;
4728                         return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
4729                 }
4730                 default: abort();
4731         }
4732 }
4733 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4734         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4735         for (size_t i = 0; i < ret.datalen; i++) {
4736                 ret.data[i] = NetAddress_clone(&orig->data[i]);
4737         }
4738         return ret;
4739 }
4740 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4741         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4742         ret.is_owned = false;
4743         return ret;
4744 }
4745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4746         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4747         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4748         int64_t ret_ref = 0;
4749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4751         return ret_ref;
4752 }
4753
4754 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4755         LDKDecodeError ret = *owner->contents.err;
4756         ret.is_owned = false;
4757         return ret;
4758 }
4759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4760         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4761         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
4762         int64_t ret_ref = 0;
4763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4765         return ret_ref;
4766 }
4767
4768 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4769         LDKNodeAlias ret = *owner->contents.result;
4770         ret.is_owned = false;
4771         return ret;
4772 }
4773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4774         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4775         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4776         int64_t ret_ref = 0;
4777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4779         return ret_ref;
4780 }
4781
4782 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4783         LDKDecodeError ret = *owner->contents.err;
4784         ret.is_owned = false;
4785         return ret;
4786 }
4787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4788         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4789         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4790         int64_t ret_ref = 0;
4791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4793         return ret_ref;
4794 }
4795
4796 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4797         LDKNodeInfo ret = *owner->contents.result;
4798         ret.is_owned = false;
4799         return ret;
4800 }
4801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4802         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4803         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4804         int64_t ret_ref = 0;
4805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4807         return ret_ref;
4808 }
4809
4810 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4811         LDKDecodeError ret = *owner->contents.err;
4812         ret.is_owned = false;
4813         return ret;
4814 }
4815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4816         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4817         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4818         int64_t ret_ref = 0;
4819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4821         return ret_ref;
4822 }
4823
4824 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4825         LDKNetworkGraph ret = *owner->contents.result;
4826         ret.is_owned = false;
4827         return ret;
4828 }
4829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4830         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4831         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4832         int64_t ret_ref = 0;
4833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4835         return ret_ref;
4836 }
4837
4838 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4839         LDKDecodeError ret = *owner->contents.err;
4840         ret.is_owned = false;
4841         return ret;
4842 }
4843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4844         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4845         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4846         int64_t ret_ref = 0;
4847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4849         return ret_ref;
4850 }
4851
4852 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4853 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4854 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4855 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4857         LDKCOption_CVec_NetAddressZZ_Some_class =
4858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4859         CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4860         LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4861         CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4862         LDKCOption_CVec_NetAddressZZ_None_class =
4863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4864         CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4865         LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4866         CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4867 }
4868 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4869         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4870         switch(obj->tag) {
4871                 case LDKCOption_CVec_NetAddressZZ_Some: {
4872                         LDKCVec_NetAddressZ some_var = obj->some;
4873                         int64_tArray some_arr = NULL;
4874                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
4875                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4876                         for (size_t m = 0; m < some_var.datalen; m++) {
4877                                 int64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
4878                                 some_arr_ptr[m] = some_conv_12_ref;
4879                         }
4880                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4881                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4882                 }
4883                 case LDKCOption_CVec_NetAddressZZ_None: {
4884                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4885                 }
4886                 default: abort();
4887         }
4888 }
4889 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4890         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
4891         ret.is_owned = false;
4892         return ret;
4893 }
4894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4895         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4896         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4897         int64_t ret_ref = 0;
4898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4900         return ret_ref;
4901 }
4902
4903 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4904         LDKDecodeError ret = *owner->contents.err;
4905         ret.is_owned = false;
4906         return ret;
4907 }
4908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4909         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4910         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4911         int64_t ret_ref = 0;
4912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4914         return ret_ref;
4915 }
4916
4917 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4918         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
4919         ret.is_owned = false;
4920         return ret;
4921 }
4922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4923         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4924         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4925         int64_t ret_ref = 0;
4926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4928         return ret_ref;
4929 }
4930
4931 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4932         LDKDecodeError ret = *owner->contents.err;
4933         ret.is_owned = false;
4934         return ret;
4935 }
4936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4937         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4938         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4939         int64_t ret_ref = 0;
4940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4942         return ret_ref;
4943 }
4944
4945 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4946 CHECK(owner->result_ok);
4947         return SpendableOutputDescriptor_clone(&*owner->contents.result);
4948 }
4949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4950         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4951         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4952         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4953         int64_t ret_ref = tag_ptr(ret_copy, true);
4954         return ret_ref;
4955 }
4956
4957 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4958         LDKDecodeError ret = *owner->contents.err;
4959         ret.is_owned = false;
4960         return ret;
4961 }
4962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4963         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4964         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4965         int64_t ret_ref = 0;
4966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4968         return ret_ref;
4969 }
4970
4971 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4972         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4973         for (size_t i = 0; i < ret.datalen; i++) {
4974                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4975         }
4976         return ret;
4977 }
4978 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4979         return owner->a;
4980 }
4981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4982         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4983         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4984         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4985         return ret_arr;
4986 }
4987
4988 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4989         return owner->b;
4990 }
4991 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4992         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4993         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4994         jobjectArray ret_arr = NULL;
4995         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4996         ;
4997         for (size_t i = 0; i < ret_var.datalen; i++) {
4998                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4999                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
5000                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5001         }
5002         
5003         return ret_arr;
5004 }
5005
5006 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
5007 CHECK(owner->result_ok);
5008         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
5009 }
5010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5011         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
5012         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5013         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
5014         return tag_ptr(ret_conv, true);
5015 }
5016
5017 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
5018 CHECK(!owner->result_ok);
5019         return *owner->contents.err;
5020 }
5021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5022         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
5023         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
5024 }
5025
5026 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
5027 CHECK(owner->result_ok);
5028         return *owner->contents.result;
5029 }
5030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5031         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
5032         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
5033         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
5034         return ret_arr;
5035 }
5036
5037 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
5038 CHECK(!owner->result_ok);
5039         return *owner->contents.err;
5040 }
5041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5042         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
5043         CResult_SignatureNoneZ_get_err(owner_conv);
5044 }
5045
5046 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
5047         return owner->a;
5048 }
5049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5050         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
5051         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
5052         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
5053         return ret_arr;
5054 }
5055
5056 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
5057         return owner->b;
5058 }
5059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5060         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
5061         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
5062         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
5063         return ret_arr;
5064 }
5065
5066 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
5067 CHECK(owner->result_ok);
5068         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
5069 }
5070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5071         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
5072         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
5073         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
5074         return tag_ptr(ret_conv, true);
5075 }
5076
5077 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
5078 CHECK(!owner->result_ok);
5079         return *owner->contents.err;
5080 }
5081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5082         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
5083         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
5084 }
5085
5086 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
5087 CHECK(owner->result_ok);
5088         return *owner->contents.result;
5089 }
5090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5091         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
5092         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5093         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
5094         return ret_arr;
5095 }
5096
5097 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
5098 CHECK(!owner->result_ok);
5099         return *owner->contents.err;
5100 }
5101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5102         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
5103         CResult_SecretKeyNoneZ_get_err(owner_conv);
5104 }
5105
5106 static jclass LDKCOption_ScalarZ_Some_class = NULL;
5107 static jmethodID LDKCOption_ScalarZ_Some_meth = NULL;
5108 static jclass LDKCOption_ScalarZ_None_class = NULL;
5109 static jmethodID LDKCOption_ScalarZ_None_meth = NULL;
5110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ScalarZ_init (JNIEnv *env, jclass clz) {
5111         LDKCOption_ScalarZ_Some_class =
5112                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$Some"));
5113         CHECK(LDKCOption_ScalarZ_Some_class != NULL);
5114         LDKCOption_ScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_Some_class, "<init>", "(J)V");
5115         CHECK(LDKCOption_ScalarZ_Some_meth != NULL);
5116         LDKCOption_ScalarZ_None_class =
5117                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$None"));
5118         CHECK(LDKCOption_ScalarZ_None_class != NULL);
5119         LDKCOption_ScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_None_class, "<init>", "()V");
5120         CHECK(LDKCOption_ScalarZ_None_meth != NULL);
5121 }
5122 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5123         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
5124         switch(obj->tag) {
5125                 case LDKCOption_ScalarZ_Some: {
5126                         LDKBigEndianScalar* some_ref = &obj->some;
5127                         return (*env)->NewObject(env, LDKCOption_ScalarZ_Some_class, LDKCOption_ScalarZ_Some_meth, tag_ptr(some_ref, false));
5128                 }
5129                 case LDKCOption_ScalarZ_None: {
5130                         return (*env)->NewObject(env, LDKCOption_ScalarZ_None_class, LDKCOption_ScalarZ_None_meth);
5131                 }
5132                 default: abort();
5133         }
5134 }
5135 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
5136 CHECK(owner->result_ok);
5137         return ThirtyTwoBytes_clone(&*owner->contents.result);
5138 }
5139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5140         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
5141         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5142         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SharedSecretNoneZ_get_ok(owner_conv).data);
5143         return ret_arr;
5144 }
5145
5146 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
5147 CHECK(!owner->result_ok);
5148         return *owner->contents.err;
5149 }
5150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5151         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
5152         CResult_SharedSecretNoneZ_get_err(owner_conv);
5153 }
5154
5155 typedef struct LDKBaseSign_JCalls {
5156         atomic_size_t refcnt;
5157         JavaVM *vm;
5158         jweak o;
5159         jmethodID get_per_commitment_point_meth;
5160         jmethodID release_commitment_secret_meth;
5161         jmethodID validate_holder_commitment_meth;
5162         jmethodID channel_keys_id_meth;
5163         jmethodID sign_counterparty_commitment_meth;
5164         jmethodID validate_counterparty_revocation_meth;
5165         jmethodID sign_holder_commitment_and_htlcs_meth;
5166         jmethodID sign_justice_revoked_output_meth;
5167         jmethodID sign_justice_revoked_htlc_meth;
5168         jmethodID sign_counterparty_htlc_transaction_meth;
5169         jmethodID sign_closing_transaction_meth;
5170         jmethodID sign_channel_announcement_meth;
5171         jmethodID ready_channel_meth;
5172 } LDKBaseSign_JCalls;
5173 static void LDKBaseSign_JCalls_free(void* this_arg) {
5174         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5175         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5176                 JNIEnv *env;
5177                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5178                 if (get_jenv_res == JNI_EDETACHED) {
5179                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5180                 } else {
5181                         DO_ASSERT(get_jenv_res == JNI_OK);
5182                 }
5183                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5184                 if (get_jenv_res == JNI_EDETACHED) {
5185                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5186                 }
5187                 FREE(j_calls);
5188         }
5189 }
5190 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
5191         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5192         JNIEnv *env;
5193         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5194         if (get_jenv_res == JNI_EDETACHED) {
5195                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5196         } else {
5197                 DO_ASSERT(get_jenv_res == JNI_OK);
5198         }
5199         int64_t idx_conv = idx;
5200         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5201         CHECK(obj != NULL);
5202         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
5203         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5204                 (*env)->ExceptionDescribe(env);
5205                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
5206         }
5207         LDKPublicKey ret_ref;
5208         CHECK((*env)->GetArrayLength(env, ret) == 33);
5209         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
5210         if (get_jenv_res == JNI_EDETACHED) {
5211                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5212         }
5213         return ret_ref;
5214 }
5215 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
5216         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5217         JNIEnv *env;
5218         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5219         if (get_jenv_res == JNI_EDETACHED) {
5220                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5221         } else {
5222                 DO_ASSERT(get_jenv_res == JNI_OK);
5223         }
5224         int64_t idx_conv = idx;
5225         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5226         CHECK(obj != NULL);
5227         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
5228         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5229                 (*env)->ExceptionDescribe(env);
5230                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
5231         }
5232         LDKThirtyTwoBytes ret_ref;
5233         CHECK((*env)->GetArrayLength(env, ret) == 32);
5234         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5235         if (get_jenv_res == JNI_EDETACHED) {
5236                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5237         }
5238         return ret_ref;
5239 }
5240 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
5241         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5242         JNIEnv *env;
5243         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5244         if (get_jenv_res == JNI_EDETACHED) {
5245                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5246         } else {
5247                 DO_ASSERT(get_jenv_res == JNI_OK);
5248         }
5249         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
5250         int64_t holder_tx_ref = 0;
5251         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
5252         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
5253         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
5254         LDKCVec_PaymentPreimageZ preimages_var = preimages;
5255         jobjectArray preimages_arr = NULL;
5256         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
5257         ;
5258         for (size_t i = 0; i < preimages_var.datalen; i++) {
5259                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
5260                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
5261                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
5262         }
5263         
5264         FREE(preimages_var.data);
5265         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5266         CHECK(obj != NULL);
5267         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
5268         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5269                 (*env)->ExceptionDescribe(env);
5270                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
5271         }
5272         void* ret_ptr = untag_ptr(ret);
5273         CHECK_ACCESS(ret_ptr);
5274         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
5275         FREE(untag_ptr(ret));
5276         if (get_jenv_res == JNI_EDETACHED) {
5277                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5278         }
5279         return ret_conv;
5280 }
5281 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
5282         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5283         JNIEnv *env;
5284         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5285         if (get_jenv_res == JNI_EDETACHED) {
5286                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5287         } else {
5288                 DO_ASSERT(get_jenv_res == JNI_OK);
5289         }
5290         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5291         CHECK(obj != NULL);
5292         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
5293         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5294                 (*env)->ExceptionDescribe(env);
5295                 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
5296         }
5297         LDKThirtyTwoBytes ret_ref;
5298         CHECK((*env)->GetArrayLength(env, ret) == 32);
5299         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5300         if (get_jenv_res == JNI_EDETACHED) {
5301                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5302         }
5303         return ret_ref;
5304 }
5305 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
5306         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5307         JNIEnv *env;
5308         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5309         if (get_jenv_res == JNI_EDETACHED) {
5310                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5311         } else {
5312                 DO_ASSERT(get_jenv_res == JNI_OK);
5313         }
5314         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
5315         int64_t commitment_tx_ref = 0;
5316         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
5317         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
5318         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
5319         LDKCVec_PaymentPreimageZ preimages_var = preimages;
5320         jobjectArray preimages_arr = NULL;
5321         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
5322         ;
5323         for (size_t i = 0; i < preimages_var.datalen; i++) {
5324                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
5325                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
5326                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
5327         }
5328         
5329         FREE(preimages_var.data);
5330         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5331         CHECK(obj != NULL);
5332         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
5333         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5334                 (*env)->ExceptionDescribe(env);
5335                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
5336         }
5337         void* ret_ptr = untag_ptr(ret);
5338         CHECK_ACCESS(ret_ptr);
5339         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
5340         FREE(untag_ptr(ret));
5341         if (get_jenv_res == JNI_EDETACHED) {
5342                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5343         }
5344         return ret_conv;
5345 }
5346 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
5347         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5348         JNIEnv *env;
5349         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5350         if (get_jenv_res == JNI_EDETACHED) {
5351                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5352         } else {
5353                 DO_ASSERT(get_jenv_res == JNI_OK);
5354         }
5355         int64_t idx_conv = idx;
5356         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
5357         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
5358         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5359         CHECK(obj != NULL);
5360         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
5361         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5362                 (*env)->ExceptionDescribe(env);
5363                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
5364         }
5365         void* ret_ptr = untag_ptr(ret);
5366         CHECK_ACCESS(ret_ptr);
5367         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
5368         FREE(untag_ptr(ret));
5369         if (get_jenv_res == JNI_EDETACHED) {
5370                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5371         }
5372         return ret_conv;
5373 }
5374 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
5375         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5376         JNIEnv *env;
5377         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5378         if (get_jenv_res == JNI_EDETACHED) {
5379                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5380         } else {
5381                 DO_ASSERT(get_jenv_res == JNI_OK);
5382         }
5383         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
5384         int64_t commitment_tx_ref = 0;
5385         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
5386         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
5387         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
5388         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5389         CHECK(obj != NULL);
5390         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
5391         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5392                 (*env)->ExceptionDescribe(env);
5393                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
5394         }
5395         void* ret_ptr = untag_ptr(ret);
5396         CHECK_ACCESS(ret_ptr);
5397         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
5398         FREE(untag_ptr(ret));
5399         if (get_jenv_res == JNI_EDETACHED) {
5400                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5401         }
5402         return ret_conv;
5403 }
5404 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]) {
5405         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5406         JNIEnv *env;
5407         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5408         if (get_jenv_res == JNI_EDETACHED) {
5409                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5410         } else {
5411                 DO_ASSERT(get_jenv_res == JNI_OK);
5412         }
5413         LDKTransaction justice_tx_var = justice_tx;
5414         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
5415         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
5416         Transaction_free(justice_tx_var);
5417         int64_t input_conv = input;
5418         int64_t amount_conv = amount;
5419         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
5420         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
5421         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5422         CHECK(obj != NULL);
5423         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);
5424         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5425                 (*env)->ExceptionDescribe(env);
5426                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
5427         }
5428         void* ret_ptr = untag_ptr(ret);
5429         CHECK_ACCESS(ret_ptr);
5430         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5431         FREE(untag_ptr(ret));
5432         if (get_jenv_res == JNI_EDETACHED) {
5433                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5434         }
5435         return ret_conv;
5436 }
5437 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) {
5438         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5439         JNIEnv *env;
5440         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5441         if (get_jenv_res == JNI_EDETACHED) {
5442                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5443         } else {
5444                 DO_ASSERT(get_jenv_res == JNI_OK);
5445         }
5446         LDKTransaction justice_tx_var = justice_tx;
5447         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
5448         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
5449         Transaction_free(justice_tx_var);
5450         int64_t input_conv = input;
5451         int64_t amount_conv = amount;
5452         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
5453         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
5454         LDKHTLCOutputInCommitment htlc_var = *htlc;
5455         int64_t htlc_ref = 0;
5456         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
5457         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
5458         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
5459         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5460         CHECK(obj != NULL);
5461         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);
5462         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5463                 (*env)->ExceptionDescribe(env);
5464                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
5465         }
5466         void* ret_ptr = untag_ptr(ret);
5467         CHECK_ACCESS(ret_ptr);
5468         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5469         FREE(untag_ptr(ret));
5470         if (get_jenv_res == JNI_EDETACHED) {
5471                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5472         }
5473         return ret_conv;
5474 }
5475 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) {
5476         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5477         JNIEnv *env;
5478         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5479         if (get_jenv_res == JNI_EDETACHED) {
5480                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5481         } else {
5482                 DO_ASSERT(get_jenv_res == JNI_OK);
5483         }
5484         LDKTransaction htlc_tx_var = htlc_tx;
5485         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
5486         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
5487         Transaction_free(htlc_tx_var);
5488         int64_t input_conv = input;
5489         int64_t amount_conv = amount;
5490         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
5491         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
5492         LDKHTLCOutputInCommitment htlc_var = *htlc;
5493         int64_t htlc_ref = 0;
5494         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
5495         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
5496         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
5497         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5498         CHECK(obj != NULL);
5499         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);
5500         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5501                 (*env)->ExceptionDescribe(env);
5502                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
5503         }
5504         void* ret_ptr = untag_ptr(ret);
5505         CHECK_ACCESS(ret_ptr);
5506         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5507         FREE(untag_ptr(ret));
5508         if (get_jenv_res == JNI_EDETACHED) {
5509                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5510         }
5511         return ret_conv;
5512 }
5513 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
5514         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5515         JNIEnv *env;
5516         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5517         if (get_jenv_res == JNI_EDETACHED) {
5518                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5519         } else {
5520                 DO_ASSERT(get_jenv_res == JNI_OK);
5521         }
5522         LDKClosingTransaction closing_tx_var = *closing_tx;
5523         int64_t closing_tx_ref = 0;
5524         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
5525         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
5526         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
5527         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5528         CHECK(obj != NULL);
5529         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
5530         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5531                 (*env)->ExceptionDescribe(env);
5532                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
5533         }
5534         void* ret_ptr = untag_ptr(ret);
5535         CHECK_ACCESS(ret_ptr);
5536         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
5537         FREE(untag_ptr(ret));
5538         if (get_jenv_res == JNI_EDETACHED) {
5539                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5540         }
5541         return ret_conv;
5542 }
5543 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
5544         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5545         JNIEnv *env;
5546         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5547         if (get_jenv_res == JNI_EDETACHED) {
5548                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5549         } else {
5550                 DO_ASSERT(get_jenv_res == JNI_OK);
5551         }
5552         LDKUnsignedChannelAnnouncement msg_var = *msg;
5553         int64_t msg_ref = 0;
5554         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
5555         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5556         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
5557         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5558         CHECK(obj != NULL);
5559         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
5560         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5561                 (*env)->ExceptionDescribe(env);
5562                 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
5563         }
5564         void* ret_ptr = untag_ptr(ret);
5565         CHECK_ACCESS(ret_ptr);
5566         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
5567         FREE(untag_ptr(ret));
5568         if (get_jenv_res == JNI_EDETACHED) {
5569                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5570         }
5571         return ret_conv;
5572 }
5573 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
5574         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
5575         JNIEnv *env;
5576         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5577         if (get_jenv_res == JNI_EDETACHED) {
5578                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5579         } else {
5580                 DO_ASSERT(get_jenv_res == JNI_OK);
5581         }
5582         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
5583         int64_t channel_parameters_ref = 0;
5584         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
5585         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
5586         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
5587         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5588         CHECK(obj != NULL);
5589         (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
5590         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5591                 (*env)->ExceptionDescribe(env);
5592                 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
5593         }
5594         if (get_jenv_res == JNI_EDETACHED) {
5595                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5596         }
5597 }
5598 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5599         jclass c = (*env)->GetObjectClass(env, o);
5600         CHECK(c != NULL);
5601         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
5602         atomic_init(&calls->refcnt, 1);
5603         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5604         calls->o = (*env)->NewWeakGlobalRef(env, o);
5605         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
5606         CHECK(calls->get_per_commitment_point_meth != NULL);
5607         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
5608         CHECK(calls->release_commitment_secret_meth != NULL);
5609         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
5610         CHECK(calls->validate_holder_commitment_meth != NULL);
5611         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
5612         CHECK(calls->channel_keys_id_meth != NULL);
5613         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
5614         CHECK(calls->sign_counterparty_commitment_meth != NULL);
5615         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
5616         CHECK(calls->validate_counterparty_revocation_meth != NULL);
5617         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
5618         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
5619         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
5620         CHECK(calls->sign_justice_revoked_output_meth != NULL);
5621         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
5622         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
5623         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
5624         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
5625         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
5626         CHECK(calls->sign_closing_transaction_meth != NULL);
5627         calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
5628         CHECK(calls->sign_channel_announcement_meth != NULL);
5629         calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
5630         CHECK(calls->ready_channel_meth != NULL);
5631
5632         LDKChannelPublicKeys pubkeys_conv;
5633         pubkeys_conv.inner = untag_ptr(pubkeys);
5634         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
5635         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5636
5637         LDKBaseSign ret = {
5638                 .this_arg = (void*) calls,
5639                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
5640                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
5641                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
5642                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
5643                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
5644                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
5645                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
5646                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
5647                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
5648                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
5649                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
5650                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
5651                 .ready_channel = ready_channel_LDKBaseSign_jcall,
5652                 .free = LDKBaseSign_JCalls_free,
5653                 .pubkeys = pubkeys_conv,
5654                 .set_pubkeys = NULL,
5655         };
5656         return ret;
5657 }
5658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
5659         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
5660         *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
5661         return tag_ptr(res_ptr, true);
5662 }
5663 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) {
5664         void* this_arg_ptr = untag_ptr(this_arg);
5665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5666         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5667         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5668         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
5669         return ret_arr;
5670 }
5671
5672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
5673         void* this_arg_ptr = untag_ptr(this_arg);
5674         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5675         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5676         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5677         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
5678         return ret_arr;
5679 }
5680
5681 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) {
5682         void* this_arg_ptr = untag_ptr(this_arg);
5683         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5684         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5685         LDKHolderCommitmentTransaction holder_tx_conv;
5686         holder_tx_conv.inner = untag_ptr(holder_tx);
5687         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
5688         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
5689         holder_tx_conv.is_owned = false;
5690         LDKCVec_PaymentPreimageZ preimages_constr;
5691         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5692         if (preimages_constr.datalen > 0)
5693                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5694         else
5695                 preimages_constr.data = NULL;
5696         for (size_t i = 0; i < preimages_constr.datalen; i++) {
5697                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5698                 LDKThirtyTwoBytes preimages_conv_8_ref;
5699                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5700                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5701                 preimages_constr.data[i] = preimages_conv_8_ref;
5702         }
5703         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5704         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
5705         return tag_ptr(ret_conv, true);
5706 }
5707
5708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
5709         void* this_arg_ptr = untag_ptr(this_arg);
5710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5711         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5712         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5713         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
5714         return ret_arr;
5715 }
5716
5717 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) {
5718         void* this_arg_ptr = untag_ptr(this_arg);
5719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5720         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5721         LDKCommitmentTransaction commitment_tx_conv;
5722         commitment_tx_conv.inner = untag_ptr(commitment_tx);
5723         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
5724         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5725         commitment_tx_conv.is_owned = false;
5726         LDKCVec_PaymentPreimageZ preimages_constr;
5727         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
5728         if (preimages_constr.datalen > 0)
5729                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
5730         else
5731                 preimages_constr.data = NULL;
5732         for (size_t i = 0; i < preimages_constr.datalen; i++) {
5733                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
5734                 LDKThirtyTwoBytes preimages_conv_8_ref;
5735                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
5736                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
5737                 preimages_constr.data[i] = preimages_conv_8_ref;
5738         }
5739         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5740         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
5741         return tag_ptr(ret_conv, true);
5742 }
5743
5744 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) {
5745         void* this_arg_ptr = untag_ptr(this_arg);
5746         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5747         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5748         unsigned char secret_arr[32];
5749         CHECK((*env)->GetArrayLength(env, secret) == 32);
5750         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
5751         unsigned char (*secret_ref)[32] = &secret_arr;
5752         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5753         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
5754         return tag_ptr(ret_conv, true);
5755 }
5756
5757 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) {
5758         void* this_arg_ptr = untag_ptr(this_arg);
5759         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5760         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5761         LDKHolderCommitmentTransaction commitment_tx_conv;
5762         commitment_tx_conv.inner = untag_ptr(commitment_tx);
5763         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
5764         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5765         commitment_tx_conv.is_owned = false;
5766         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5767         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
5768         return tag_ptr(ret_conv, true);
5769 }
5770
5771 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) {
5772         void* this_arg_ptr = untag_ptr(this_arg);
5773         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5774         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5775         LDKTransaction justice_tx_ref;
5776         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5777         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5778         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5779         justice_tx_ref.data_is_owned = true;
5780         unsigned char per_commitment_key_arr[32];
5781         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5782         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5783         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5784         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5785         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
5786         return tag_ptr(ret_conv, true);
5787 }
5788
5789 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) {
5790         void* this_arg_ptr = untag_ptr(this_arg);
5791         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5792         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5793         LDKTransaction justice_tx_ref;
5794         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5795         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5796         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5797         justice_tx_ref.data_is_owned = true;
5798         unsigned char per_commitment_key_arr[32];
5799         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5800         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5801         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5802         LDKHTLCOutputInCommitment htlc_conv;
5803         htlc_conv.inner = untag_ptr(htlc);
5804         htlc_conv.is_owned = ptr_is_owned(htlc);
5805         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5806         htlc_conv.is_owned = false;
5807         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5808         *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);
5809         return tag_ptr(ret_conv, true);
5810 }
5811
5812 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) {
5813         void* this_arg_ptr = untag_ptr(this_arg);
5814         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5815         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5816         LDKTransaction htlc_tx_ref;
5817         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
5818         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
5819         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
5820         htlc_tx_ref.data_is_owned = true;
5821         LDKPublicKey per_commitment_point_ref;
5822         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
5823         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
5824         LDKHTLCOutputInCommitment htlc_conv;
5825         htlc_conv.inner = untag_ptr(htlc);
5826         htlc_conv.is_owned = ptr_is_owned(htlc);
5827         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5828         htlc_conv.is_owned = false;
5829         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5830         *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);
5831         return tag_ptr(ret_conv, true);
5832 }
5833
5834 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) {
5835         void* this_arg_ptr = untag_ptr(this_arg);
5836         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5837         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5838         LDKClosingTransaction closing_tx_conv;
5839         closing_tx_conv.inner = untag_ptr(closing_tx);
5840         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
5841         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5842         closing_tx_conv.is_owned = false;
5843         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5844         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5845         return tag_ptr(ret_conv, true);
5846 }
5847
5848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5849         void* this_arg_ptr = untag_ptr(this_arg);
5850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5851         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5852         LDKUnsignedChannelAnnouncement msg_conv;
5853         msg_conv.inner = untag_ptr(msg);
5854         msg_conv.is_owned = ptr_is_owned(msg);
5855         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5856         msg_conv.is_owned = false;
5857         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5858         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5859         return tag_ptr(ret_conv, true);
5860 }
5861
5862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5863         void* this_arg_ptr = untag_ptr(this_arg);
5864         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5865         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5866         LDKChannelTransactionParameters channel_parameters_conv;
5867         channel_parameters_conv.inner = untag_ptr(channel_parameters);
5868         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
5869         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5870         channel_parameters_conv.is_owned = false;
5871         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5872 }
5873
5874 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5875         if (this_arg->set_pubkeys != NULL)
5876                 this_arg->set_pubkeys(this_arg);
5877         return this_arg->pubkeys;
5878 }
5879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5880         void* this_arg_ptr = untag_ptr(this_arg);
5881         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5882         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5883         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5884         int64_t ret_ref = 0;
5885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5887         return ret_ref;
5888 }
5889
5890 typedef struct LDKSign_JCalls {
5891         atomic_size_t refcnt;
5892         JavaVM *vm;
5893         jweak o;
5894         LDKBaseSign_JCalls* BaseSign;
5895         jmethodID write_meth;
5896 } LDKSign_JCalls;
5897 static void LDKSign_JCalls_free(void* this_arg) {
5898         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5899         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5900                 JNIEnv *env;
5901                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5902                 if (get_jenv_res == JNI_EDETACHED) {
5903                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5904                 } else {
5905                         DO_ASSERT(get_jenv_res == JNI_OK);
5906                 }
5907                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5908                 if (get_jenv_res == JNI_EDETACHED) {
5909                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5910                 }
5911                 FREE(j_calls);
5912         }
5913 }
5914 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5915         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5916         JNIEnv *env;
5917         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5918         if (get_jenv_res == JNI_EDETACHED) {
5919                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5920         } else {
5921                 DO_ASSERT(get_jenv_res == JNI_OK);
5922         }
5923         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5924         CHECK(obj != NULL);
5925         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5926         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5927                 (*env)->ExceptionDescribe(env);
5928                 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5929         }
5930         LDKCVec_u8Z ret_ref;
5931         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5932         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5933         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5934         if (get_jenv_res == JNI_EDETACHED) {
5935                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5936         }
5937         return ret_ref;
5938 }
5939 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5940         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5941         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5942         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5943 }
5944 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5945         jclass c = (*env)->GetObjectClass(env, o);
5946         CHECK(c != NULL);
5947         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5948         atomic_init(&calls->refcnt, 1);
5949         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5950         calls->o = (*env)->NewWeakGlobalRef(env, o);
5951         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5952         CHECK(calls->write_meth != NULL);
5953
5954         LDKChannelPublicKeys pubkeys_conv;
5955         pubkeys_conv.inner = untag_ptr(pubkeys);
5956         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
5957         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5958
5959         LDKSign ret = {
5960                 .this_arg = (void*) calls,
5961                 .write = write_LDKSign_jcall,
5962                 .cloned = LDKSign_JCalls_cloned,
5963                 .free = LDKSign_JCalls_free,
5964                 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5965         };
5966         calls->BaseSign = ret.BaseSign.this_arg;
5967         return ret;
5968 }
5969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5970         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5971         *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5972         return tag_ptr(res_ptr, true);
5973 }
5974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5975         LDKSign *inp = (LDKSign *)untag_ptr(arg);
5976         return tag_ptr(&inp->BaseSign, false);
5977 }
5978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5979         void* this_arg_ptr = untag_ptr(this_arg);
5980         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5981         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5982         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5983         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5984         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5985         CVec_u8Z_free(ret_var);
5986         return ret_arr;
5987 }
5988
5989 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5990 CHECK(owner->result_ok);
5991         return Sign_clone(&*owner->contents.result);
5992 }
5993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5994         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
5995         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5996         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5997         return tag_ptr(ret_ret, true);
5998 }
5999
6000 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
6001         LDKDecodeError ret = *owner->contents.err;
6002         ret.is_owned = false;
6003         return ret;
6004 }
6005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6006         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
6007         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
6008         int64_t ret_ref = 0;
6009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6011         return ret_ref;
6012 }
6013
6014 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
6015 CHECK(owner->result_ok);
6016         return *owner->contents.result;
6017 }
6018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6019         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
6020         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
6021         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
6022         return ret_arr;
6023 }
6024
6025 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
6026 CHECK(!owner->result_ok);
6027         return *owner->contents.err;
6028 }
6029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6030         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
6031         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
6032 }
6033
6034 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
6035         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
6036         for (size_t i = 0; i < ret.datalen; i++) {
6037                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
6038         }
6039         return ret;
6040 }
6041 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
6042 CHECK(owner->result_ok);
6043         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
6044 }
6045 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6046         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
6047         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
6048         jobjectArray ret_arr = NULL;
6049         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6050         ;
6051         for (size_t i = 0; i < ret_var.datalen; i++) {
6052                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
6053                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
6054                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
6055                 CVec_u8Z_free(ret_conv_8_var);
6056                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6057         }
6058         
6059         FREE(ret_var.data);
6060         return ret_arr;
6061 }
6062
6063 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
6064 CHECK(!owner->result_ok);
6065         return *owner->contents.err;
6066 }
6067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6068         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
6069         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
6070 }
6071
6072 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
6073         LDKInMemorySigner ret = *owner->contents.result;
6074         ret.is_owned = false;
6075         return ret;
6076 }
6077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6078         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
6079         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
6080         int64_t ret_ref = 0;
6081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6083         return ret_ref;
6084 }
6085
6086 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
6087         LDKDecodeError ret = *owner->contents.err;
6088         ret.is_owned = false;
6089         return ret;
6090 }
6091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6092         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
6093         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
6094         int64_t ret_ref = 0;
6095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6097         return ret_ref;
6098 }
6099
6100 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
6101         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
6102         for (size_t i = 0; i < ret.datalen; i++) {
6103                 ret.data[i] = TxOut_clone(&orig->data[i]);
6104         }
6105         return ret;
6106 }
6107 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
6108 CHECK(owner->result_ok);
6109         return *owner->contents.result;
6110 }
6111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6112         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
6113         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
6114         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6115         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6116         return ret_arr;
6117 }
6118
6119 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
6120 CHECK(!owner->result_ok);
6121         return *owner->contents.err;
6122 }
6123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6124         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
6125         CResult_TransactionNoneZ_get_err(owner_conv);
6126 }
6127
6128 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6129         return ThirtyTwoBytes_clone(&owner->a);
6130 }
6131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6132         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6133         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6134         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
6135         return ret_arr;
6136 }
6137
6138 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6139         LDKChannelMonitor ret = owner->b;
6140         ret.is_owned = false;
6141         return ret;
6142 }
6143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6144         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6145         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6146         int64_t ret_ref = 0;
6147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6149         return ret_ref;
6150 }
6151
6152 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
6153         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
6154         for (size_t i = 0; i < ret.datalen; i++) {
6155                 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
6156         }
6157         return ret;
6158 }
6159 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
6160 CHECK(owner->result_ok);
6161         return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
6162 }
6163 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6164         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
6165         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
6166         int64_tArray ret_arr = NULL;
6167         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6168         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6169         for (size_t j = 0; j < ret_var.datalen; j++) {
6170                 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6171                 *ret_conv_35_conv = ret_var.data[j];
6172                 ret_arr_ptr[j] = tag_ptr(ret_conv_35_conv, true);
6173         }
6174         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6175         FREE(ret_var.data);
6176         return ret_arr;
6177 }
6178
6179 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
6180 CHECK(!owner->result_ok);
6181         return *owner->contents.err;
6182 }
6183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6184         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
6185         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
6186         return ret_conv;
6187 }
6188
6189 static jclass LDKCOption_u16Z_Some_class = NULL;
6190 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
6191 static jclass LDKCOption_u16Z_None_class = NULL;
6192 static jmethodID LDKCOption_u16Z_None_meth = NULL;
6193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
6194         LDKCOption_u16Z_Some_class =
6195                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
6196         CHECK(LDKCOption_u16Z_Some_class != NULL);
6197         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
6198         CHECK(LDKCOption_u16Z_Some_meth != NULL);
6199         LDKCOption_u16Z_None_class =
6200                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
6201         CHECK(LDKCOption_u16Z_None_class != NULL);
6202         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
6203         CHECK(LDKCOption_u16Z_None_meth != NULL);
6204 }
6205 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6206         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
6207         switch(obj->tag) {
6208                 case LDKCOption_u16Z_Some: {
6209                         int16_t some_conv = obj->some;
6210                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
6211                 }
6212                 case LDKCOption_u16Z_None: {
6213                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
6214                 }
6215                 default: abort();
6216         }
6217 }
6218 static jclass LDKAPIError_APIMisuseError_class = NULL;
6219 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
6220 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
6221 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
6222 static jclass LDKAPIError_RouteError_class = NULL;
6223 static jmethodID LDKAPIError_RouteError_meth = NULL;
6224 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
6225 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
6226 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
6227 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
6228 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
6229 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
6230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
6231         LDKAPIError_APIMisuseError_class =
6232                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
6233         CHECK(LDKAPIError_APIMisuseError_class != NULL);
6234         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
6235         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
6236         LDKAPIError_FeeRateTooHigh_class =
6237                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
6238         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
6239         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
6240         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
6241         LDKAPIError_RouteError_class =
6242                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
6243         CHECK(LDKAPIError_RouteError_class != NULL);
6244         LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
6245         CHECK(LDKAPIError_RouteError_meth != NULL);
6246         LDKAPIError_ChannelUnavailable_class =
6247                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
6248         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
6249         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
6250         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
6251         LDKAPIError_MonitorUpdateFailed_class =
6252                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
6253         CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
6254         LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
6255         CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
6256         LDKAPIError_IncompatibleShutdownScript_class =
6257                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
6258         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
6259         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
6260         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
6261 }
6262 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6263         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
6264         switch(obj->tag) {
6265                 case LDKAPIError_APIMisuseError: {
6266                         LDKStr err_str = obj->api_misuse_error.err;
6267                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
6268                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
6269                 }
6270                 case LDKAPIError_FeeRateTooHigh: {
6271                         LDKStr err_str = obj->fee_rate_too_high.err;
6272                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
6273                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
6274                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
6275                 }
6276                 case LDKAPIError_RouteError: {
6277                         LDKStr err_str = obj->route_error.err;
6278                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
6279                         return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
6280                 }
6281                 case LDKAPIError_ChannelUnavailable: {
6282                         LDKStr err_str = obj->channel_unavailable.err;
6283                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
6284                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
6285                 }
6286                 case LDKAPIError_MonitorUpdateFailed: {
6287                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
6288                 }
6289                 case LDKAPIError_IncompatibleShutdownScript: {
6290                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
6291                         int64_t script_ref = 0;
6292                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
6293                         script_ref = tag_ptr(script_var.inner, false);
6294                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
6295                 }
6296                 default: abort();
6297         }
6298 }
6299 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
6300 CHECK(owner->result_ok);
6301         return *owner->contents.result;
6302 }
6303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6304         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
6305         CResult_NoneAPIErrorZ_get_ok(owner_conv);
6306 }
6307
6308 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
6309 CHECK(!owner->result_ok);
6310         return APIError_clone(&*owner->contents.err);
6311 }
6312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6313         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
6314         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6315         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
6316         int64_t ret_ref = tag_ptr(ret_copy, true);
6317         return ret_ref;
6318 }
6319
6320 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
6321         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
6322         for (size_t i = 0; i < ret.datalen; i++) {
6323                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
6324         }
6325         return ret;
6326 }
6327 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
6328         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
6329         for (size_t i = 0; i < ret.datalen; i++) {
6330                 ret.data[i] = APIError_clone(&orig->data[i]);
6331         }
6332         return ret;
6333 }
6334 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6335 CHECK(owner->result_ok);
6336         return ThirtyTwoBytes_clone(&*owner->contents.result);
6337 }
6338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6339         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6340         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6341         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
6342         return ret_arr;
6343 }
6344
6345 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6346 CHECK(!owner->result_ok);
6347         return APIError_clone(&*owner->contents.err);
6348 }
6349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6350         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6351         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6352         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
6353         int64_t ret_ref = tag_ptr(ret_copy, true);
6354         return ret_ref;
6355 }
6356
6357 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
6358 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
6359 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
6360 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
6361 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
6362 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
6363 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
6364 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
6365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
6366         LDKPaymentSendFailure_ParameterError_class =
6367                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
6368         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
6369         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
6370         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
6371         LDKPaymentSendFailure_PathParameterError_class =
6372                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
6373         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
6374         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
6375         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
6376         LDKPaymentSendFailure_AllFailedRetrySafe_class =
6377                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
6378         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
6379         LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
6380         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
6381         LDKPaymentSendFailure_PartialFailure_class =
6382                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
6383         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
6384         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
6385         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
6386 }
6387 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6388         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6389         switch(obj->tag) {
6390                 case LDKPaymentSendFailure_ParameterError: {
6391                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6392                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
6393                 }
6394                 case LDKPaymentSendFailure_PathParameterError: {
6395                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6396                         int64_tArray path_parameter_error_arr = NULL;
6397                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
6398                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
6399                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6400                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6401                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6402                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6403                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6404                         }
6405                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
6406                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
6407                 }
6408                 case LDKPaymentSendFailure_AllFailedRetrySafe: {
6409                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
6410                         int64_tArray all_failed_retry_safe_arr = NULL;
6411                         all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
6412                         int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
6413                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
6414                                 int64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
6415                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
6416                         }
6417                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
6418                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
6419                 }
6420                 case LDKPaymentSendFailure_PartialFailure: {
6421                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6422                         int64_tArray results_arr = NULL;
6423                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
6424                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
6425                         for (size_t w = 0; w < results_var.datalen; w++) {
6426                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6427                                 *results_conv_22_conv = results_var.data[w];
6428                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6429                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6430                         }
6431                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
6432                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6433                         int64_t failed_paths_retry_ref = 0;
6434                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6435                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6436                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6437                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
6438                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
6439                 }
6440                 default: abort();
6441         }
6442 }
6443 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6444 CHECK(owner->result_ok);
6445         return ThirtyTwoBytes_clone(&*owner->contents.result);
6446 }
6447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6448         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
6449         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6450         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
6451         return ret_arr;
6452 }
6453
6454 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
6455 CHECK(!owner->result_ok);
6456         return PaymentSendFailure_clone(&*owner->contents.err);
6457 }
6458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6459         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
6460         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6461         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
6462         int64_t ret_ref = tag_ptr(ret_copy, true);
6463         return ret_ref;
6464 }
6465
6466 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6467 CHECK(owner->result_ok);
6468         return *owner->contents.result;
6469 }
6470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6471         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6472         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6473 }
6474
6475 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6476 CHECK(!owner->result_ok);
6477         return PaymentSendFailure_clone(&*owner->contents.err);
6478 }
6479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6480         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6481         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6482         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6483         int64_t ret_ref = tag_ptr(ret_copy, true);
6484         return ret_ref;
6485 }
6486
6487 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6488         return ThirtyTwoBytes_clone(&owner->a);
6489 }
6490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6491         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6492         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6493         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
6494         return ret_arr;
6495 }
6496
6497 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6498         return ThirtyTwoBytes_clone(&owner->b);
6499 }
6500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6501         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6502         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6503         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
6504         return ret_arr;
6505 }
6506
6507 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6508 CHECK(owner->result_ok);
6509         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6510 }
6511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6512         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6513         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6514         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6515         return tag_ptr(ret_conv, true);
6516 }
6517
6518 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6519 CHECK(!owner->result_ok);
6520         return PaymentSendFailure_clone(&*owner->contents.err);
6521 }
6522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6523         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6524         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6525         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6526         int64_t ret_ref = tag_ptr(ret_copy, true);
6527         return ret_ref;
6528 }
6529
6530 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
6531         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
6532         for (size_t i = 0; i < ret.datalen; i++) {
6533                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6534         }
6535         return ret;
6536 }
6537 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6538         return ThirtyTwoBytes_clone(&owner->a);
6539 }
6540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6541         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6542         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6543         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
6544         return ret_arr;
6545 }
6546
6547 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6548         return ThirtyTwoBytes_clone(&owner->b);
6549 }
6550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6551         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6552         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6553         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
6554         return ret_arr;
6555 }
6556
6557 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6558 CHECK(owner->result_ok);
6559         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6560 }
6561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6562         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6563         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6564         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6565         return tag_ptr(ret_conv, true);
6566 }
6567
6568 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6569 CHECK(!owner->result_ok);
6570         return *owner->contents.err;
6571 }
6572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6573         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6574         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6575 }
6576
6577 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6578 CHECK(owner->result_ok);
6579         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6580 }
6581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6582         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
6583         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6584         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
6585         return tag_ptr(ret_conv, true);
6586 }
6587
6588 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
6589 CHECK(!owner->result_ok);
6590         return APIError_clone(&*owner->contents.err);
6591 }
6592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6593         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
6594         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6595         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
6596         int64_t ret_ref = tag_ptr(ret_copy, true);
6597         return ret_ref;
6598 }
6599
6600 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6601 CHECK(owner->result_ok);
6602         return ThirtyTwoBytes_clone(&*owner->contents.result);
6603 }
6604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6605         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6606         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6607         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
6608         return ret_arr;
6609 }
6610
6611 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6612 CHECK(!owner->result_ok);
6613         return *owner->contents.err;
6614 }
6615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6616         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6617         CResult_PaymentSecretNoneZ_get_err(owner_conv);
6618 }
6619
6620 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6621 CHECK(owner->result_ok);
6622         return ThirtyTwoBytes_clone(&*owner->contents.result);
6623 }
6624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6625         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
6626         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6627         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
6628         return ret_arr;
6629 }
6630
6631 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
6632 CHECK(!owner->result_ok);
6633         return APIError_clone(&*owner->contents.err);
6634 }
6635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6636         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
6637         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6638         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
6639         int64_t ret_ref = tag_ptr(ret_copy, true);
6640         return ret_ref;
6641 }
6642
6643 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6644 CHECK(owner->result_ok);
6645         return ThirtyTwoBytes_clone(&*owner->contents.result);
6646 }
6647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6648         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6649         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6650         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
6651         return ret_arr;
6652 }
6653
6654 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6655 CHECK(!owner->result_ok);
6656         return APIError_clone(&*owner->contents.err);
6657 }
6658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6659         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6660         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6661         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6662         int64_t ret_ref = tag_ptr(ret_copy, true);
6663         return ret_ref;
6664 }
6665
6666 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6667         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
6668         ret.is_owned = false;
6669         return ret;
6670 }
6671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6672         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6673         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6674         int64_t ret_ref = 0;
6675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6677         return ret_ref;
6678 }
6679
6680 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6681         LDKDecodeError ret = *owner->contents.err;
6682         ret.is_owned = false;
6683         return ret;
6684 }
6685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6686         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6687         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6688         int64_t ret_ref = 0;
6689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6691         return ret_ref;
6692 }
6693
6694 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6695         LDKChannelCounterparty ret = *owner->contents.result;
6696         ret.is_owned = false;
6697         return ret;
6698 }
6699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6700         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6701         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6702         int64_t ret_ref = 0;
6703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6705         return ret_ref;
6706 }
6707
6708 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6709         LDKDecodeError ret = *owner->contents.err;
6710         ret.is_owned = false;
6711         return ret;
6712 }
6713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6714         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6715         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6716         int64_t ret_ref = 0;
6717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6719         return ret_ref;
6720 }
6721
6722 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6723         LDKChannelDetails ret = *owner->contents.result;
6724         ret.is_owned = false;
6725         return ret;
6726 }
6727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6728         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6729         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6730         int64_t ret_ref = 0;
6731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6733         return ret_ref;
6734 }
6735
6736 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6737         LDKDecodeError ret = *owner->contents.err;
6738         ret.is_owned = false;
6739         return ret;
6740 }
6741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6742         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6743         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6744         int64_t ret_ref = 0;
6745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6747         return ret_ref;
6748 }
6749
6750 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6751         LDKPhantomRouteHints ret = *owner->contents.result;
6752         ret.is_owned = false;
6753         return ret;
6754 }
6755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6756         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6757         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6758         int64_t ret_ref = 0;
6759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6761         return ret_ref;
6762 }
6763
6764 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6765         LDKDecodeError ret = *owner->contents.err;
6766         ret.is_owned = false;
6767         return ret;
6768 }
6769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6770         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6771         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6772         int64_t ret_ref = 0;
6773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6775         return ret_ref;
6776 }
6777
6778 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6779         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6780         for (size_t i = 0; i < ret.datalen; i++) {
6781                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6782         }
6783         return ret;
6784 }
6785 typedef struct LDKWatch_JCalls {
6786         atomic_size_t refcnt;
6787         JavaVM *vm;
6788         jweak o;
6789         jmethodID watch_channel_meth;
6790         jmethodID update_channel_meth;
6791         jmethodID release_pending_monitor_events_meth;
6792 } LDKWatch_JCalls;
6793 static void LDKWatch_JCalls_free(void* this_arg) {
6794         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6795         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6796                 JNIEnv *env;
6797                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6798                 if (get_jenv_res == JNI_EDETACHED) {
6799                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6800                 } else {
6801                         DO_ASSERT(get_jenv_res == JNI_OK);
6802                 }
6803                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6804                 if (get_jenv_res == JNI_EDETACHED) {
6805                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6806                 }
6807                 FREE(j_calls);
6808         }
6809 }
6810 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6811         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6812         JNIEnv *env;
6813         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6814         if (get_jenv_res == JNI_EDETACHED) {
6815                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6816         } else {
6817                 DO_ASSERT(get_jenv_res == JNI_OK);
6818         }
6819         LDKOutPoint funding_txo_var = funding_txo;
6820         int64_t funding_txo_ref = 0;
6821         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6822         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6823         LDKChannelMonitor monitor_var = monitor;
6824         int64_t monitor_ref = 0;
6825         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6826         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6827         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6828         CHECK(obj != NULL);
6829         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
6830         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6831                 (*env)->ExceptionDescribe(env);
6832                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
6833         }
6834         void* ret_ptr = untag_ptr(ret);
6835         CHECK_ACCESS(ret_ptr);
6836         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6837         FREE(untag_ptr(ret));
6838         if (get_jenv_res == JNI_EDETACHED) {
6839                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6840         }
6841         return ret_conv;
6842 }
6843 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6844         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6845         JNIEnv *env;
6846         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6847         if (get_jenv_res == JNI_EDETACHED) {
6848                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6849         } else {
6850                 DO_ASSERT(get_jenv_res == JNI_OK);
6851         }
6852         LDKOutPoint funding_txo_var = funding_txo;
6853         int64_t funding_txo_ref = 0;
6854         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6855         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6856         LDKChannelMonitorUpdate update_var = update;
6857         int64_t update_ref = 0;
6858         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6859         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6860         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6861         CHECK(obj != NULL);
6862         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6863         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6864                 (*env)->ExceptionDescribe(env);
6865                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6866         }
6867         void* ret_ptr = untag_ptr(ret);
6868         CHECK_ACCESS(ret_ptr);
6869         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6870         FREE(untag_ptr(ret));
6871         if (get_jenv_res == JNI_EDETACHED) {
6872                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6873         }
6874         return ret_conv;
6875 }
6876 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6877         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6878         JNIEnv *env;
6879         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6880         if (get_jenv_res == JNI_EDETACHED) {
6881                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6882         } else {
6883                 DO_ASSERT(get_jenv_res == JNI_OK);
6884         }
6885         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6886         CHECK(obj != NULL);
6887         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6888         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6889                 (*env)->ExceptionDescribe(env);
6890                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6891         }
6892         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6893         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6894         if (ret_constr.datalen > 0)
6895                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6896         else
6897                 ret_constr.data = NULL;
6898         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6899         for (size_t x = 0; x < ret_constr.datalen; x++) {
6900                 int64_t ret_conv_49 = ret_vals[x];
6901                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6902                 CHECK_ACCESS(ret_conv_49_ptr);
6903                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6904                 FREE(untag_ptr(ret_conv_49));
6905                 ret_constr.data[x] = ret_conv_49_conv;
6906         }
6907         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6908         if (get_jenv_res == JNI_EDETACHED) {
6909                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6910         }
6911         return ret_constr;
6912 }
6913 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6914         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6915         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6916 }
6917 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6918         jclass c = (*env)->GetObjectClass(env, o);
6919         CHECK(c != NULL);
6920         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6921         atomic_init(&calls->refcnt, 1);
6922         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6923         calls->o = (*env)->NewWeakGlobalRef(env, o);
6924         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6925         CHECK(calls->watch_channel_meth != NULL);
6926         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6927         CHECK(calls->update_channel_meth != NULL);
6928         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6929         CHECK(calls->release_pending_monitor_events_meth != NULL);
6930
6931         LDKWatch ret = {
6932                 .this_arg = (void*) calls,
6933                 .watch_channel = watch_channel_LDKWatch_jcall,
6934                 .update_channel = update_channel_LDKWatch_jcall,
6935                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6936                 .free = LDKWatch_JCalls_free,
6937         };
6938         return ret;
6939 }
6940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6941         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6942         *res_ptr = LDKWatch_init(env, clz, o);
6943         return tag_ptr(res_ptr, true);
6944 }
6945 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) {
6946         void* this_arg_ptr = untag_ptr(this_arg);
6947         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6948         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6949         LDKOutPoint funding_txo_conv;
6950         funding_txo_conv.inner = untag_ptr(funding_txo);
6951         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6952         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6953         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6954         LDKChannelMonitor monitor_conv;
6955         monitor_conv.inner = untag_ptr(monitor);
6956         monitor_conv.is_owned = ptr_is_owned(monitor);
6957         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6958         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6959         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6960         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6961         return tag_ptr(ret_conv, true);
6962 }
6963
6964 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) {
6965         void* this_arg_ptr = untag_ptr(this_arg);
6966         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6967         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6968         LDKOutPoint funding_txo_conv;
6969         funding_txo_conv.inner = untag_ptr(funding_txo);
6970         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6971         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6972         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6973         LDKChannelMonitorUpdate update_conv;
6974         update_conv.inner = untag_ptr(update);
6975         update_conv.is_owned = ptr_is_owned(update);
6976         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6977         update_conv = ChannelMonitorUpdate_clone(&update_conv);
6978         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6979         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6980         return tag_ptr(ret_conv, true);
6981 }
6982
6983 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6984         void* this_arg_ptr = untag_ptr(this_arg);
6985         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6986         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6987         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6988         int64_tArray ret_arr = NULL;
6989         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6990         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6991         for (size_t x = 0; x < ret_var.datalen; x++) {
6992                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6993                 *ret_conv_49_conv = ret_var.data[x];
6994                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6995         }
6996         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6997         FREE(ret_var.data);
6998         return ret_arr;
6999 }
7000
7001 typedef struct LDKBroadcasterInterface_JCalls {
7002         atomic_size_t refcnt;
7003         JavaVM *vm;
7004         jweak o;
7005         jmethodID broadcast_transaction_meth;
7006 } LDKBroadcasterInterface_JCalls;
7007 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7008         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7009         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7010                 JNIEnv *env;
7011                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7012                 if (get_jenv_res == JNI_EDETACHED) {
7013                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7014                 } else {
7015                         DO_ASSERT(get_jenv_res == JNI_OK);
7016                 }
7017                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7018                 if (get_jenv_res == JNI_EDETACHED) {
7019                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7020                 }
7021                 FREE(j_calls);
7022         }
7023 }
7024 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
7025         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7026         JNIEnv *env;
7027         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7028         if (get_jenv_res == JNI_EDETACHED) {
7029                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7030         } else {
7031                 DO_ASSERT(get_jenv_res == JNI_OK);
7032         }
7033         LDKTransaction tx_var = tx;
7034         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
7035         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
7036         Transaction_free(tx_var);
7037         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7038         CHECK(obj != NULL);
7039         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
7040         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7041                 (*env)->ExceptionDescribe(env);
7042                 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
7043         }
7044         if (get_jenv_res == JNI_EDETACHED) {
7045                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7046         }
7047 }
7048 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7049         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7050         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7051 }
7052 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
7053         jclass c = (*env)->GetObjectClass(env, o);
7054         CHECK(c != NULL);
7055         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7056         atomic_init(&calls->refcnt, 1);
7057         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7058         calls->o = (*env)->NewWeakGlobalRef(env, o);
7059         calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
7060         CHECK(calls->broadcast_transaction_meth != NULL);
7061
7062         LDKBroadcasterInterface ret = {
7063                 .this_arg = (void*) calls,
7064                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
7065                 .free = LDKBroadcasterInterface_JCalls_free,
7066         };
7067         return ret;
7068 }
7069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7070         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7071         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
7072         return tag_ptr(res_ptr, true);
7073 }
7074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
7075         void* this_arg_ptr = untag_ptr(this_arg);
7076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7077         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7078         LDKTransaction tx_ref;
7079         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
7080         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
7081         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
7082         tx_ref.data_is_owned = true;
7083         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
7084 }
7085
7086 typedef struct LDKKeysInterface_JCalls {
7087         atomic_size_t refcnt;
7088         JavaVM *vm;
7089         jweak o;
7090         jmethodID get_node_secret_meth;
7091         jmethodID ecdh_meth;
7092         jmethodID get_destination_script_meth;
7093         jmethodID get_shutdown_scriptpubkey_meth;
7094         jmethodID get_channel_signer_meth;
7095         jmethodID get_secure_random_bytes_meth;
7096         jmethodID read_chan_signer_meth;
7097         jmethodID sign_invoice_meth;
7098         jmethodID get_inbound_payment_key_material_meth;
7099 } LDKKeysInterface_JCalls;
7100 static void LDKKeysInterface_JCalls_free(void* this_arg) {
7101         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7102         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7103                 JNIEnv *env;
7104                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7105                 if (get_jenv_res == JNI_EDETACHED) {
7106                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7107                 } else {
7108                         DO_ASSERT(get_jenv_res == JNI_OK);
7109                 }
7110                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7111                 if (get_jenv_res == JNI_EDETACHED) {
7112                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7113                 }
7114                 FREE(j_calls);
7115         }
7116 }
7117 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
7118         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7119         JNIEnv *env;
7120         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7121         if (get_jenv_res == JNI_EDETACHED) {
7122                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7123         } else {
7124                 DO_ASSERT(get_jenv_res == JNI_OK);
7125         }
7126         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7127         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7128         CHECK(obj != NULL);
7129         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
7130         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7131                 (*env)->ExceptionDescribe(env);
7132                 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
7133         }
7134         void* ret_ptr = untag_ptr(ret);
7135         CHECK_ACCESS(ret_ptr);
7136         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
7137         FREE(untag_ptr(ret));
7138         if (get_jenv_res == JNI_EDETACHED) {
7139                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7140         }
7141         return ret_conv;
7142 }
7143 LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
7144         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7145         JNIEnv *env;
7146         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7147         if (get_jenv_res == JNI_EDETACHED) {
7148                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7149         } else {
7150                 DO_ASSERT(get_jenv_res == JNI_OK);
7151         }
7152         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7153         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
7154         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
7155         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
7156         *tweak_copy = tweak;
7157         int64_t tweak_ref = tag_ptr(tweak_copy, true);
7158         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7159         CHECK(obj != NULL);
7160         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
7161         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7162                 (*env)->ExceptionDescribe(env);
7163                 (*env)->FatalError(env, "A call to ecdh in LDKKeysInterface from rust threw an exception.");
7164         }
7165         void* ret_ptr = untag_ptr(ret);
7166         CHECK_ACCESS(ret_ptr);
7167         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
7168         FREE(untag_ptr(ret));
7169         if (get_jenv_res == JNI_EDETACHED) {
7170                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7171         }
7172         return ret_conv;
7173 }
7174 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
7175         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7176         JNIEnv *env;
7177         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7178         if (get_jenv_res == JNI_EDETACHED) {
7179                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7180         } else {
7181                 DO_ASSERT(get_jenv_res == JNI_OK);
7182         }
7183         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7184         CHECK(obj != NULL);
7185         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
7186         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7187                 (*env)->ExceptionDescribe(env);
7188                 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
7189         }
7190         LDKCVec_u8Z ret_ref;
7191         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7192         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7193         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7194         if (get_jenv_res == JNI_EDETACHED) {
7195                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7196         }
7197         return ret_ref;
7198 }
7199 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
7200         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7201         JNIEnv *env;
7202         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7203         if (get_jenv_res == JNI_EDETACHED) {
7204                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7205         } else {
7206                 DO_ASSERT(get_jenv_res == JNI_OK);
7207         }
7208         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7209         CHECK(obj != NULL);
7210         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
7211         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7212                 (*env)->ExceptionDescribe(env);
7213                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
7214         }
7215         LDKShutdownScript ret_conv;
7216         ret_conv.inner = untag_ptr(ret);
7217         ret_conv.is_owned = ptr_is_owned(ret);
7218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
7219         if (get_jenv_res == JNI_EDETACHED) {
7220                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7221         }
7222         return ret_conv;
7223 }
7224 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
7225         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7226         JNIEnv *env;
7227         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7228         if (get_jenv_res == JNI_EDETACHED) {
7229                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7230         } else {
7231                 DO_ASSERT(get_jenv_res == JNI_OK);
7232         }
7233         jboolean inbound_conv = inbound;
7234         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7235         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7236         CHECK(obj != NULL);
7237         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
7238         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7239                 (*env)->ExceptionDescribe(env);
7240                 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
7241         }
7242         void* ret_ptr = untag_ptr(ret);
7243         CHECK_ACCESS(ret_ptr);
7244         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
7245         FREE(untag_ptr(ret));
7246         if (get_jenv_res == JNI_EDETACHED) {
7247                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7248         }
7249         return ret_conv;
7250 }
7251 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
7252         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7253         JNIEnv *env;
7254         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7255         if (get_jenv_res == JNI_EDETACHED) {
7256                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7257         } else {
7258                 DO_ASSERT(get_jenv_res == JNI_OK);
7259         }
7260         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7261         CHECK(obj != NULL);
7262         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
7263         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7264                 (*env)->ExceptionDescribe(env);
7265                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
7266         }
7267         LDKThirtyTwoBytes ret_ref;
7268         CHECK((*env)->GetArrayLength(env, ret) == 32);
7269         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7270         if (get_jenv_res == JNI_EDETACHED) {
7271                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7272         }
7273         return ret_ref;
7274 }
7275 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
7276         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7277         JNIEnv *env;
7278         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7279         if (get_jenv_res == JNI_EDETACHED) {
7280                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7281         } else {
7282                 DO_ASSERT(get_jenv_res == JNI_OK);
7283         }
7284         LDKu8slice reader_var = reader;
7285         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
7286         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
7287         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7288         CHECK(obj != NULL);
7289         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
7290         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7291                 (*env)->ExceptionDescribe(env);
7292                 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
7293         }
7294         void* ret_ptr = untag_ptr(ret);
7295         CHECK_ACCESS(ret_ptr);
7296         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
7297         FREE(untag_ptr(ret));
7298         if (get_jenv_res == JNI_EDETACHED) {
7299                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7300         }
7301         return ret_conv;
7302 }
7303 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
7304         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7305         JNIEnv *env;
7306         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7307         if (get_jenv_res == JNI_EDETACHED) {
7308                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7309         } else {
7310                 DO_ASSERT(get_jenv_res == JNI_OK);
7311         }
7312         LDKu8slice hrp_bytes_var = hrp_bytes;
7313         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
7314         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
7315         LDKCVec_u5Z invoice_data_var = invoice_data;
7316         jobjectArray invoice_data_arr = NULL;
7317         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
7318         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
7319         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7320                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7321                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7322         }
7323         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
7324         FREE(invoice_data_var.data);
7325         jclass receipient_conv = LDKRecipient_to_java(env, receipient);
7326         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7327         CHECK(obj != NULL);
7328         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
7329         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7330                 (*env)->ExceptionDescribe(env);
7331                 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
7332         }
7333         void* ret_ptr = untag_ptr(ret);
7334         CHECK_ACCESS(ret_ptr);
7335         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7336         FREE(untag_ptr(ret));
7337         if (get_jenv_res == JNI_EDETACHED) {
7338                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7339         }
7340         return ret_conv;
7341 }
7342 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
7343         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
7344         JNIEnv *env;
7345         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7346         if (get_jenv_res == JNI_EDETACHED) {
7347                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7348         } else {
7349                 DO_ASSERT(get_jenv_res == JNI_OK);
7350         }
7351         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7352         CHECK(obj != NULL);
7353         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7354         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7355                 (*env)->ExceptionDescribe(env);
7356                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
7357         }
7358         LDKThirtyTwoBytes ret_ref;
7359         CHECK((*env)->GetArrayLength(env, ret) == 32);
7360         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7361         if (get_jenv_res == JNI_EDETACHED) {
7362                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7363         }
7364         return ret_ref;
7365 }
7366 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
7367         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
7368         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7369 }
7370 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
7371         jclass c = (*env)->GetObjectClass(env, o);
7372         CHECK(c != NULL);
7373         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
7374         atomic_init(&calls->refcnt, 1);
7375         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7376         calls->o = (*env)->NewWeakGlobalRef(env, o);
7377         calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
7378         CHECK(calls->get_node_secret_meth != NULL);
7379         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
7380         CHECK(calls->ecdh_meth != NULL);
7381         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
7382         CHECK(calls->get_destination_script_meth != NULL);
7383         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
7384         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
7385         calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
7386         CHECK(calls->get_channel_signer_meth != NULL);
7387         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7388         CHECK(calls->get_secure_random_bytes_meth != NULL);
7389         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
7390         CHECK(calls->read_chan_signer_meth != NULL);
7391         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
7392         CHECK(calls->sign_invoice_meth != NULL);
7393         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
7394         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
7395
7396         LDKKeysInterface ret = {
7397                 .this_arg = (void*) calls,
7398                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
7399                 .ecdh = ecdh_LDKKeysInterface_jcall,
7400                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
7401                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
7402                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
7403                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
7404                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
7405                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
7406                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
7407                 .free = LDKKeysInterface_JCalls_free,
7408         };
7409         return ret;
7410 }
7411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7412         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7413         *res_ptr = LDKKeysInterface_init(env, clz, o);
7414         return tag_ptr(res_ptr, true);
7415 }
7416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
7417         void* this_arg_ptr = untag_ptr(this_arg);
7418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7419         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7420         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7421         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
7422         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
7423         return tag_ptr(ret_conv, true);
7424 }
7425
7426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) {
7427         void* this_arg_ptr = untag_ptr(this_arg);
7428         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7429         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7430         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7431         LDKPublicKey other_key_ref;
7432         CHECK((*env)->GetArrayLength(env, other_key) == 33);
7433         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
7434         void* tweak_ptr = untag_ptr(tweak);
7435         CHECK_ACCESS(tweak_ptr);
7436         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
7437         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
7438         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
7439         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
7440         return tag_ptr(ret_conv, true);
7441 }
7442
7443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
7444         void* this_arg_ptr = untag_ptr(this_arg);
7445         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7446         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7447         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
7448         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7449         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7450         CVec_u8Z_free(ret_var);
7451         return ret_arr;
7452 }
7453
7454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
7455         void* this_arg_ptr = untag_ptr(this_arg);
7456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7457         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7458         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7459         int64_t ret_ref = 0;
7460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7462         return ret_ref;
7463 }
7464
7465 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) {
7466         void* this_arg_ptr = untag_ptr(this_arg);
7467         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7468         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7469         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
7470         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
7471         return tag_ptr(ret_ret, true);
7472 }
7473
7474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7475         void* this_arg_ptr = untag_ptr(this_arg);
7476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7477         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7478         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7480         return ret_arr;
7481 }
7482
7483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
7484         void* this_arg_ptr = untag_ptr(this_arg);
7485         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7486         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7487         LDKu8slice reader_ref;
7488         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
7489         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
7490         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7491         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7492         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
7493         return tag_ptr(ret_conv, true);
7494 }
7495
7496 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) {
7497         void* this_arg_ptr = untag_ptr(this_arg);
7498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7499         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7500         LDKu8slice hrp_bytes_ref;
7501         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
7502         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
7503         LDKCVec_u5Z invoice_data_constr;
7504         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
7505         if (invoice_data_constr.datalen > 0)
7506                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
7507         else
7508                 invoice_data_constr.data = NULL;
7509         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
7510         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
7511                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
7512                 
7513                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
7514         }
7515         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
7516         LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
7517         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7518         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
7519         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
7520         return tag_ptr(ret_conv, true);
7521 }
7522
7523 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
7524         void* this_arg_ptr = untag_ptr(this_arg);
7525         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7526         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
7527         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7528         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
7529         return ret_arr;
7530 }
7531
7532 typedef struct LDKFeeEstimator_JCalls {
7533         atomic_size_t refcnt;
7534         JavaVM *vm;
7535         jweak o;
7536         jmethodID get_est_sat_per_1000_weight_meth;
7537 } LDKFeeEstimator_JCalls;
7538 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7539         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7540         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7541                 JNIEnv *env;
7542                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7543                 if (get_jenv_res == JNI_EDETACHED) {
7544                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7545                 } else {
7546                         DO_ASSERT(get_jenv_res == JNI_OK);
7547                 }
7548                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7549                 if (get_jenv_res == JNI_EDETACHED) {
7550                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7551                 }
7552                 FREE(j_calls);
7553         }
7554 }
7555 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7556         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7557         JNIEnv *env;
7558         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7559         if (get_jenv_res == JNI_EDETACHED) {
7560                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7561         } else {
7562                 DO_ASSERT(get_jenv_res == JNI_OK);
7563         }
7564         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
7565         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7566         CHECK(obj != NULL);
7567         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
7568         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7569                 (*env)->ExceptionDescribe(env);
7570                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
7571         }
7572         if (get_jenv_res == JNI_EDETACHED) {
7573                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7574         }
7575         return ret;
7576 }
7577 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7578         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7579         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7580 }
7581 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
7582         jclass c = (*env)->GetObjectClass(env, o);
7583         CHECK(c != NULL);
7584         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7585         atomic_init(&calls->refcnt, 1);
7586         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7587         calls->o = (*env)->NewWeakGlobalRef(env, o);
7588         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
7589         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
7590
7591         LDKFeeEstimator ret = {
7592                 .this_arg = (void*) calls,
7593                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7594                 .free = LDKFeeEstimator_JCalls_free,
7595         };
7596         return ret;
7597 }
7598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
7599         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7600         *res_ptr = LDKFeeEstimator_init(env, clz, o);
7601         return tag_ptr(res_ptr, true);
7602 }
7603 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) {
7604         void* this_arg_ptr = untag_ptr(this_arg);
7605         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7606         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7607         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
7608         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7609         return ret_conv;
7610 }
7611
7612 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7613         return ThirtyTwoBytes_clone(&owner->a);
7614 }
7615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7616         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
7617         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7618         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
7619         return ret_arr;
7620 }
7621
7622 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7623         LDKChannelManager ret = owner->b;
7624         ret.is_owned = false;
7625         return ret;
7626 }
7627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7628         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
7629         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
7630         int64_t ret_ref = 0;
7631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7633         return ret_ref;
7634 }
7635
7636 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7637 CHECK(owner->result_ok);
7638         return &*owner->contents.result;
7639 }
7640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7641         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7642         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7643         return ret_ret;
7644 }
7645
7646 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7647         LDKDecodeError ret = *owner->contents.err;
7648         ret.is_owned = false;
7649         return ret;
7650 }
7651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7652         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7653         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
7654         int64_t ret_ref = 0;
7655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7657         return ret_ref;
7658 }
7659
7660 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7661         LDKChannelConfig ret = *owner->contents.result;
7662         ret.is_owned = false;
7663         return ret;
7664 }
7665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7666         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7667         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7668         int64_t ret_ref = 0;
7669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7671         return ret_ref;
7672 }
7673
7674 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7675         LDKDecodeError ret = *owner->contents.err;
7676         ret.is_owned = false;
7677         return ret;
7678 }
7679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7680         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7681         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7682         int64_t ret_ref = 0;
7683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7685         return ret_ref;
7686 }
7687
7688 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7689         LDKOutPoint ret = *owner->contents.result;
7690         ret.is_owned = false;
7691         return ret;
7692 }
7693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7694         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
7695         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
7696         int64_t ret_ref = 0;
7697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7699         return ret_ref;
7700 }
7701
7702 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7703         LDKDecodeError ret = *owner->contents.err;
7704         ret.is_owned = false;
7705         return ret;
7706 }
7707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7708         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
7709         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
7710         int64_t ret_ref = 0;
7711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7713         return ret_ref;
7714 }
7715
7716 typedef struct LDKType_JCalls {
7717         atomic_size_t refcnt;
7718         JavaVM *vm;
7719         jweak o;
7720         jmethodID type_id_meth;
7721         jmethodID debug_str_meth;
7722         jmethodID write_meth;
7723 } LDKType_JCalls;
7724 static void LDKType_JCalls_free(void* this_arg) {
7725         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7726         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7727                 JNIEnv *env;
7728                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7729                 if (get_jenv_res == JNI_EDETACHED) {
7730                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7731                 } else {
7732                         DO_ASSERT(get_jenv_res == JNI_OK);
7733                 }
7734                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7735                 if (get_jenv_res == JNI_EDETACHED) {
7736                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7737                 }
7738                 FREE(j_calls);
7739         }
7740 }
7741 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7742         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7743         JNIEnv *env;
7744         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7745         if (get_jenv_res == JNI_EDETACHED) {
7746                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7747         } else {
7748                 DO_ASSERT(get_jenv_res == JNI_OK);
7749         }
7750         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7751         CHECK(obj != NULL);
7752         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
7753         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7754                 (*env)->ExceptionDescribe(env);
7755                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
7756         }
7757         if (get_jenv_res == JNI_EDETACHED) {
7758                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7759         }
7760         return ret;
7761 }
7762 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7763         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7764         JNIEnv *env;
7765         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7766         if (get_jenv_res == JNI_EDETACHED) {
7767                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7768         } else {
7769                 DO_ASSERT(get_jenv_res == JNI_OK);
7770         }
7771         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7772         CHECK(obj != NULL);
7773         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
7774         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7775                 (*env)->ExceptionDescribe(env);
7776                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
7777         }
7778         LDKStr ret_conv = java_to_owned_str(env, ret);
7779         if (get_jenv_res == JNI_EDETACHED) {
7780                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7781         }
7782         return ret_conv;
7783 }
7784 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7785         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7786         JNIEnv *env;
7787         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7788         if (get_jenv_res == JNI_EDETACHED) {
7789                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7790         } else {
7791                 DO_ASSERT(get_jenv_res == JNI_OK);
7792         }
7793         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7794         CHECK(obj != NULL);
7795         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
7796         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7797                 (*env)->ExceptionDescribe(env);
7798                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
7799         }
7800         LDKCVec_u8Z ret_ref;
7801         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7802         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7803         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7804         if (get_jenv_res == JNI_EDETACHED) {
7805                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7806         }
7807         return ret_ref;
7808 }
7809 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7810         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7811         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7812 }
7813 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
7814         jclass c = (*env)->GetObjectClass(env, o);
7815         CHECK(c != NULL);
7816         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7817         atomic_init(&calls->refcnt, 1);
7818         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7819         calls->o = (*env)->NewWeakGlobalRef(env, o);
7820         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
7821         CHECK(calls->type_id_meth != NULL);
7822         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
7823         CHECK(calls->debug_str_meth != NULL);
7824         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
7825         CHECK(calls->write_meth != NULL);
7826
7827         LDKType ret = {
7828                 .this_arg = (void*) calls,
7829                 .type_id = type_id_LDKType_jcall,
7830                 .debug_str = debug_str_LDKType_jcall,
7831                 .write = write_LDKType_jcall,
7832                 .cloned = LDKType_JCalls_cloned,
7833                 .free = LDKType_JCalls_free,
7834         };
7835         return ret;
7836 }
7837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
7838         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7839         *res_ptr = LDKType_init(env, clz, o);
7840         return tag_ptr(res_ptr, true);
7841 }
7842 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
7843         void* this_arg_ptr = untag_ptr(this_arg);
7844         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7845         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7846         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7847         return ret_conv;
7848 }
7849
7850 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
7851         void* this_arg_ptr = untag_ptr(this_arg);
7852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7853         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7854         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7855         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7856         Str_free(ret_str);
7857         return ret_conv;
7858 }
7859
7860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
7861         void* this_arg_ptr = untag_ptr(this_arg);
7862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7863         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7864         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7865         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7866         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7867         CVec_u8Z_free(ret_var);
7868         return ret_arr;
7869 }
7870
7871 static jclass LDKCOption_TypeZ_Some_class = NULL;
7872 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
7873 static jclass LDKCOption_TypeZ_None_class = NULL;
7874 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
7875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
7876         LDKCOption_TypeZ_Some_class =
7877                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
7878         CHECK(LDKCOption_TypeZ_Some_class != NULL);
7879         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
7880         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
7881         LDKCOption_TypeZ_None_class =
7882                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
7883         CHECK(LDKCOption_TypeZ_None_class != NULL);
7884         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
7885         CHECK(LDKCOption_TypeZ_None_meth != NULL);
7886 }
7887 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7888         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7889         switch(obj->tag) {
7890                 case LDKCOption_TypeZ_Some: {
7891                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7892                         *some_ret = Type_clone(&obj->some);
7893                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
7894                 }
7895                 case LDKCOption_TypeZ_None: {
7896                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
7897                 }
7898                 default: abort();
7899         }
7900 }
7901 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7902 CHECK(owner->result_ok);
7903         return COption_TypeZ_clone(&*owner->contents.result);
7904 }
7905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7906         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7907         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7908         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7909         int64_t ret_ref = tag_ptr(ret_copy, true);
7910         return ret_ref;
7911 }
7912
7913 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7914         LDKDecodeError ret = *owner->contents.err;
7915         ret.is_owned = false;
7916         return ret;
7917 }
7918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7919         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7920         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7921         int64_t ret_ref = 0;
7922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7924         return ret_ref;
7925 }
7926
7927 static jclass LDKPaymentError_Invoice_class = NULL;
7928 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7929 static jclass LDKPaymentError_Routing_class = NULL;
7930 static jmethodID LDKPaymentError_Routing_meth = NULL;
7931 static jclass LDKPaymentError_Sending_class = NULL;
7932 static jmethodID LDKPaymentError_Sending_meth = NULL;
7933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7934         LDKPaymentError_Invoice_class =
7935                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7936         CHECK(LDKPaymentError_Invoice_class != NULL);
7937         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7938         CHECK(LDKPaymentError_Invoice_meth != NULL);
7939         LDKPaymentError_Routing_class =
7940                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7941         CHECK(LDKPaymentError_Routing_class != NULL);
7942         LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7943         CHECK(LDKPaymentError_Routing_meth != NULL);
7944         LDKPaymentError_Sending_class =
7945                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7946         CHECK(LDKPaymentError_Sending_class != NULL);
7947         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7948         CHECK(LDKPaymentError_Sending_meth != NULL);
7949 }
7950 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7951         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7952         switch(obj->tag) {
7953                 case LDKPaymentError_Invoice: {
7954                         LDKStr invoice_str = obj->invoice;
7955                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7956                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7957                 }
7958                 case LDKPaymentError_Routing: {
7959                         LDKLightningError routing_var = obj->routing;
7960                         int64_t routing_ref = 0;
7961                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7962                         routing_ref = tag_ptr(routing_var.inner, false);
7963                         return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7964                 }
7965                 case LDKPaymentError_Sending: {
7966                         int64_t sending_ref = tag_ptr(&obj->sending, false);
7967                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7968                 }
7969                 default: abort();
7970         }
7971 }
7972 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7973 CHECK(owner->result_ok);
7974         return ThirtyTwoBytes_clone(&*owner->contents.result);
7975 }
7976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7977         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7978         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7979         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7980         return ret_arr;
7981 }
7982
7983 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7984 CHECK(!owner->result_ok);
7985         return PaymentError_clone(&*owner->contents.err);
7986 }
7987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7988         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7989         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7990         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7991         int64_t ret_ref = tag_ptr(ret_copy, true);
7992         return ret_ref;
7993 }
7994
7995 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
7996         LDKInFlightHtlcs ret = *owner->contents.result;
7997         ret.is_owned = false;
7998         return ret;
7999 }
8000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8001         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
8002         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
8003         int64_t ret_ref = 0;
8004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8006         return ret_ref;
8007 }
8008
8009 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
8010         LDKDecodeError ret = *owner->contents.err;
8011         ret.is_owned = false;
8012         return ret;
8013 }
8014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8015         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
8016         LDKDecodeError ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
8017         int64_t ret_ref = 0;
8018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8020         return ret_ref;
8021 }
8022
8023 static jclass LDKParseError_Bech32Error_class = NULL;
8024 static jmethodID LDKParseError_Bech32Error_meth = NULL;
8025 static jclass LDKParseError_ParseAmountError_class = NULL;
8026 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
8027 static jclass LDKParseError_MalformedSignature_class = NULL;
8028 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
8029 static jclass LDKParseError_BadPrefix_class = NULL;
8030 static jmethodID LDKParseError_BadPrefix_meth = NULL;
8031 static jclass LDKParseError_UnknownCurrency_class = NULL;
8032 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
8033 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
8034 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
8035 static jclass LDKParseError_MalformedHRP_class = NULL;
8036 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
8037 static jclass LDKParseError_TooShortDataPart_class = NULL;
8038 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
8039 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
8040 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
8041 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
8042 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
8043 static jclass LDKParseError_PaddingError_class = NULL;
8044 static jmethodID LDKParseError_PaddingError_meth = NULL;
8045 static jclass LDKParseError_IntegerOverflowError_class = NULL;
8046 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
8047 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
8048 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
8049 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
8050 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
8051 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
8052 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
8053 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
8054 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
8055 static jclass LDKParseError_InvalidSliceLength_class = NULL;
8056 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
8057 static jclass LDKParseError_Skip_class = NULL;
8058 static jmethodID LDKParseError_Skip_meth = NULL;
8059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
8060         LDKParseError_Bech32Error_class =
8061                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
8062         CHECK(LDKParseError_Bech32Error_class != NULL);
8063         LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
8064         CHECK(LDKParseError_Bech32Error_meth != NULL);
8065         LDKParseError_ParseAmountError_class =
8066                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
8067         CHECK(LDKParseError_ParseAmountError_class != NULL);
8068         LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
8069         CHECK(LDKParseError_ParseAmountError_meth != NULL);
8070         LDKParseError_MalformedSignature_class =
8071                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
8072         CHECK(LDKParseError_MalformedSignature_class != NULL);
8073         LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
8074         CHECK(LDKParseError_MalformedSignature_meth != NULL);
8075         LDKParseError_BadPrefix_class =
8076                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
8077         CHECK(LDKParseError_BadPrefix_class != NULL);
8078         LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
8079         CHECK(LDKParseError_BadPrefix_meth != NULL);
8080         LDKParseError_UnknownCurrency_class =
8081                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
8082         CHECK(LDKParseError_UnknownCurrency_class != NULL);
8083         LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
8084         CHECK(LDKParseError_UnknownCurrency_meth != NULL);
8085         LDKParseError_UnknownSiPrefix_class =
8086                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
8087         CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
8088         LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
8089         CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
8090         LDKParseError_MalformedHRP_class =
8091                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
8092         CHECK(LDKParseError_MalformedHRP_class != NULL);
8093         LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
8094         CHECK(LDKParseError_MalformedHRP_meth != NULL);
8095         LDKParseError_TooShortDataPart_class =
8096                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
8097         CHECK(LDKParseError_TooShortDataPart_class != NULL);
8098         LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
8099         CHECK(LDKParseError_TooShortDataPart_meth != NULL);
8100         LDKParseError_UnexpectedEndOfTaggedFields_class =
8101                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
8102         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
8103         LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
8104         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
8105         LDKParseError_DescriptionDecodeError_class =
8106                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
8107         CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
8108         LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
8109         CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
8110         LDKParseError_PaddingError_class =
8111                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
8112         CHECK(LDKParseError_PaddingError_class != NULL);
8113         LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
8114         CHECK(LDKParseError_PaddingError_meth != NULL);
8115         LDKParseError_IntegerOverflowError_class =
8116                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
8117         CHECK(LDKParseError_IntegerOverflowError_class != NULL);
8118         LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
8119         CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
8120         LDKParseError_InvalidSegWitProgramLength_class =
8121                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
8122         CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
8123         LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
8124         CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
8125         LDKParseError_InvalidPubKeyHashLength_class =
8126                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
8127         CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
8128         LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
8129         CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
8130         LDKParseError_InvalidScriptHashLength_class =
8131                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
8132         CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
8133         LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
8134         CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
8135         LDKParseError_InvalidRecoveryId_class =
8136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
8137         CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
8138         LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
8139         CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
8140         LDKParseError_InvalidSliceLength_class =
8141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
8142         CHECK(LDKParseError_InvalidSliceLength_class != NULL);
8143         LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
8144         CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
8145         LDKParseError_Skip_class =
8146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
8147         CHECK(LDKParseError_Skip_class != NULL);
8148         LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
8149         CHECK(LDKParseError_Skip_meth != NULL);
8150 }
8151 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8152         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
8153         switch(obj->tag) {
8154                 case LDKParseError_Bech32Error: {
8155                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
8156                         return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
8157                 }
8158                 case LDKParseError_ParseAmountError: {
8159                         /*obj->parse_amount_error*/
8160                         return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
8161                 }
8162                 case LDKParseError_MalformedSignature: {
8163                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
8164                         return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
8165                 }
8166                 case LDKParseError_BadPrefix: {
8167                         return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
8168                 }
8169                 case LDKParseError_UnknownCurrency: {
8170                         return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
8171                 }
8172                 case LDKParseError_UnknownSiPrefix: {
8173                         return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
8174                 }
8175                 case LDKParseError_MalformedHRP: {
8176                         return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
8177                 }
8178                 case LDKParseError_TooShortDataPart: {
8179                         return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
8180                 }
8181                 case LDKParseError_UnexpectedEndOfTaggedFields: {
8182                         return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
8183                 }
8184                 case LDKParseError_DescriptionDecodeError: {
8185                         /*obj->description_decode_error*/
8186                         return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
8187                 }
8188                 case LDKParseError_PaddingError: {
8189                         return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
8190                 }
8191                 case LDKParseError_IntegerOverflowError: {
8192                         return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
8193                 }
8194                 case LDKParseError_InvalidSegWitProgramLength: {
8195                         return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
8196                 }
8197                 case LDKParseError_InvalidPubKeyHashLength: {
8198                         return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
8199                 }
8200                 case LDKParseError_InvalidScriptHashLength: {
8201                         return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
8202                 }
8203                 case LDKParseError_InvalidRecoveryId: {
8204                         return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
8205                 }
8206                 case LDKParseError_InvalidSliceLength: {
8207                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
8208                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
8209                         return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
8210                 }
8211                 case LDKParseError_Skip: {
8212                         return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
8213                 }
8214                 default: abort();
8215         }
8216 }
8217 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
8218 CHECK(owner->result_ok);
8219         return SiPrefix_clone(&*owner->contents.result);
8220 }
8221 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8222         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
8223         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
8224         return ret_conv;
8225 }
8226
8227 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
8228 CHECK(!owner->result_ok);
8229         return ParseError_clone(&*owner->contents.err);
8230 }
8231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8232         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
8233         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
8234         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
8235         int64_t ret_ref = tag_ptr(ret_copy, true);
8236         return ret_ref;
8237 }
8238
8239 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
8240 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
8241 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
8242 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
8243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
8244         LDKParseOrSemanticError_ParseError_class =
8245                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
8246         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
8247         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
8248         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
8249         LDKParseOrSemanticError_SemanticError_class =
8250                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
8251         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
8252         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
8253         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
8254 }
8255 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8256         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
8257         switch(obj->tag) {
8258                 case LDKParseOrSemanticError_ParseError: {
8259                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
8260                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
8261                 }
8262                 case LDKParseOrSemanticError_SemanticError: {
8263                         jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
8264                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
8265                 }
8266                 default: abort();
8267         }
8268 }
8269 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
8270         LDKInvoice ret = *owner->contents.result;
8271         ret.is_owned = false;
8272         return ret;
8273 }
8274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8275         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
8276         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
8277         int64_t ret_ref = 0;
8278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8280         return ret_ref;
8281 }
8282
8283 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
8284 CHECK(!owner->result_ok);
8285         return ParseOrSemanticError_clone(&*owner->contents.err);
8286 }
8287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8288         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
8289         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
8290         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
8291         int64_t ret_ref = tag_ptr(ret_copy, true);
8292         return ret_ref;
8293 }
8294
8295 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
8296         LDKSignedRawInvoice ret = *owner->contents.result;
8297         ret.is_owned = false;
8298         return ret;
8299 }
8300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8301         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
8302         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
8303         int64_t ret_ref = 0;
8304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8306         return ret_ref;
8307 }
8308
8309 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
8310 CHECK(!owner->result_ok);
8311         return ParseError_clone(&*owner->contents.err);
8312 }
8313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8314         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
8315         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
8316         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
8317         int64_t ret_ref = tag_ptr(ret_copy, true);
8318         return ret_ref;
8319 }
8320
8321 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8322         LDKRawInvoice ret = owner->a;
8323         ret.is_owned = false;
8324         return ret;
8325 }
8326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8327         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8328         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
8329         int64_t ret_ref = 0;
8330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8332         return ret_ref;
8333 }
8334
8335 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8336         return ThirtyTwoBytes_clone(&owner->b);
8337 }
8338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8339         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8340         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8341         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
8342         return ret_arr;
8343 }
8344
8345 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
8346         LDKInvoiceSignature ret = owner->c;
8347         ret.is_owned = false;
8348         return ret;
8349 }
8350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
8351         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
8352         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
8353         int64_t ret_ref = 0;
8354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8356         return ret_ref;
8357 }
8358
8359 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8360         LDKPayeePubKey ret = *owner->contents.result;
8361         ret.is_owned = false;
8362         return ret;
8363 }
8364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8365         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
8366         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
8367         int64_t ret_ref = 0;
8368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8370         return ret_ref;
8371 }
8372
8373 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
8374 CHECK(!owner->result_ok);
8375         return *owner->contents.err;
8376 }
8377 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8378         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
8379         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
8380         return ret_conv;
8381 }
8382
8383 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
8384         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
8385         for (size_t i = 0; i < ret.datalen; i++) {
8386                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
8387         }
8388         return ret;
8389 }
8390 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8391         LDKPositiveTimestamp ret = *owner->contents.result;
8392         ret.is_owned = false;
8393         return ret;
8394 }
8395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8396         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
8397         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
8398         int64_t ret_ref = 0;
8399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8401         return ret_ref;
8402 }
8403
8404 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
8405 CHECK(!owner->result_ok);
8406         return CreationError_clone(&*owner->contents.err);
8407 }
8408 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8409         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
8410         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
8411         return ret_conv;
8412 }
8413
8414 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8415 CHECK(owner->result_ok);
8416         return *owner->contents.result;
8417 }
8418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8419         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
8420         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
8421 }
8422
8423 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
8424 CHECK(!owner->result_ok);
8425         return SemanticError_clone(&*owner->contents.err);
8426 }
8427 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8428         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
8429         jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
8430         return ret_conv;
8431 }
8432
8433 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8434         LDKInvoice ret = *owner->contents.result;
8435         ret.is_owned = false;
8436         return ret;
8437 }
8438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8439         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
8440         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
8441         int64_t ret_ref = 0;
8442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8444         return ret_ref;
8445 }
8446
8447 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
8448 CHECK(!owner->result_ok);
8449         return SemanticError_clone(&*owner->contents.err);
8450 }
8451 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8452         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
8453         jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
8454         return ret_conv;
8455 }
8456
8457 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8458         LDKDescription ret = *owner->contents.result;
8459         ret.is_owned = false;
8460         return ret;
8461 }
8462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8463         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
8464         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
8465         int64_t ret_ref = 0;
8466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8468         return ret_ref;
8469 }
8470
8471 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
8472 CHECK(!owner->result_ok);
8473         return CreationError_clone(&*owner->contents.err);
8474 }
8475 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8476         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
8477         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
8478         return ret_conv;
8479 }
8480
8481 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
8482         LDKPrivateRoute ret = *owner->contents.result;
8483         ret.is_owned = false;
8484         return ret;
8485 }
8486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8487         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
8488         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
8489         int64_t ret_ref = 0;
8490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8492         return ret_ref;
8493 }
8494
8495 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
8496 CHECK(!owner->result_ok);
8497         return CreationError_clone(&*owner->contents.err);
8498 }
8499 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8500         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
8501         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
8502         return ret_conv;
8503 }
8504
8505 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8506 CHECK(owner->result_ok);
8507         return *owner->contents.result;
8508 }
8509 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8510         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
8511         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
8512         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8513         return ret_conv;
8514 }
8515
8516 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
8517 CHECK(!owner->result_ok);
8518         return *owner->contents.err;
8519 }
8520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8521         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
8522         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
8523         return ret_conv;
8524 }
8525
8526 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8527         LDKChannelMonitorUpdate ret = *owner->contents.result;
8528         ret.is_owned = false;
8529         return ret;
8530 }
8531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8532         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8533         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8534         int64_t ret_ref = 0;
8535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8537         return ret_ref;
8538 }
8539
8540 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8541         LDKDecodeError ret = *owner->contents.err;
8542         ret.is_owned = false;
8543         return ret;
8544 }
8545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8546         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8547         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8548         int64_t ret_ref = 0;
8549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8551         return ret_ref;
8552 }
8553
8554 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
8555 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
8556 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
8557 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
8558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
8559         LDKCOption_MonitorEventZ_Some_class =
8560                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
8561         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
8562         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
8563         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
8564         LDKCOption_MonitorEventZ_None_class =
8565                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
8566         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
8567         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
8568         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
8569 }
8570 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8571         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
8572         switch(obj->tag) {
8573                 case LDKCOption_MonitorEventZ_Some: {
8574                         int64_t some_ref = tag_ptr(&obj->some, false);
8575                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
8576                 }
8577                 case LDKCOption_MonitorEventZ_None: {
8578                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
8579                 }
8580                 default: abort();
8581         }
8582 }
8583 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8584 CHECK(owner->result_ok);
8585         return COption_MonitorEventZ_clone(&*owner->contents.result);
8586 }
8587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8588         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8589         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8590         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8591         int64_t ret_ref = tag_ptr(ret_copy, true);
8592         return ret_ref;
8593 }
8594
8595 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8596         LDKDecodeError ret = *owner->contents.err;
8597         ret.is_owned = false;
8598         return ret;
8599 }
8600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8601         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8602         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8603         int64_t ret_ref = 0;
8604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8606         return ret_ref;
8607 }
8608
8609 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8610         LDKHTLCUpdate ret = *owner->contents.result;
8611         ret.is_owned = false;
8612         return ret;
8613 }
8614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8615         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8616         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8617         int64_t ret_ref = 0;
8618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8620         return ret_ref;
8621 }
8622
8623 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8624         LDKDecodeError ret = *owner->contents.err;
8625         ret.is_owned = false;
8626         return ret;
8627 }
8628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8629         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8630         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8631         int64_t ret_ref = 0;
8632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8634         return ret_ref;
8635 }
8636
8637 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8638         LDKOutPoint ret = owner->a;
8639         ret.is_owned = false;
8640         return ret;
8641 }
8642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8643         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
8644         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
8645         int64_t ret_ref = 0;
8646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8648         return ret_ref;
8649 }
8650
8651 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8652         return CVec_u8Z_clone(&owner->b);
8653 }
8654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8655         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
8656         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
8657         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8658         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8659         CVec_u8Z_free(ret_var);
8660         return ret_arr;
8661 }
8662
8663 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8664         return owner->a;
8665 }
8666 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8667         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
8668         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
8669         return ret_conv;
8670 }
8671
8672 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8673         return CVec_u8Z_clone(&owner->b);
8674 }
8675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8676         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
8677         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
8678         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8679         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8680         CVec_u8Z_free(ret_var);
8681         return ret_arr;
8682 }
8683
8684 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
8685         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
8686         for (size_t i = 0; i < ret.datalen; i++) {
8687                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
8688         }
8689         return ret;
8690 }
8691 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8692         return ThirtyTwoBytes_clone(&owner->a);
8693 }
8694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8695         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
8696         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8697         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
8698         return ret_arr;
8699 }
8700
8701 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8702         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
8703 }
8704 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8705         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
8706         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
8707         int64_tArray ret_arr = NULL;
8708         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8709         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8710         for (size_t v = 0; v < ret_var.datalen; v++) {
8711                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8712                 *ret_conv_21_conv = ret_var.data[v];
8713                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
8714         }
8715         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8716         FREE(ret_var.data);
8717         return ret_arr;
8718 }
8719
8720 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8721         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 };
8722         for (size_t i = 0; i < ret.datalen; i++) {
8723                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8724         }
8725         return ret;
8726 }
8727 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
8728         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
8729         for (size_t i = 0; i < ret.datalen; i++) {
8730                 ret.data[i] = Event_clone(&orig->data[i]);
8731         }
8732         return ret;
8733 }
8734 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8735         return owner->a;
8736 }
8737 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8738         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8739         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8740         return ret_conv;
8741 }
8742
8743 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8744         return TxOut_clone(&owner->b);
8745 }
8746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8747         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8748         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8749         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8750         return tag_ptr(ret_ref, true);
8751 }
8752
8753 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8754         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8755         for (size_t i = 0; i < ret.datalen; i++) {
8756                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8757         }
8758         return ret;
8759 }
8760 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8761         return ThirtyTwoBytes_clone(&owner->a);
8762 }
8763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8764         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8765         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8766         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
8767         return ret_arr;
8768 }
8769
8770 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8771         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8772 }
8773 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8774         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8775         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8776         int64_tArray ret_arr = NULL;
8777         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8778         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8779         for (size_t u = 0; u < ret_var.datalen; u++) {
8780                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8781                 *ret_conv_20_conv = ret_var.data[u];
8782                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
8783         }
8784         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8785         FREE(ret_var.data);
8786         return ret_arr;
8787 }
8788
8789 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8790         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 };
8791         for (size_t i = 0; i < ret.datalen; i++) {
8792                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8793         }
8794         return ret;
8795 }
8796 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
8797 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
8798 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
8799 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
8800 static jclass LDKBalance_ContentiousClaimable_class = NULL;
8801 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
8802 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
8803 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
8804 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
8805 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
8806 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
8807 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
8808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
8809         LDKBalance_ClaimableOnChannelClose_class =
8810                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
8811         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
8812         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
8813         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
8814         LDKBalance_ClaimableAwaitingConfirmations_class =
8815                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
8816         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
8817         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
8818         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
8819         LDKBalance_ContentiousClaimable_class =
8820                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
8821         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
8822         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
8823         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
8824         LDKBalance_MaybeTimeoutClaimableHTLC_class =
8825                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
8826         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
8827         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI)V");
8828         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
8829         LDKBalance_MaybePreimageClaimableHTLC_class =
8830                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
8831         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
8832         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI)V");
8833         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
8834         LDKBalance_CounterpartyRevokedOutputClaimable_class =
8835                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
8836         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
8837         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
8838         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
8839 }
8840 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8841         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8842         switch(obj->tag) {
8843                 case LDKBalance_ClaimableOnChannelClose: {
8844                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
8845                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
8846                 }
8847                 case LDKBalance_ClaimableAwaitingConfirmations: {
8848                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
8849                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8850                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
8851                 }
8852                 case LDKBalance_ContentiousClaimable: {
8853                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
8854                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8855                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
8856                 }
8857                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
8858                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
8859                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
8860                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, claimable_amount_satoshis_conv, claimable_height_conv);
8861                 }
8862                 case LDKBalance_MaybePreimageClaimableHTLC: {
8863                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
8864                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
8865                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, claimable_amount_satoshis_conv, expiry_height_conv);
8866                 }
8867                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
8868                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
8869                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, claimable_amount_satoshis_conv);
8870                 }
8871                 default: abort();
8872         }
8873 }
8874 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8875         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8876         for (size_t i = 0; i < ret.datalen; i++) {
8877                 ret.data[i] = Balance_clone(&orig->data[i]);
8878         }
8879         return ret;
8880 }
8881 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8882 CHECK(owner->result_ok);
8883         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8884 }
8885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8886         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8887         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8888         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8889         return tag_ptr(ret_conv, true);
8890 }
8891
8892 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8893         LDKDecodeError ret = *owner->contents.err;
8894         ret.is_owned = false;
8895         return ret;
8896 }
8897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8898         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8899         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8900         int64_t ret_ref = 0;
8901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8903         return ret_ref;
8904 }
8905
8906 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8907         return owner->a;
8908 }
8909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8910         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8911         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8912         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
8913         return ret_arr;
8914 }
8915
8916 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8917         return Type_clone(&owner->b);
8918 }
8919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8920         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8921         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8922         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8923         return tag_ptr(ret_ret, true);
8924 }
8925
8926 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8927         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8928         for (size_t i = 0; i < ret.datalen; i++) {
8929                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8930         }
8931         return ret;
8932 }
8933 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
8934 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
8935 static jclass LDKCOption_NetAddressZ_None_class = NULL;
8936 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
8937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
8938         LDKCOption_NetAddressZ_Some_class =
8939                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
8940         CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
8941         LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
8942         CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
8943         LDKCOption_NetAddressZ_None_class =
8944                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
8945         CHECK(LDKCOption_NetAddressZ_None_class != NULL);
8946         LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
8947         CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
8948 }
8949 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8950         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
8951         switch(obj->tag) {
8952                 case LDKCOption_NetAddressZ_Some: {
8953                         int64_t some_ref = tag_ptr(&obj->some, false);
8954                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
8955                 }
8956                 case LDKCOption_NetAddressZ_None: {
8957                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
8958                 }
8959                 default: abort();
8960         }
8961 }
8962 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8963 CHECK(owner->result_ok);
8964         return CVec_u8Z_clone(&*owner->contents.result);
8965 }
8966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8967         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8968         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8969         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8970         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8971         CVec_u8Z_free(ret_var);
8972         return ret_arr;
8973 }
8974
8975 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8976         LDKPeerHandleError ret = *owner->contents.err;
8977         ret.is_owned = false;
8978         return ret;
8979 }
8980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8981         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8982         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8983         int64_t ret_ref = 0;
8984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8986         return ret_ref;
8987 }
8988
8989 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8990 CHECK(owner->result_ok);
8991         return *owner->contents.result;
8992 }
8993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8994         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8995         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8996 }
8997
8998 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8999         LDKPeerHandleError ret = *owner->contents.err;
9000         ret.is_owned = false;
9001         return ret;
9002 }
9003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9004         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9005         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
9006         int64_t ret_ref = 0;
9007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9009         return ret_ref;
9010 }
9011
9012 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9013 CHECK(owner->result_ok);
9014         return *owner->contents.result;
9015 }
9016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9017         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9018         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
9019         return ret_conv;
9020 }
9021
9022 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9023         LDKPeerHandleError ret = *owner->contents.err;
9024         ret.is_owned = false;
9025         return ret;
9026 }
9027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9028         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9029         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
9030         int64_t ret_ref = 0;
9031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9033         return ret_ref;
9034 }
9035
9036 static jclass LDKSendError_Secp256k1_class = NULL;
9037 static jmethodID LDKSendError_Secp256k1_meth = NULL;
9038 static jclass LDKSendError_TooBigPacket_class = NULL;
9039 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
9040 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
9041 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
9042 static jclass LDKSendError_InvalidFirstHop_class = NULL;
9043 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
9044 static jclass LDKSendError_BufferFull_class = NULL;
9045 static jmethodID LDKSendError_BufferFull_meth = NULL;
9046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
9047         LDKSendError_Secp256k1_class =
9048                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
9049         CHECK(LDKSendError_Secp256k1_class != NULL);
9050         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
9051         CHECK(LDKSendError_Secp256k1_meth != NULL);
9052         LDKSendError_TooBigPacket_class =
9053                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
9054         CHECK(LDKSendError_TooBigPacket_class != NULL);
9055         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
9056         CHECK(LDKSendError_TooBigPacket_meth != NULL);
9057         LDKSendError_TooFewBlindedHops_class =
9058                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
9059         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
9060         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
9061         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
9062         LDKSendError_InvalidFirstHop_class =
9063                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
9064         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
9065         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
9066         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
9067         LDKSendError_BufferFull_class =
9068                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
9069         CHECK(LDKSendError_BufferFull_class != NULL);
9070         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
9071         CHECK(LDKSendError_BufferFull_meth != NULL);
9072 }
9073 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9074         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
9075         switch(obj->tag) {
9076                 case LDKSendError_Secp256k1: {
9077                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
9078                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
9079                 }
9080                 case LDKSendError_TooBigPacket: {
9081                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
9082                 }
9083                 case LDKSendError_TooFewBlindedHops: {
9084                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
9085                 }
9086                 case LDKSendError_InvalidFirstHop: {
9087                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
9088                 }
9089                 case LDKSendError_BufferFull: {
9090                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
9091                 }
9092                 default: abort();
9093         }
9094 }
9095 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
9096 CHECK(owner->result_ok);
9097         return *owner->contents.result;
9098 }
9099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9100         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
9101         CResult_NoneSendErrorZ_get_ok(owner_conv);
9102 }
9103
9104 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
9105 CHECK(!owner->result_ok);
9106         return SendError_clone(&*owner->contents.err);
9107 }
9108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9109         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
9110         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
9111         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
9112         int64_t ret_ref = tag_ptr(ret_copy, true);
9113         return ret_ref;
9114 }
9115
9116 static jclass LDKGraphSyncError_DecodeError_class = NULL;
9117 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
9118 static jclass LDKGraphSyncError_LightningError_class = NULL;
9119 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
9120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
9121         LDKGraphSyncError_DecodeError_class =
9122                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
9123         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
9124         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
9125         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
9126         LDKGraphSyncError_LightningError_class =
9127                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
9128         CHECK(LDKGraphSyncError_LightningError_class != NULL);
9129         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
9130         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
9131 }
9132 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9133         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
9134         switch(obj->tag) {
9135                 case LDKGraphSyncError_DecodeError: {
9136                         LDKDecodeError decode_error_var = obj->decode_error;
9137                         int64_t decode_error_ref = 0;
9138                         CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
9139                         decode_error_ref = tag_ptr(decode_error_var.inner, false);
9140                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
9141                 }
9142                 case LDKGraphSyncError_LightningError: {
9143                         LDKLightningError lightning_error_var = obj->lightning_error;
9144                         int64_t lightning_error_ref = 0;
9145                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
9146                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
9147                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
9148                 }
9149                 default: abort();
9150         }
9151 }
9152 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9153 CHECK(owner->result_ok);
9154         return *owner->contents.result;
9155 }
9156 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9157         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9158         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
9159         return ret_conv;
9160 }
9161
9162 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9163 CHECK(!owner->result_ok);
9164         return GraphSyncError_clone(&*owner->contents.err);
9165 }
9166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9167         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9168         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
9169         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
9170         int64_t ret_ref = tag_ptr(ret_copy, true);
9171         return ret_ref;
9172 }
9173
9174 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
9175 CHECK(owner->result_ok);
9176         return NetAddress_clone(&*owner->contents.result);
9177 }
9178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9179         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
9180         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9181         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
9182         int64_t ret_ref = tag_ptr(ret_copy, true);
9183         return ret_ref;
9184 }
9185
9186 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
9187         LDKDecodeError ret = *owner->contents.err;
9188         ret.is_owned = false;
9189         return ret;
9190 }
9191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9192         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
9193         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
9194         int64_t ret_ref = 0;
9195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9197         return ret_ref;
9198 }
9199
9200 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
9201         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
9202         for (size_t i = 0; i < ret.datalen; i++) {
9203                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
9204         }
9205         return ret;
9206 }
9207 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
9208         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
9209         for (size_t i = 0; i < ret.datalen; i++) {
9210                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
9211         }
9212         return ret;
9213 }
9214 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
9215         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
9216         for (size_t i = 0; i < ret.datalen; i++) {
9217                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
9218         }
9219         return ret;
9220 }
9221 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
9222         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
9223         for (size_t i = 0; i < ret.datalen; i++) {
9224                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
9225         }
9226         return ret;
9227 }
9228 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9229         LDKAcceptChannel ret = *owner->contents.result;
9230         ret.is_owned = false;
9231         return ret;
9232 }
9233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9234         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9235         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
9236         int64_t ret_ref = 0;
9237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9239         return ret_ref;
9240 }
9241
9242 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9243         LDKDecodeError ret = *owner->contents.err;
9244         ret.is_owned = false;
9245         return ret;
9246 }
9247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9248         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9249         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
9250         int64_t ret_ref = 0;
9251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9253         return ret_ref;
9254 }
9255
9256 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9257         LDKAnnouncementSignatures ret = *owner->contents.result;
9258         ret.is_owned = false;
9259         return ret;
9260 }
9261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9262         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9263         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9264         int64_t ret_ref = 0;
9265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9267         return ret_ref;
9268 }
9269
9270 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9271         LDKDecodeError ret = *owner->contents.err;
9272         ret.is_owned = false;
9273         return ret;
9274 }
9275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9276         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9277         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9278         int64_t ret_ref = 0;
9279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9281         return ret_ref;
9282 }
9283
9284 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9285         LDKChannelReestablish ret = *owner->contents.result;
9286         ret.is_owned = false;
9287         return ret;
9288 }
9289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9290         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9291         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9292         int64_t ret_ref = 0;
9293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9295         return ret_ref;
9296 }
9297
9298 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9299         LDKDecodeError ret = *owner->contents.err;
9300         ret.is_owned = false;
9301         return ret;
9302 }
9303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9304         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9305         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9306         int64_t ret_ref = 0;
9307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9309         return ret_ref;
9310 }
9311
9312 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9313         LDKClosingSigned ret = *owner->contents.result;
9314         ret.is_owned = false;
9315         return ret;
9316 }
9317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9318         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9319         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9320         int64_t ret_ref = 0;
9321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9323         return ret_ref;
9324 }
9325
9326 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9327         LDKDecodeError ret = *owner->contents.err;
9328         ret.is_owned = false;
9329         return ret;
9330 }
9331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9332         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9333         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9334         int64_t ret_ref = 0;
9335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9337         return ret_ref;
9338 }
9339
9340 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9341         LDKClosingSignedFeeRange ret = *owner->contents.result;
9342         ret.is_owned = false;
9343         return ret;
9344 }
9345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9346         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9347         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9348         int64_t ret_ref = 0;
9349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9351         return ret_ref;
9352 }
9353
9354 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9355         LDKDecodeError ret = *owner->contents.err;
9356         ret.is_owned = false;
9357         return ret;
9358 }
9359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9360         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9361         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9362         int64_t ret_ref = 0;
9363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9365         return ret_ref;
9366 }
9367
9368 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9369         LDKCommitmentSigned ret = *owner->contents.result;
9370         ret.is_owned = false;
9371         return ret;
9372 }
9373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9374         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9375         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9376         int64_t ret_ref = 0;
9377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9379         return ret_ref;
9380 }
9381
9382 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9383         LDKDecodeError ret = *owner->contents.err;
9384         ret.is_owned = false;
9385         return ret;
9386 }
9387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9388         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9389         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9390         int64_t ret_ref = 0;
9391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9393         return ret_ref;
9394 }
9395
9396 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9397         LDKFundingCreated ret = *owner->contents.result;
9398         ret.is_owned = false;
9399         return ret;
9400 }
9401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9402         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9403         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9404         int64_t ret_ref = 0;
9405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9407         return ret_ref;
9408 }
9409
9410 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9411         LDKDecodeError ret = *owner->contents.err;
9412         ret.is_owned = false;
9413         return ret;
9414 }
9415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9416         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9417         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9418         int64_t ret_ref = 0;
9419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9421         return ret_ref;
9422 }
9423
9424 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9425         LDKFundingSigned ret = *owner->contents.result;
9426         ret.is_owned = false;
9427         return ret;
9428 }
9429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9430         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9431         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9432         int64_t ret_ref = 0;
9433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9435         return ret_ref;
9436 }
9437
9438 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9439         LDKDecodeError ret = *owner->contents.err;
9440         ret.is_owned = false;
9441         return ret;
9442 }
9443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9444         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9445         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9446         int64_t ret_ref = 0;
9447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9449         return ret_ref;
9450 }
9451
9452 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9453         LDKChannelReady ret = *owner->contents.result;
9454         ret.is_owned = false;
9455         return ret;
9456 }
9457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9458         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9459         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9460         int64_t ret_ref = 0;
9461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9463         return ret_ref;
9464 }
9465
9466 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9467         LDKDecodeError ret = *owner->contents.err;
9468         ret.is_owned = false;
9469         return ret;
9470 }
9471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9472         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9473         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9474         int64_t ret_ref = 0;
9475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9477         return ret_ref;
9478 }
9479
9480 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9481         LDKInit ret = *owner->contents.result;
9482         ret.is_owned = false;
9483         return ret;
9484 }
9485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9486         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9487         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9488         int64_t ret_ref = 0;
9489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9491         return ret_ref;
9492 }
9493
9494 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9495         LDKDecodeError ret = *owner->contents.err;
9496         ret.is_owned = false;
9497         return ret;
9498 }
9499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9500         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9501         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
9502         int64_t ret_ref = 0;
9503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9505         return ret_ref;
9506 }
9507
9508 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9509         LDKOpenChannel ret = *owner->contents.result;
9510         ret.is_owned = false;
9511         return ret;
9512 }
9513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9514         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9515         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9516         int64_t ret_ref = 0;
9517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9519         return ret_ref;
9520 }
9521
9522 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9523         LDKDecodeError ret = *owner->contents.err;
9524         ret.is_owned = false;
9525         return ret;
9526 }
9527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9528         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9529         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9530         int64_t ret_ref = 0;
9531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9533         return ret_ref;
9534 }
9535
9536 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9537         LDKRevokeAndACK ret = *owner->contents.result;
9538         ret.is_owned = false;
9539         return ret;
9540 }
9541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9542         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9543         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9544         int64_t ret_ref = 0;
9545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9547         return ret_ref;
9548 }
9549
9550 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9551         LDKDecodeError ret = *owner->contents.err;
9552         ret.is_owned = false;
9553         return ret;
9554 }
9555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9556         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9557         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9558         int64_t ret_ref = 0;
9559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9561         return ret_ref;
9562 }
9563
9564 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9565         LDKShutdown ret = *owner->contents.result;
9566         ret.is_owned = false;
9567         return ret;
9568 }
9569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9570         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9571         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9572         int64_t ret_ref = 0;
9573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9575         return ret_ref;
9576 }
9577
9578 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9579         LDKDecodeError ret = *owner->contents.err;
9580         ret.is_owned = false;
9581         return ret;
9582 }
9583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9584         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9585         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9586         int64_t ret_ref = 0;
9587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9589         return ret_ref;
9590 }
9591
9592 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9593         LDKUpdateFailHTLC ret = *owner->contents.result;
9594         ret.is_owned = false;
9595         return ret;
9596 }
9597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9598         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9599         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9600         int64_t ret_ref = 0;
9601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9603         return ret_ref;
9604 }
9605
9606 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9607         LDKDecodeError ret = *owner->contents.err;
9608         ret.is_owned = false;
9609         return ret;
9610 }
9611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9612         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9613         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9614         int64_t ret_ref = 0;
9615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9617         return ret_ref;
9618 }
9619
9620 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9621         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9622         ret.is_owned = false;
9623         return ret;
9624 }
9625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9626         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9627         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9628         int64_t ret_ref = 0;
9629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9631         return ret_ref;
9632 }
9633
9634 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9635         LDKDecodeError ret = *owner->contents.err;
9636         ret.is_owned = false;
9637         return ret;
9638 }
9639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9640         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9641         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9642         int64_t ret_ref = 0;
9643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9645         return ret_ref;
9646 }
9647
9648 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9649         LDKUpdateFee ret = *owner->contents.result;
9650         ret.is_owned = false;
9651         return ret;
9652 }
9653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9654         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9655         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9656         int64_t ret_ref = 0;
9657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9659         return ret_ref;
9660 }
9661
9662 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9663         LDKDecodeError ret = *owner->contents.err;
9664         ret.is_owned = false;
9665         return ret;
9666 }
9667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9668         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9669         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9670         int64_t ret_ref = 0;
9671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9673         return ret_ref;
9674 }
9675
9676 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9677         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9678         ret.is_owned = false;
9679         return ret;
9680 }
9681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9682         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9683         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9684         int64_t ret_ref = 0;
9685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9687         return ret_ref;
9688 }
9689
9690 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9691         LDKDecodeError ret = *owner->contents.err;
9692         ret.is_owned = false;
9693         return ret;
9694 }
9695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9696         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9697         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9698         int64_t ret_ref = 0;
9699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9701         return ret_ref;
9702 }
9703
9704 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9705         LDKUpdateAddHTLC ret = *owner->contents.result;
9706         ret.is_owned = false;
9707         return ret;
9708 }
9709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9710         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9711         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9712         int64_t ret_ref = 0;
9713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9715         return ret_ref;
9716 }
9717
9718 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9719         LDKDecodeError ret = *owner->contents.err;
9720         ret.is_owned = false;
9721         return ret;
9722 }
9723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9724         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9725         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9726         int64_t ret_ref = 0;
9727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9729         return ret_ref;
9730 }
9731
9732 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9733         LDKOnionMessage ret = *owner->contents.result;
9734         ret.is_owned = false;
9735         return ret;
9736 }
9737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9738         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9739         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9740         int64_t ret_ref = 0;
9741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9743         return ret_ref;
9744 }
9745
9746 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9747         LDKDecodeError ret = *owner->contents.err;
9748         ret.is_owned = false;
9749         return ret;
9750 }
9751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9752         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9753         LDKDecodeError ret_var = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9754         int64_t ret_ref = 0;
9755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9757         return ret_ref;
9758 }
9759
9760 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9761         LDKPing ret = *owner->contents.result;
9762         ret.is_owned = false;
9763         return ret;
9764 }
9765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9766         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9767         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9768         int64_t ret_ref = 0;
9769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9771         return ret_ref;
9772 }
9773
9774 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9775         LDKDecodeError ret = *owner->contents.err;
9776         ret.is_owned = false;
9777         return ret;
9778 }
9779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9780         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9781         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
9782         int64_t ret_ref = 0;
9783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9785         return ret_ref;
9786 }
9787
9788 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9789         LDKPong ret = *owner->contents.result;
9790         ret.is_owned = false;
9791         return ret;
9792 }
9793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9794         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9795         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9796         int64_t ret_ref = 0;
9797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9799         return ret_ref;
9800 }
9801
9802 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9803         LDKDecodeError ret = *owner->contents.err;
9804         ret.is_owned = false;
9805         return ret;
9806 }
9807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9808         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9809         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
9810         int64_t ret_ref = 0;
9811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9813         return ret_ref;
9814 }
9815
9816 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9817         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9818         ret.is_owned = false;
9819         return ret;
9820 }
9821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9822         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9823         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9824         int64_t ret_ref = 0;
9825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9827         return ret_ref;
9828 }
9829
9830 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9831         LDKDecodeError ret = *owner->contents.err;
9832         ret.is_owned = false;
9833         return ret;
9834 }
9835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9836         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9837         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9838         int64_t ret_ref = 0;
9839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9841         return ret_ref;
9842 }
9843
9844 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9845         LDKChannelAnnouncement ret = *owner->contents.result;
9846         ret.is_owned = false;
9847         return ret;
9848 }
9849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9850         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9851         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9852         int64_t ret_ref = 0;
9853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9855         return ret_ref;
9856 }
9857
9858 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9859         LDKDecodeError ret = *owner->contents.err;
9860         ret.is_owned = false;
9861         return ret;
9862 }
9863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9864         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9865         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9866         int64_t ret_ref = 0;
9867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9869         return ret_ref;
9870 }
9871
9872 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9873         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9874         ret.is_owned = false;
9875         return ret;
9876 }
9877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9878         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9879         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9880         int64_t ret_ref = 0;
9881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9883         return ret_ref;
9884 }
9885
9886 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9887         LDKDecodeError ret = *owner->contents.err;
9888         ret.is_owned = false;
9889         return ret;
9890 }
9891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9892         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9893         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9894         int64_t ret_ref = 0;
9895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9897         return ret_ref;
9898 }
9899
9900 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9901         LDKChannelUpdate ret = *owner->contents.result;
9902         ret.is_owned = false;
9903         return ret;
9904 }
9905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9906         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9907         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9908         int64_t ret_ref = 0;
9909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9911         return ret_ref;
9912 }
9913
9914 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9915         LDKDecodeError ret = *owner->contents.err;
9916         ret.is_owned = false;
9917         return ret;
9918 }
9919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9920         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9921         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9922         int64_t ret_ref = 0;
9923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9925         return ret_ref;
9926 }
9927
9928 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9929         LDKErrorMessage ret = *owner->contents.result;
9930         ret.is_owned = false;
9931         return ret;
9932 }
9933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9934         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9935         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9936         int64_t ret_ref = 0;
9937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9939         return ret_ref;
9940 }
9941
9942 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9943         LDKDecodeError ret = *owner->contents.err;
9944         ret.is_owned = false;
9945         return ret;
9946 }
9947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9948         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9949         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9950         int64_t ret_ref = 0;
9951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9953         return ret_ref;
9954 }
9955
9956 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9957         LDKWarningMessage ret = *owner->contents.result;
9958         ret.is_owned = false;
9959         return ret;
9960 }
9961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9962         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9963         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9964         int64_t ret_ref = 0;
9965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9967         return ret_ref;
9968 }
9969
9970 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9971         LDKDecodeError ret = *owner->contents.err;
9972         ret.is_owned = false;
9973         return ret;
9974 }
9975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9976         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9977         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9978         int64_t ret_ref = 0;
9979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9981         return ret_ref;
9982 }
9983
9984 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9985         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9986         ret.is_owned = false;
9987         return ret;
9988 }
9989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9990         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9991         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9992         int64_t ret_ref = 0;
9993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9995         return ret_ref;
9996 }
9997
9998 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9999         LDKDecodeError ret = *owner->contents.err;
10000         ret.is_owned = false;
10001         return ret;
10002 }
10003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10004         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10005         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10006         int64_t ret_ref = 0;
10007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10009         return ret_ref;
10010 }
10011
10012 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10013         LDKNodeAnnouncement ret = *owner->contents.result;
10014         ret.is_owned = false;
10015         return ret;
10016 }
10017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10018         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10019         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10020         int64_t ret_ref = 0;
10021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10023         return ret_ref;
10024 }
10025
10026 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10027         LDKDecodeError ret = *owner->contents.err;
10028         ret.is_owned = false;
10029         return ret;
10030 }
10031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10032         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10033         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10034         int64_t ret_ref = 0;
10035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10037         return ret_ref;
10038 }
10039
10040 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10041         LDKQueryShortChannelIds ret = *owner->contents.result;
10042         ret.is_owned = false;
10043         return ret;
10044 }
10045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10046         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10047         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
10048         int64_t ret_ref = 0;
10049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10051         return ret_ref;
10052 }
10053
10054 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10055         LDKDecodeError ret = *owner->contents.err;
10056         ret.is_owned = false;
10057         return ret;
10058 }
10059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10060         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10061         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
10062         int64_t ret_ref = 0;
10063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10065         return ret_ref;
10066 }
10067
10068 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10069         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
10070         ret.is_owned = false;
10071         return ret;
10072 }
10073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10074         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10075         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
10076         int64_t ret_ref = 0;
10077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10079         return ret_ref;
10080 }
10081
10082 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10083         LDKDecodeError ret = *owner->contents.err;
10084         ret.is_owned = false;
10085         return ret;
10086 }
10087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10088         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10089         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10090         int64_t ret_ref = 0;
10091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10093         return ret_ref;
10094 }
10095
10096 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10097         LDKQueryChannelRange ret = *owner->contents.result;
10098         ret.is_owned = false;
10099         return ret;
10100 }
10101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10102         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10103         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10104         int64_t ret_ref = 0;
10105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10107         return ret_ref;
10108 }
10109
10110 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10111         LDKDecodeError ret = *owner->contents.err;
10112         ret.is_owned = false;
10113         return ret;
10114 }
10115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10116         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10117         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10118         int64_t ret_ref = 0;
10119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10121         return ret_ref;
10122 }
10123
10124 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10125         LDKReplyChannelRange ret = *owner->contents.result;
10126         ret.is_owned = false;
10127         return ret;
10128 }
10129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10130         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10131         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10132         int64_t ret_ref = 0;
10133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10135         return ret_ref;
10136 }
10137
10138 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10139         LDKDecodeError ret = *owner->contents.err;
10140         ret.is_owned = false;
10141         return ret;
10142 }
10143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10144         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10145         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10146         int64_t ret_ref = 0;
10147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10149         return ret_ref;
10150 }
10151
10152 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10153         LDKGossipTimestampFilter ret = *owner->contents.result;
10154         ret.is_owned = false;
10155         return ret;
10156 }
10157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10158         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10159         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10160         int64_t ret_ref = 0;
10161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10163         return ret_ref;
10164 }
10165
10166 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10167         LDKDecodeError ret = *owner->contents.err;
10168         ret.is_owned = false;
10169         return ret;
10170 }
10171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10172         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10173         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10174         int64_t ret_ref = 0;
10175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10177         return ret_ref;
10178 }
10179
10180 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10181         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10182         for (size_t i = 0; i < ret.datalen; i++) {
10183                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10184         }
10185         return ret;
10186 }
10187 static jclass LDKSignOrCreationError_SignError_class = NULL;
10188 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
10189 static jclass LDKSignOrCreationError_CreationError_class = NULL;
10190 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
10191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
10192         LDKSignOrCreationError_SignError_class =
10193                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
10194         CHECK(LDKSignOrCreationError_SignError_class != NULL);
10195         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
10196         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
10197         LDKSignOrCreationError_CreationError_class =
10198                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
10199         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
10200         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
10201         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
10202 }
10203 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10204         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10205         switch(obj->tag) {
10206                 case LDKSignOrCreationError_SignError: {
10207                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
10208                 }
10209                 case LDKSignOrCreationError_CreationError: {
10210                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
10211                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
10212                 }
10213                 default: abort();
10214         }
10215 }
10216 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10217         LDKInvoice ret = *owner->contents.result;
10218         ret.is_owned = false;
10219         return ret;
10220 }
10221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10222         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10223         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10224         int64_t ret_ref = 0;
10225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10227         return ret_ref;
10228 }
10229
10230 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10231 CHECK(!owner->result_ok);
10232         return SignOrCreationError_clone(&*owner->contents.err);
10233 }
10234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10235         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10236         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10237         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10238         int64_t ret_ref = tag_ptr(ret_copy, true);
10239         return ret_ref;
10240 }
10241
10242 typedef struct LDKFilter_JCalls {
10243         atomic_size_t refcnt;
10244         JavaVM *vm;
10245         jweak o;
10246         jmethodID register_tx_meth;
10247         jmethodID register_output_meth;
10248 } LDKFilter_JCalls;
10249 static void LDKFilter_JCalls_free(void* this_arg) {
10250         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10251         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10252                 JNIEnv *env;
10253                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10254                 if (get_jenv_res == JNI_EDETACHED) {
10255                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10256                 } else {
10257                         DO_ASSERT(get_jenv_res == JNI_OK);
10258                 }
10259                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10260                 if (get_jenv_res == JNI_EDETACHED) {
10261                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10262                 }
10263                 FREE(j_calls);
10264         }
10265 }
10266 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
10267         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10268         JNIEnv *env;
10269         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10270         if (get_jenv_res == JNI_EDETACHED) {
10271                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10272         } else {
10273                 DO_ASSERT(get_jenv_res == JNI_OK);
10274         }
10275         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10276         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10277         LDKu8slice script_pubkey_var = script_pubkey;
10278         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
10279         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
10280         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10281         CHECK(obj != NULL);
10282         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
10283         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10284                 (*env)->ExceptionDescribe(env);
10285                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
10286         }
10287         if (get_jenv_res == JNI_EDETACHED) {
10288                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10289         }
10290 }
10291 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
10292         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10293         JNIEnv *env;
10294         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10295         if (get_jenv_res == JNI_EDETACHED) {
10296                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10297         } else {
10298                 DO_ASSERT(get_jenv_res == JNI_OK);
10299         }
10300         LDKWatchedOutput output_var = output;
10301         int64_t output_ref = 0;
10302         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
10303         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
10304         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10305         CHECK(obj != NULL);
10306         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
10307         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10308                 (*env)->ExceptionDescribe(env);
10309                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
10310         }
10311         if (get_jenv_res == JNI_EDETACHED) {
10312                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10313         }
10314 }
10315 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
10316         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
10317         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10318 }
10319 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
10320         jclass c = (*env)->GetObjectClass(env, o);
10321         CHECK(c != NULL);
10322         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
10323         atomic_init(&calls->refcnt, 1);
10324         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10325         calls->o = (*env)->NewWeakGlobalRef(env, o);
10326         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
10327         CHECK(calls->register_tx_meth != NULL);
10328         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
10329         CHECK(calls->register_output_meth != NULL);
10330
10331         LDKFilter ret = {
10332                 .this_arg = (void*) calls,
10333                 .register_tx = register_tx_LDKFilter_jcall,
10334                 .register_output = register_output_LDKFilter_jcall,
10335                 .free = LDKFilter_JCalls_free,
10336         };
10337         return ret;
10338 }
10339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
10340         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10341         *res_ptr = LDKFilter_init(env, clz, o);
10342         return tag_ptr(res_ptr, true);
10343 }
10344 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) {
10345         void* this_arg_ptr = untag_ptr(this_arg);
10346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10347         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10348         unsigned char txid_arr[32];
10349         CHECK((*env)->GetArrayLength(env, txid) == 32);
10350         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10351         unsigned char (*txid_ref)[32] = &txid_arr;
10352         LDKu8slice script_pubkey_ref;
10353         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
10354         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
10355         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
10356         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
10357 }
10358
10359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
10360         void* this_arg_ptr = untag_ptr(this_arg);
10361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10362         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10363         LDKWatchedOutput output_conv;
10364         output_conv.inner = untag_ptr(output);
10365         output_conv.is_owned = ptr_is_owned(output);
10366         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
10367         output_conv = WatchedOutput_clone(&output_conv);
10368         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
10369 }
10370
10371 static jclass LDKCOption_FilterZ_Some_class = NULL;
10372 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
10373 static jclass LDKCOption_FilterZ_None_class = NULL;
10374 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
10375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
10376         LDKCOption_FilterZ_Some_class =
10377                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
10378         CHECK(LDKCOption_FilterZ_Some_class != NULL);
10379         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
10380         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
10381         LDKCOption_FilterZ_None_class =
10382                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
10383         CHECK(LDKCOption_FilterZ_None_class != NULL);
10384         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
10385         CHECK(LDKCOption_FilterZ_None_meth != NULL);
10386 }
10387 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10388         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
10389         switch(obj->tag) {
10390                 case LDKCOption_FilterZ_Some: {
10391                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
10392                         *some_ret = obj->some;
10393                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
10394                         if ((*some_ret).free == LDKFilter_JCalls_free) {
10395                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10396                                 LDKFilter_JCalls_cloned(&(*some_ret));
10397                         }
10398                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
10399                 }
10400                 case LDKCOption_FilterZ_None: {
10401                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
10402                 }
10403                 default: abort();
10404         }
10405 }
10406 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10407         LDKLockedChannelMonitor ret = *owner->contents.result;
10408         ret.is_owned = false;
10409         return ret;
10410 }
10411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10412         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
10413         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
10414         int64_t ret_ref = 0;
10415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10417         return ret_ref;
10418 }
10419
10420 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10421 CHECK(!owner->result_ok);
10422         return *owner->contents.err;
10423 }
10424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10425         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
10426         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
10427 }
10428
10429 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
10430         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
10431         for (size_t i = 0; i < ret.datalen; i++) {
10432                 ret.data[i] = OutPoint_clone(&orig->data[i]);
10433         }
10434         return ret;
10435 }
10436 typedef struct LDKMessageSendEventsProvider_JCalls {
10437         atomic_size_t refcnt;
10438         JavaVM *vm;
10439         jweak o;
10440         jmethodID get_and_clear_pending_msg_events_meth;
10441 } LDKMessageSendEventsProvider_JCalls;
10442 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
10443         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10444         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10445                 JNIEnv *env;
10446                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10447                 if (get_jenv_res == JNI_EDETACHED) {
10448                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10449                 } else {
10450                         DO_ASSERT(get_jenv_res == JNI_OK);
10451                 }
10452                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10453                 if (get_jenv_res == JNI_EDETACHED) {
10454                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10455                 }
10456                 FREE(j_calls);
10457         }
10458 }
10459 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
10460         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
10461         JNIEnv *env;
10462         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10463         if (get_jenv_res == JNI_EDETACHED) {
10464                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10465         } else {
10466                 DO_ASSERT(get_jenv_res == JNI_OK);
10467         }
10468         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10469         CHECK(obj != NULL);
10470         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
10471         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10472                 (*env)->ExceptionDescribe(env);
10473                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
10474         }
10475         LDKCVec_MessageSendEventZ ret_constr;
10476         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10477         if (ret_constr.datalen > 0)
10478                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10479         else
10480                 ret_constr.data = NULL;
10481         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
10482         for (size_t s = 0; s < ret_constr.datalen; s++) {
10483                 int64_t ret_conv_18 = ret_vals[s];
10484                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
10485                 CHECK_ACCESS(ret_conv_18_ptr);
10486                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
10487                 FREE(untag_ptr(ret_conv_18));
10488                 ret_constr.data[s] = ret_conv_18_conv;
10489         }
10490         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
10491         if (get_jenv_res == JNI_EDETACHED) {
10492                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10493         }
10494         return ret_constr;
10495 }
10496 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10497         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10498         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10499 }
10500 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10501         jclass c = (*env)->GetObjectClass(env, o);
10502         CHECK(c != NULL);
10503         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10504         atomic_init(&calls->refcnt, 1);
10505         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10506         calls->o = (*env)->NewWeakGlobalRef(env, o);
10507         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
10508         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
10509
10510         LDKMessageSendEventsProvider ret = {
10511                 .this_arg = (void*) calls,
10512                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10513                 .free = LDKMessageSendEventsProvider_JCalls_free,
10514         };
10515         return ret;
10516 }
10517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10518         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10519         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
10520         return tag_ptr(res_ptr, true);
10521 }
10522 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10523         void* this_arg_ptr = untag_ptr(this_arg);
10524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10525         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10526         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10527         int64_tArray ret_arr = NULL;
10528         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10529         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10530         for (size_t s = 0; s < ret_var.datalen; s++) {
10531                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10532                 *ret_conv_18_copy = ret_var.data[s];
10533                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
10534                 ret_arr_ptr[s] = ret_conv_18_ref;
10535         }
10536         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10537         FREE(ret_var.data);
10538         return ret_arr;
10539 }
10540
10541 typedef struct LDKOnionMessageProvider_JCalls {
10542         atomic_size_t refcnt;
10543         JavaVM *vm;
10544         jweak o;
10545         jmethodID next_onion_message_for_peer_meth;
10546 } LDKOnionMessageProvider_JCalls;
10547 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
10548         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
10549         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10550                 JNIEnv *env;
10551                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10552                 if (get_jenv_res == JNI_EDETACHED) {
10553                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10554                 } else {
10555                         DO_ASSERT(get_jenv_res == JNI_OK);
10556                 }
10557                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10558                 if (get_jenv_res == JNI_EDETACHED) {
10559                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10560                 }
10561                 FREE(j_calls);
10562         }
10563 }
10564 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
10565         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
10566         JNIEnv *env;
10567         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10568         if (get_jenv_res == JNI_EDETACHED) {
10569                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10570         } else {
10571                 DO_ASSERT(get_jenv_res == JNI_OK);
10572         }
10573         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
10574         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
10575         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10576         CHECK(obj != NULL);
10577         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
10578         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10579                 (*env)->ExceptionDescribe(env);
10580                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageProvider from rust threw an exception.");
10581         }
10582         LDKOnionMessage ret_conv;
10583         ret_conv.inner = untag_ptr(ret);
10584         ret_conv.is_owned = ptr_is_owned(ret);
10585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10586         if (get_jenv_res == JNI_EDETACHED) {
10587                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10588         }
10589         return ret_conv;
10590 }
10591 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
10592         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
10593         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10594 }
10595 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JNIEnv *env, jclass clz, jobject o) {
10596         jclass c = (*env)->GetObjectClass(env, o);
10597         CHECK(c != NULL);
10598         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
10599         atomic_init(&calls->refcnt, 1);
10600         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10601         calls->o = (*env)->NewWeakGlobalRef(env, o);
10602         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
10603         CHECK(calls->next_onion_message_for_peer_meth != NULL);
10604
10605         LDKOnionMessageProvider ret = {
10606                 .this_arg = (void*) calls,
10607                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
10608                 .free = LDKOnionMessageProvider_JCalls_free,
10609         };
10610         return ret;
10611 }
10612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10613         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
10614         *res_ptr = LDKOnionMessageProvider_init(env, clz, o);
10615         return tag_ptr(res_ptr, true);
10616 }
10617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) {
10618         void* this_arg_ptr = untag_ptr(this_arg);
10619         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10620         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
10621         LDKPublicKey peer_node_id_ref;
10622         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
10623         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
10624         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
10625         int64_t ret_ref = 0;
10626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10628         return ret_ref;
10629 }
10630
10631 typedef struct LDKEventHandler_JCalls {
10632         atomic_size_t refcnt;
10633         JavaVM *vm;
10634         jweak o;
10635         jmethodID handle_event_meth;
10636 } LDKEventHandler_JCalls;
10637 static void LDKEventHandler_JCalls_free(void* this_arg) {
10638         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10639         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10640                 JNIEnv *env;
10641                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10642                 if (get_jenv_res == JNI_EDETACHED) {
10643                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10644                 } else {
10645                         DO_ASSERT(get_jenv_res == JNI_OK);
10646                 }
10647                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10648                 if (get_jenv_res == JNI_EDETACHED) {
10649                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10650                 }
10651                 FREE(j_calls);
10652         }
10653 }
10654 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
10655         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10656         JNIEnv *env;
10657         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10658         if (get_jenv_res == JNI_EDETACHED) {
10659                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10660         } else {
10661                 DO_ASSERT(get_jenv_res == JNI_OK);
10662         }
10663         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
10664         *ret_event = Event_clone(event);
10665         int64_t ref_event = tag_ptr(ret_event, true);
10666         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10667         CHECK(obj != NULL);
10668         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, ref_event);
10669         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10670                 (*env)->ExceptionDescribe(env);
10671                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
10672         }
10673         if (get_jenv_res == JNI_EDETACHED) {
10674                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10675         }
10676 }
10677 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
10678         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
10679         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10680 }
10681 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
10682         jclass c = (*env)->GetObjectClass(env, o);
10683         CHECK(c != NULL);
10684         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
10685         atomic_init(&calls->refcnt, 1);
10686         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10687         calls->o = (*env)->NewWeakGlobalRef(env, o);
10688         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
10689         CHECK(calls->handle_event_meth != NULL);
10690
10691         LDKEventHandler ret = {
10692                 .this_arg = (void*) calls,
10693                 .handle_event = handle_event_LDKEventHandler_jcall,
10694                 .free = LDKEventHandler_JCalls_free,
10695         };
10696         return ret;
10697 }
10698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
10699         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10700         *res_ptr = LDKEventHandler_init(env, clz, o);
10701         return tag_ptr(res_ptr, true);
10702 }
10703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
10704         void* this_arg_ptr = untag_ptr(this_arg);
10705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10706         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
10707         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
10708         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
10709 }
10710
10711 typedef struct LDKEventsProvider_JCalls {
10712         atomic_size_t refcnt;
10713         JavaVM *vm;
10714         jweak o;
10715         jmethodID process_pending_events_meth;
10716 } LDKEventsProvider_JCalls;
10717 static void LDKEventsProvider_JCalls_free(void* this_arg) {
10718         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10719         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10720                 JNIEnv *env;
10721                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10722                 if (get_jenv_res == JNI_EDETACHED) {
10723                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10724                 } else {
10725                         DO_ASSERT(get_jenv_res == JNI_OK);
10726                 }
10727                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10728                 if (get_jenv_res == JNI_EDETACHED) {
10729                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10730                 }
10731                 FREE(j_calls);
10732         }
10733 }
10734 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
10735         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10736         JNIEnv *env;
10737         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10738         if (get_jenv_res == JNI_EDETACHED) {
10739                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10740         } else {
10741                 DO_ASSERT(get_jenv_res == JNI_OK);
10742         }
10743         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10744         *handler_ret = handler;
10745         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10746         CHECK(obj != NULL);
10747         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
10748         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10749                 (*env)->ExceptionDescribe(env);
10750                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
10751         }
10752         if (get_jenv_res == JNI_EDETACHED) {
10753                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10754         }
10755 }
10756 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
10757         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
10758         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10759 }
10760 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10761         jclass c = (*env)->GetObjectClass(env, o);
10762         CHECK(c != NULL);
10763         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
10764         atomic_init(&calls->refcnt, 1);
10765         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10766         calls->o = (*env)->NewWeakGlobalRef(env, o);
10767         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
10768         CHECK(calls->process_pending_events_meth != NULL);
10769
10770         LDKEventsProvider ret = {
10771                 .this_arg = (void*) calls,
10772                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
10773                 .free = LDKEventsProvider_JCalls_free,
10774         };
10775         return ret;
10776 }
10777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10778         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10779         *res_ptr = LDKEventsProvider_init(env, clz, o);
10780         return tag_ptr(res_ptr, true);
10781 }
10782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
10783         void* this_arg_ptr = untag_ptr(this_arg);
10784         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10785         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
10786         void* handler_ptr = untag_ptr(handler);
10787         CHECK_ACCESS(handler_ptr);
10788         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
10789         if (handler_conv.free == LDKEventHandler_JCalls_free) {
10790                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10791                 LDKEventHandler_JCalls_cloned(&handler_conv);
10792         }
10793         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
10794 }
10795
10796 typedef struct LDKPersister_JCalls {
10797         atomic_size_t refcnt;
10798         JavaVM *vm;
10799         jweak o;
10800         jmethodID persist_manager_meth;
10801         jmethodID persist_graph_meth;
10802         jmethodID persist_scorer_meth;
10803 } LDKPersister_JCalls;
10804 static void LDKPersister_JCalls_free(void* this_arg) {
10805         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10806         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10807                 JNIEnv *env;
10808                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10809                 if (get_jenv_res == JNI_EDETACHED) {
10810                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10811                 } else {
10812                         DO_ASSERT(get_jenv_res == JNI_OK);
10813                 }
10814                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10815                 if (get_jenv_res == JNI_EDETACHED) {
10816                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10817                 }
10818                 FREE(j_calls);
10819         }
10820 }
10821 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10822         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10823         JNIEnv *env;
10824         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10825         if (get_jenv_res == JNI_EDETACHED) {
10826                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10827         } else {
10828                 DO_ASSERT(get_jenv_res == JNI_OK);
10829         }
10830         LDKChannelManager channel_manager_var = *channel_manager;
10831         int64_t channel_manager_ref = 0;
10832         // WARNING: we may need a move here but no clone is available for LDKChannelManager
10833         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10834         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
10835         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10836         CHECK(obj != NULL);
10837         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10838         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10839                 (*env)->ExceptionDescribe(env);
10840                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
10841         }
10842         void* ret_ptr = untag_ptr(ret);
10843         CHECK_ACCESS(ret_ptr);
10844         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10845         FREE(untag_ptr(ret));
10846         if (get_jenv_res == JNI_EDETACHED) {
10847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10848         }
10849         return ret_conv;
10850 }
10851 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10852         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10853         JNIEnv *env;
10854         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10855         if (get_jenv_res == JNI_EDETACHED) {
10856                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10857         } else {
10858                 DO_ASSERT(get_jenv_res == JNI_OK);
10859         }
10860         LDKNetworkGraph network_graph_var = *network_graph;
10861         int64_t network_graph_ref = 0;
10862         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10863         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10864         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
10865         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10866         CHECK(obj != NULL);
10867         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
10868         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10869                 (*env)->ExceptionDescribe(env);
10870                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
10871         }
10872         void* ret_ptr = untag_ptr(ret);
10873         CHECK_ACCESS(ret_ptr);
10874         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10875         FREE(untag_ptr(ret));
10876         if (get_jenv_res == JNI_EDETACHED) {
10877                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10878         }
10879         return ret_conv;
10880 }
10881 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
10882         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10883         JNIEnv *env;
10884         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10885         if (get_jenv_res == JNI_EDETACHED) {
10886                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10887         } else {
10888                 DO_ASSERT(get_jenv_res == JNI_OK);
10889         }
10890         // WARNING: This object doesn't live past this scope, needs clone!
10891         int64_t ret_scorer = tag_ptr(scorer, false);
10892         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10893         CHECK(obj != NULL);
10894         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
10895         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10896                 (*env)->ExceptionDescribe(env);
10897                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
10898         }
10899         void* ret_ptr = untag_ptr(ret);
10900         CHECK_ACCESS(ret_ptr);
10901         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10902         FREE(untag_ptr(ret));
10903         if (get_jenv_res == JNI_EDETACHED) {
10904                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10905         }
10906         return ret_conv;
10907 }
10908 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10909         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10910         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10911 }
10912 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
10913         jclass c = (*env)->GetObjectClass(env, o);
10914         CHECK(c != NULL);
10915         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10916         atomic_init(&calls->refcnt, 1);
10917         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10918         calls->o = (*env)->NewWeakGlobalRef(env, o);
10919         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10920         CHECK(calls->persist_manager_meth != NULL);
10921         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
10922         CHECK(calls->persist_graph_meth != NULL);
10923         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
10924         CHECK(calls->persist_scorer_meth != NULL);
10925
10926         LDKPersister ret = {
10927                 .this_arg = (void*) calls,
10928                 .persist_manager = persist_manager_LDKPersister_jcall,
10929                 .persist_graph = persist_graph_LDKPersister_jcall,
10930                 .persist_scorer = persist_scorer_LDKPersister_jcall,
10931                 .free = LDKPersister_JCalls_free,
10932         };
10933         return ret;
10934 }
10935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10936         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10937         *res_ptr = LDKPersister_init(env, clz, o);
10938         return tag_ptr(res_ptr, true);
10939 }
10940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10941         void* this_arg_ptr = untag_ptr(this_arg);
10942         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10943         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10944         LDKChannelManager channel_manager_conv;
10945         channel_manager_conv.inner = untag_ptr(channel_manager);
10946         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
10947         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10948         channel_manager_conv.is_owned = false;
10949         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10950         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10951         return tag_ptr(ret_conv, true);
10952 }
10953
10954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
10955         void* this_arg_ptr = untag_ptr(this_arg);
10956         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10957         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10958         LDKNetworkGraph network_graph_conv;
10959         network_graph_conv.inner = untag_ptr(network_graph);
10960         network_graph_conv.is_owned = ptr_is_owned(network_graph);
10961         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10962         network_graph_conv.is_owned = false;
10963         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10964         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10965         return tag_ptr(ret_conv, true);
10966 }
10967
10968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
10969         void* this_arg_ptr = untag_ptr(this_arg);
10970         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10971         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10972         void* scorer_ptr = untag_ptr(scorer);
10973         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
10974         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
10975         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10976         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
10977         return tag_ptr(ret_conv, true);
10978 }
10979
10980 typedef struct LDKFutureCallback_JCalls {
10981         atomic_size_t refcnt;
10982         JavaVM *vm;
10983         jweak o;
10984         jmethodID call_meth;
10985 } LDKFutureCallback_JCalls;
10986 static void LDKFutureCallback_JCalls_free(void* this_arg) {
10987         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
10988         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10989                 JNIEnv *env;
10990                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10991                 if (get_jenv_res == JNI_EDETACHED) {
10992                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10993                 } else {
10994                         DO_ASSERT(get_jenv_res == JNI_OK);
10995                 }
10996                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10997                 if (get_jenv_res == JNI_EDETACHED) {
10998                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10999                 }
11000                 FREE(j_calls);
11001         }
11002 }
11003 void call_LDKFutureCallback_jcall(const void* this_arg) {
11004         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
11005         JNIEnv *env;
11006         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11007         if (get_jenv_res == JNI_EDETACHED) {
11008                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11009         } else {
11010                 DO_ASSERT(get_jenv_res == JNI_OK);
11011         }
11012         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11013         CHECK(obj != NULL);
11014         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
11015         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11016                 (*env)->ExceptionDescribe(env);
11017                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
11018         }
11019         if (get_jenv_res == JNI_EDETACHED) {
11020                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11021         }
11022 }
11023 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
11024         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
11025         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11026 }
11027 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
11028         jclass c = (*env)->GetObjectClass(env, o);
11029         CHECK(c != NULL);
11030         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
11031         atomic_init(&calls->refcnt, 1);
11032         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11033         calls->o = (*env)->NewWeakGlobalRef(env, o);
11034         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
11035         CHECK(calls->call_meth != NULL);
11036
11037         LDKFutureCallback ret = {
11038                 .this_arg = (void*) calls,
11039                 .call = call_LDKFutureCallback_jcall,
11040                 .free = LDKFutureCallback_JCalls_free,
11041         };
11042         return ret;
11043 }
11044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
11045         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
11046         *res_ptr = LDKFutureCallback_init(env, clz, o);
11047         return tag_ptr(res_ptr, true);
11048 }
11049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
11050         void* this_arg_ptr = untag_ptr(this_arg);
11051         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11052         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
11053         (this_arg_conv->call)(this_arg_conv->this_arg);
11054 }
11055
11056 typedef struct LDKListen_JCalls {
11057         atomic_size_t refcnt;
11058         JavaVM *vm;
11059         jweak o;
11060         jmethodID filtered_block_connected_meth;
11061         jmethodID block_connected_meth;
11062         jmethodID block_disconnected_meth;
11063 } LDKListen_JCalls;
11064 static void LDKListen_JCalls_free(void* this_arg) {
11065         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11066         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11067                 JNIEnv *env;
11068                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11069                 if (get_jenv_res == JNI_EDETACHED) {
11070                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11071                 } else {
11072                         DO_ASSERT(get_jenv_res == JNI_OK);
11073                 }
11074                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11075                 if (get_jenv_res == JNI_EDETACHED) {
11076                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11077                 }
11078                 FREE(j_calls);
11079         }
11080 }
11081 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11082         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11083         JNIEnv *env;
11084         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11085         if (get_jenv_res == JNI_EDETACHED) {
11086                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11087         } else {
11088                 DO_ASSERT(get_jenv_res == JNI_OK);
11089         }
11090         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11091         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11092         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11093         int64_tArray txdata_arr = NULL;
11094         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11095         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11096         for (size_t c = 0; c < txdata_var.datalen; c++) {
11097                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11098                 *txdata_conv_28_conv = txdata_var.data[c];
11099                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11100         }
11101         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11102         FREE(txdata_var.data);
11103         int32_t height_conv = height;
11104         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11105         CHECK(obj != NULL);
11106         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
11107         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11108                 (*env)->ExceptionDescribe(env);
11109                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
11110         }
11111         if (get_jenv_res == JNI_EDETACHED) {
11112                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11113         }
11114 }
11115 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
11116         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11117         JNIEnv *env;
11118         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11119         if (get_jenv_res == JNI_EDETACHED) {
11120                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11121         } else {
11122                 DO_ASSERT(get_jenv_res == JNI_OK);
11123         }
11124         LDKu8slice block_var = block;
11125         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
11126         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
11127         int32_t height_conv = height;
11128         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11129         CHECK(obj != NULL);
11130         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
11131         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11132                 (*env)->ExceptionDescribe(env);
11133                 (*env)->FatalError(env, "A call to block_connected in LDKListen 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 block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11140         LDKListen_JCalls *j_calls = (LDKListen_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 header_arr = (*env)->NewByteArray(env, 80);
11149         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11150         int32_t height_conv = height;
11151         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11152         CHECK(obj != NULL);
11153         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
11154         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11155                 (*env)->ExceptionDescribe(env);
11156                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
11157         }
11158         if (get_jenv_res == JNI_EDETACHED) {
11159                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11160         }
11161 }
11162 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11163         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11164         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11165 }
11166 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
11167         jclass c = (*env)->GetObjectClass(env, o);
11168         CHECK(c != NULL);
11169         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
11170         atomic_init(&calls->refcnt, 1);
11171         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11172         calls->o = (*env)->NewWeakGlobalRef(env, o);
11173         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
11174         CHECK(calls->filtered_block_connected_meth != NULL);
11175         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
11176         CHECK(calls->block_connected_meth != NULL);
11177         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
11178         CHECK(calls->block_disconnected_meth != NULL);
11179
11180         LDKListen ret = {
11181                 .this_arg = (void*) calls,
11182                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
11183                 .block_connected = block_connected_LDKListen_jcall,
11184                 .block_disconnected = block_disconnected_LDKListen_jcall,
11185                 .free = LDKListen_JCalls_free,
11186         };
11187         return ret;
11188 }
11189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
11190         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
11191         *res_ptr = LDKListen_init(env, clz, o);
11192         return tag_ptr(res_ptr, true);
11193 }
11194 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) {
11195         void* this_arg_ptr = untag_ptr(this_arg);
11196         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11197         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11198         unsigned char header_arr[80];
11199         CHECK((*env)->GetArrayLength(env, header) == 80);
11200         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11201         unsigned char (*header_ref)[80] = &header_arr;
11202         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11203         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11204         if (txdata_constr.datalen > 0)
11205                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11206         else
11207                 txdata_constr.data = NULL;
11208         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11209         for (size_t c = 0; c < txdata_constr.datalen; c++) {
11210                 int64_t txdata_conv_28 = txdata_vals[c];
11211                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
11212                 CHECK_ACCESS(txdata_conv_28_ptr);
11213                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11214                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
11215                 txdata_constr.data[c] = txdata_conv_28_conv;
11216         }
11217         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11218         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11219 }
11220
11221 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) {
11222         void* this_arg_ptr = untag_ptr(this_arg);
11223         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11224         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11225         LDKu8slice block_ref;
11226         block_ref.datalen = (*env)->GetArrayLength(env, block);
11227         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
11228         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
11229         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
11230 }
11231
11232 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) {
11233         void* this_arg_ptr = untag_ptr(this_arg);
11234         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11235         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11236         unsigned char header_arr[80];
11237         CHECK((*env)->GetArrayLength(env, header) == 80);
11238         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11239         unsigned char (*header_ref)[80] = &header_arr;
11240         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
11241 }
11242
11243 typedef struct LDKConfirm_JCalls {
11244         atomic_size_t refcnt;
11245         JavaVM *vm;
11246         jweak o;
11247         jmethodID transactions_confirmed_meth;
11248         jmethodID transaction_unconfirmed_meth;
11249         jmethodID best_block_updated_meth;
11250         jmethodID get_relevant_txids_meth;
11251 } LDKConfirm_JCalls;
11252 static void LDKConfirm_JCalls_free(void* this_arg) {
11253         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11254         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11255                 JNIEnv *env;
11256                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11257                 if (get_jenv_res == JNI_EDETACHED) {
11258                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11259                 } else {
11260                         DO_ASSERT(get_jenv_res == JNI_OK);
11261                 }
11262                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11263                 if (get_jenv_res == JNI_EDETACHED) {
11264                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11265                 }
11266                 FREE(j_calls);
11267         }
11268 }
11269 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11270         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11271         JNIEnv *env;
11272         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11273         if (get_jenv_res == JNI_EDETACHED) {
11274                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11275         } else {
11276                 DO_ASSERT(get_jenv_res == JNI_OK);
11277         }
11278         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11279         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11280         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11281         int64_tArray txdata_arr = NULL;
11282         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
11283         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
11284         for (size_t c = 0; c < txdata_var.datalen; c++) {
11285                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11286                 *txdata_conv_28_conv = txdata_var.data[c];
11287                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11288         }
11289         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
11290         FREE(txdata_var.data);
11291         int32_t height_conv = height;
11292         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11293         CHECK(obj != NULL);
11294         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
11295         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11296                 (*env)->ExceptionDescribe(env);
11297                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
11298         }
11299         if (get_jenv_res == JNI_EDETACHED) {
11300                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11301         }
11302 }
11303 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
11304         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11305         JNIEnv *env;
11306         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11307         if (get_jenv_res == JNI_EDETACHED) {
11308                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11309         } else {
11310                 DO_ASSERT(get_jenv_res == JNI_OK);
11311         }
11312         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
11313         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
11314         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11315         CHECK(obj != NULL);
11316         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
11317         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11318                 (*env)->ExceptionDescribe(env);
11319                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
11320         }
11321         if (get_jenv_res == JNI_EDETACHED) {
11322                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11323         }
11324 }
11325 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11326         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11327         JNIEnv *env;
11328         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11329         if (get_jenv_res == JNI_EDETACHED) {
11330                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11331         } else {
11332                 DO_ASSERT(get_jenv_res == JNI_OK);
11333         }
11334         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
11335         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
11336         int32_t height_conv = height;
11337         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11338         CHECK(obj != NULL);
11339         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
11340         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11341                 (*env)->ExceptionDescribe(env);
11342                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
11343         }
11344         if (get_jenv_res == JNI_EDETACHED) {
11345                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11346         }
11347 }
11348 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
11349         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11350         JNIEnv *env;
11351         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11352         if (get_jenv_res == JNI_EDETACHED) {
11353                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11354         } else {
11355                 DO_ASSERT(get_jenv_res == JNI_OK);
11356         }
11357         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11358         CHECK(obj != NULL);
11359         jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
11360         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11361                 (*env)->ExceptionDescribe(env);
11362                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
11363         }
11364         LDKCVec_TxidZ ret_constr;
11365         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11366         if (ret_constr.datalen > 0)
11367                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11368         else
11369                 ret_constr.data = NULL;
11370         for (size_t i = 0; i < ret_constr.datalen; i++) {
11371                 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
11372                 LDKThirtyTwoBytes ret_conv_8_ref;
11373                 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
11374                 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
11375                 ret_constr.data[i] = ret_conv_8_ref;
11376         }
11377         if (get_jenv_res == JNI_EDETACHED) {
11378                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11379         }
11380         return ret_constr;
11381 }
11382 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
11383         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
11384         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11385 }
11386 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
11387         jclass c = (*env)->GetObjectClass(env, o);
11388         CHECK(c != NULL);
11389         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
11390         atomic_init(&calls->refcnt, 1);
11391         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11392         calls->o = (*env)->NewWeakGlobalRef(env, o);
11393         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
11394         CHECK(calls->transactions_confirmed_meth != NULL);
11395         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
11396         CHECK(calls->transaction_unconfirmed_meth != NULL);
11397         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
11398         CHECK(calls->best_block_updated_meth != NULL);
11399         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
11400         CHECK(calls->get_relevant_txids_meth != NULL);
11401
11402         LDKConfirm ret = {
11403                 .this_arg = (void*) calls,
11404                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
11405                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
11406                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
11407                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
11408                 .free = LDKConfirm_JCalls_free,
11409         };
11410         return ret;
11411 }
11412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
11413         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
11414         *res_ptr = LDKConfirm_init(env, clz, o);
11415         return tag_ptr(res_ptr, true);
11416 }
11417 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) {
11418         void* this_arg_ptr = untag_ptr(this_arg);
11419         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11420         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11421         unsigned char header_arr[80];
11422         CHECK((*env)->GetArrayLength(env, header) == 80);
11423         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11424         unsigned char (*header_ref)[80] = &header_arr;
11425         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11426         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
11427         if (txdata_constr.datalen > 0)
11428                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11429         else
11430                 txdata_constr.data = NULL;
11431         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
11432         for (size_t c = 0; c < txdata_constr.datalen; c++) {
11433                 int64_t txdata_conv_28 = txdata_vals[c];
11434                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
11435                 CHECK_ACCESS(txdata_conv_28_ptr);
11436                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11437                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
11438                 txdata_constr.data[c] = txdata_conv_28_conv;
11439         }
11440         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
11441         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11442 }
11443
11444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
11445         void* this_arg_ptr = untag_ptr(this_arg);
11446         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11447         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11448         unsigned char txid_arr[32];
11449         CHECK((*env)->GetArrayLength(env, txid) == 32);
11450         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
11451         unsigned char (*txid_ref)[32] = &txid_arr;
11452         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
11453 }
11454
11455 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) {
11456         void* this_arg_ptr = untag_ptr(this_arg);
11457         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11458         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11459         unsigned char header_arr[80];
11460         CHECK((*env)->GetArrayLength(env, header) == 80);
11461         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
11462         unsigned char (*header_ref)[80] = &header_arr;
11463         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
11464 }
11465
11466 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
11467         void* this_arg_ptr = untag_ptr(this_arg);
11468         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11469         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11470         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
11471         jobjectArray ret_arr = NULL;
11472         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11473         ;
11474         for (size_t i = 0; i < ret_var.datalen; i++) {
11475                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
11476                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
11477                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11478         }
11479         
11480         FREE(ret_var.data);
11481         return ret_arr;
11482 }
11483
11484 typedef struct LDKPersist_JCalls {
11485         atomic_size_t refcnt;
11486         JavaVM *vm;
11487         jweak o;
11488         jmethodID persist_new_channel_meth;
11489         jmethodID update_persisted_channel_meth;
11490 } LDKPersist_JCalls;
11491 static void LDKPersist_JCalls_free(void* this_arg) {
11492         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11493         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11494                 JNIEnv *env;
11495                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11496                 if (get_jenv_res == JNI_EDETACHED) {
11497                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11498                 } else {
11499                         DO_ASSERT(get_jenv_res == JNI_OK);
11500                 }
11501                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11502                 if (get_jenv_res == JNI_EDETACHED) {
11503                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11504                 }
11505                 FREE(j_calls);
11506         }
11507 }
11508 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11509         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11510         JNIEnv *env;
11511         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11512         if (get_jenv_res == JNI_EDETACHED) {
11513                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11514         } else {
11515                 DO_ASSERT(get_jenv_res == JNI_OK);
11516         }
11517         LDKOutPoint channel_id_var = channel_id;
11518         int64_t channel_id_ref = 0;
11519         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11520         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11521         LDKChannelMonitor data_var = *data;
11522         int64_t data_ref = 0;
11523         data_var = ChannelMonitor_clone(&data_var);
11524         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11525         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11526         LDKMonitorUpdateId update_id_var = update_id;
11527         int64_t update_id_ref = 0;
11528         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11529         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11530         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11531         CHECK(obj != NULL);
11532         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
11533         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11534                 (*env)->ExceptionDescribe(env);
11535                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
11536         }
11537         void* ret_ptr = untag_ptr(ret);
11538         CHECK_ACCESS(ret_ptr);
11539         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11540         FREE(untag_ptr(ret));
11541         if (get_jenv_res == JNI_EDETACHED) {
11542                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11543         }
11544         return ret_conv;
11545 }
11546 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11547         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11548         JNIEnv *env;
11549         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11550         if (get_jenv_res == JNI_EDETACHED) {
11551                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11552         } else {
11553                 DO_ASSERT(get_jenv_res == JNI_OK);
11554         }
11555         LDKOutPoint channel_id_var = channel_id;
11556         int64_t channel_id_ref = 0;
11557         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11558         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11559         LDKChannelMonitorUpdate update_var = *update;
11560         int64_t update_ref = 0;
11561         update_var = ChannelMonitorUpdate_clone(&update_var);
11562         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11563         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
11564         LDKChannelMonitor data_var = *data;
11565         int64_t data_ref = 0;
11566         data_var = ChannelMonitor_clone(&data_var);
11567         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11568         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11569         LDKMonitorUpdateId update_id_var = update_id;
11570         int64_t update_id_ref = 0;
11571         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11572         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11573         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11574         CHECK(obj != NULL);
11575         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
11576         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11577                 (*env)->ExceptionDescribe(env);
11578                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
11579         }
11580         void* ret_ptr = untag_ptr(ret);
11581         CHECK_ACCESS(ret_ptr);
11582         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
11583         FREE(untag_ptr(ret));
11584         if (get_jenv_res == JNI_EDETACHED) {
11585                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11586         }
11587         return ret_conv;
11588 }
11589 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11590         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11591         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11592 }
11593 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
11594         jclass c = (*env)->GetObjectClass(env, o);
11595         CHECK(c != NULL);
11596         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11597         atomic_init(&calls->refcnt, 1);
11598         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11599         calls->o = (*env)->NewWeakGlobalRef(env, o);
11600         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
11601         CHECK(calls->persist_new_channel_meth != NULL);
11602         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
11603         CHECK(calls->update_persisted_channel_meth != NULL);
11604
11605         LDKPersist ret = {
11606                 .this_arg = (void*) calls,
11607                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11608                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11609                 .free = LDKPersist_JCalls_free,
11610         };
11611         return ret;
11612 }
11613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
11614         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11615         *res_ptr = LDKPersist_init(env, clz, o);
11616         return tag_ptr(res_ptr, true);
11617 }
11618 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) {
11619         void* this_arg_ptr = untag_ptr(this_arg);
11620         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11621         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11622         LDKOutPoint channel_id_conv;
11623         channel_id_conv.inner = untag_ptr(channel_id);
11624         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11625         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11626         channel_id_conv = OutPoint_clone(&channel_id_conv);
11627         LDKChannelMonitor data_conv;
11628         data_conv.inner = untag_ptr(data);
11629         data_conv.is_owned = ptr_is_owned(data);
11630         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11631         data_conv.is_owned = false;
11632         LDKMonitorUpdateId update_id_conv;
11633         update_id_conv.inner = untag_ptr(update_id);
11634         update_id_conv.is_owned = ptr_is_owned(update_id);
11635         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11636         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11637         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11638         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
11639         return tag_ptr(ret_conv, true);
11640 }
11641
11642 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) {
11643         void* this_arg_ptr = untag_ptr(this_arg);
11644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11645         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11646         LDKOutPoint channel_id_conv;
11647         channel_id_conv.inner = untag_ptr(channel_id);
11648         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11649         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11650         channel_id_conv = OutPoint_clone(&channel_id_conv);
11651         LDKChannelMonitorUpdate update_conv;
11652         update_conv.inner = untag_ptr(update);
11653         update_conv.is_owned = ptr_is_owned(update);
11654         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11655         update_conv.is_owned = false;
11656         LDKChannelMonitor data_conv;
11657         data_conv.inner = untag_ptr(data);
11658         data_conv.is_owned = ptr_is_owned(data);
11659         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11660         data_conv.is_owned = false;
11661         LDKMonitorUpdateId update_id_conv;
11662         update_id_conv.inner = untag_ptr(update_id);
11663         update_id_conv.is_owned = ptr_is_owned(update_id);
11664         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11665         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11666         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11667         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
11668         return tag_ptr(ret_conv, true);
11669 }
11670
11671 typedef struct LDKChannelMessageHandler_JCalls {
11672         atomic_size_t refcnt;
11673         JavaVM *vm;
11674         jweak o;
11675         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11676         jmethodID handle_open_channel_meth;
11677         jmethodID handle_accept_channel_meth;
11678         jmethodID handle_funding_created_meth;
11679         jmethodID handle_funding_signed_meth;
11680         jmethodID handle_channel_ready_meth;
11681         jmethodID handle_shutdown_meth;
11682         jmethodID handle_closing_signed_meth;
11683         jmethodID handle_update_add_htlc_meth;
11684         jmethodID handle_update_fulfill_htlc_meth;
11685         jmethodID handle_update_fail_htlc_meth;
11686         jmethodID handle_update_fail_malformed_htlc_meth;
11687         jmethodID handle_commitment_signed_meth;
11688         jmethodID handle_revoke_and_ack_meth;
11689         jmethodID handle_update_fee_meth;
11690         jmethodID handle_announcement_signatures_meth;
11691         jmethodID peer_disconnected_meth;
11692         jmethodID peer_connected_meth;
11693         jmethodID handle_channel_reestablish_meth;
11694         jmethodID handle_channel_update_meth;
11695         jmethodID handle_error_meth;
11696         jmethodID provided_node_features_meth;
11697         jmethodID provided_init_features_meth;
11698 } LDKChannelMessageHandler_JCalls;
11699 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
11700         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11701         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11702                 JNIEnv *env;
11703                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11704                 if (get_jenv_res == JNI_EDETACHED) {
11705                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11706                 } else {
11707                         DO_ASSERT(get_jenv_res == JNI_OK);
11708                 }
11709                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11710                 if (get_jenv_res == JNI_EDETACHED) {
11711                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11712                 }
11713                 FREE(j_calls);
11714         }
11715 }
11716 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
11717         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11718         JNIEnv *env;
11719         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11720         if (get_jenv_res == JNI_EDETACHED) {
11721                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11722         } else {
11723                 DO_ASSERT(get_jenv_res == JNI_OK);
11724         }
11725         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11726         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11727         LDKInitFeatures their_features_var = their_features;
11728         int64_t their_features_ref = 0;
11729         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11730         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11731         LDKOpenChannel msg_var = *msg;
11732         int64_t msg_ref = 0;
11733         msg_var = OpenChannel_clone(&msg_var);
11734         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11735         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11736         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11737         CHECK(obj != NULL);
11738         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11739         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11740                 (*env)->ExceptionDescribe(env);
11741                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
11742         }
11743         if (get_jenv_res == JNI_EDETACHED) {
11744                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11745         }
11746 }
11747 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
11748         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11749         JNIEnv *env;
11750         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11751         if (get_jenv_res == JNI_EDETACHED) {
11752                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11753         } else {
11754                 DO_ASSERT(get_jenv_res == JNI_OK);
11755         }
11756         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11757         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11758         LDKInitFeatures their_features_var = their_features;
11759         int64_t their_features_ref = 0;
11760         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11761         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11762         LDKAcceptChannel msg_var = *msg;
11763         int64_t msg_ref = 0;
11764         msg_var = AcceptChannel_clone(&msg_var);
11765         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11766         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11767         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11768         CHECK(obj != NULL);
11769         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11770         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11771                 (*env)->ExceptionDescribe(env);
11772                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
11773         }
11774         if (get_jenv_res == JNI_EDETACHED) {
11775                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11776         }
11777 }
11778 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
11779         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11780         JNIEnv *env;
11781         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11782         if (get_jenv_res == JNI_EDETACHED) {
11783                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11784         } else {
11785                 DO_ASSERT(get_jenv_res == JNI_OK);
11786         }
11787         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11788         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11789         LDKFundingCreated msg_var = *msg;
11790         int64_t msg_ref = 0;
11791         msg_var = FundingCreated_clone(&msg_var);
11792         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11793         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11794         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11795         CHECK(obj != NULL);
11796         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
11797         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11798                 (*env)->ExceptionDescribe(env);
11799                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
11800         }
11801         if (get_jenv_res == JNI_EDETACHED) {
11802                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11803         }
11804 }
11805 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
11806         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11807         JNIEnv *env;
11808         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11809         if (get_jenv_res == JNI_EDETACHED) {
11810                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11811         } else {
11812                 DO_ASSERT(get_jenv_res == JNI_OK);
11813         }
11814         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11815         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11816         LDKFundingSigned msg_var = *msg;
11817         int64_t msg_ref = 0;
11818         msg_var = FundingSigned_clone(&msg_var);
11819         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11820         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11821         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11822         CHECK(obj != NULL);
11823         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
11824         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11825                 (*env)->ExceptionDescribe(env);
11826                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
11827         }
11828         if (get_jenv_res == JNI_EDETACHED) {
11829                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11830         }
11831 }
11832 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
11833         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11834         JNIEnv *env;
11835         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11836         if (get_jenv_res == JNI_EDETACHED) {
11837                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11838         } else {
11839                 DO_ASSERT(get_jenv_res == JNI_OK);
11840         }
11841         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11842         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11843         LDKChannelReady msg_var = *msg;
11844         int64_t msg_ref = 0;
11845         msg_var = ChannelReady_clone(&msg_var);
11846         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11847         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11848         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11849         CHECK(obj != NULL);
11850         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
11851         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11852                 (*env)->ExceptionDescribe(env);
11853                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
11854         }
11855         if (get_jenv_res == JNI_EDETACHED) {
11856                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11857         }
11858 }
11859 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
11860         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11861         JNIEnv *env;
11862         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11863         if (get_jenv_res == JNI_EDETACHED) {
11864                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11865         } else {
11866                 DO_ASSERT(get_jenv_res == JNI_OK);
11867         }
11868         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11869         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11870         LDKInitFeatures their_features_var = *their_features;
11871         int64_t their_features_ref = 0;
11872         their_features_var = InitFeatures_clone(&their_features_var);
11873         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11874         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11875         LDKShutdown msg_var = *msg;
11876         int64_t msg_ref = 0;
11877         msg_var = Shutdown_clone(&msg_var);
11878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11879         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11880         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11881         CHECK(obj != NULL);
11882         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
11883         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11884                 (*env)->ExceptionDescribe(env);
11885                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
11886         }
11887         if (get_jenv_res == JNI_EDETACHED) {
11888                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11889         }
11890 }
11891 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11892         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11893         JNIEnv *env;
11894         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11895         if (get_jenv_res == JNI_EDETACHED) {
11896                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11897         } else {
11898                 DO_ASSERT(get_jenv_res == JNI_OK);
11899         }
11900         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11901         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11902         LDKClosingSigned msg_var = *msg;
11903         int64_t msg_ref = 0;
11904         msg_var = ClosingSigned_clone(&msg_var);
11905         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11906         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11907         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11908         CHECK(obj != NULL);
11909         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
11910         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11911                 (*env)->ExceptionDescribe(env);
11912                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
11913         }
11914         if (get_jenv_res == JNI_EDETACHED) {
11915                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11916         }
11917 }
11918 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11919         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11920         JNIEnv *env;
11921         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11922         if (get_jenv_res == JNI_EDETACHED) {
11923                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11924         } else {
11925                 DO_ASSERT(get_jenv_res == JNI_OK);
11926         }
11927         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11928         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11929         LDKUpdateAddHTLC msg_var = *msg;
11930         int64_t msg_ref = 0;
11931         msg_var = UpdateAddHTLC_clone(&msg_var);
11932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11933         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11934         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11935         CHECK(obj != NULL);
11936         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11937         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11938                 (*env)->ExceptionDescribe(env);
11939                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11940         }
11941         if (get_jenv_res == JNI_EDETACHED) {
11942                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11943         }
11944 }
11945 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11946         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11947         JNIEnv *env;
11948         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11949         if (get_jenv_res == JNI_EDETACHED) {
11950                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11951         } else {
11952                 DO_ASSERT(get_jenv_res == JNI_OK);
11953         }
11954         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11955         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11956         LDKUpdateFulfillHTLC msg_var = *msg;
11957         int64_t msg_ref = 0;
11958         msg_var = UpdateFulfillHTLC_clone(&msg_var);
11959         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11960         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11961         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11962         CHECK(obj != NULL);
11963         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11964         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11965                 (*env)->ExceptionDescribe(env);
11966                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11967         }
11968         if (get_jenv_res == JNI_EDETACHED) {
11969                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11970         }
11971 }
11972 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11973         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11974         JNIEnv *env;
11975         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11976         if (get_jenv_res == JNI_EDETACHED) {
11977                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11978         } else {
11979                 DO_ASSERT(get_jenv_res == JNI_OK);
11980         }
11981         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11982         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11983         LDKUpdateFailHTLC msg_var = *msg;
11984         int64_t msg_ref = 0;
11985         msg_var = UpdateFailHTLC_clone(&msg_var);
11986         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11987         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11988         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11989         CHECK(obj != NULL);
11990         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11991         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11992                 (*env)->ExceptionDescribe(env);
11993                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11994         }
11995         if (get_jenv_res == JNI_EDETACHED) {
11996                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11997         }
11998 }
11999 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
12000         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12001         JNIEnv *env;
12002         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12003         if (get_jenv_res == JNI_EDETACHED) {
12004                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12005         } else {
12006                 DO_ASSERT(get_jenv_res == JNI_OK);
12007         }
12008         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12009         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12010         LDKUpdateFailMalformedHTLC msg_var = *msg;
12011         int64_t msg_ref = 0;
12012         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
12013         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12014         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12015         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12016         CHECK(obj != NULL);
12017         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
12018         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12019                 (*env)->ExceptionDescribe(env);
12020                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
12021         }
12022         if (get_jenv_res == JNI_EDETACHED) {
12023                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12024         }
12025 }
12026 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
12027         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12028         JNIEnv *env;
12029         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12030         if (get_jenv_res == JNI_EDETACHED) {
12031                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12032         } else {
12033                 DO_ASSERT(get_jenv_res == JNI_OK);
12034         }
12035         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12036         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12037         LDKCommitmentSigned msg_var = *msg;
12038         int64_t msg_ref = 0;
12039         msg_var = CommitmentSigned_clone(&msg_var);
12040         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12041         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12042         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12043         CHECK(obj != NULL);
12044         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
12045         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12046                 (*env)->ExceptionDescribe(env);
12047                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
12048         }
12049         if (get_jenv_res == JNI_EDETACHED) {
12050                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12051         }
12052 }
12053 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
12054         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12055         JNIEnv *env;
12056         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12057         if (get_jenv_res == JNI_EDETACHED) {
12058                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12059         } else {
12060                 DO_ASSERT(get_jenv_res == JNI_OK);
12061         }
12062         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12063         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12064         LDKRevokeAndACK msg_var = *msg;
12065         int64_t msg_ref = 0;
12066         msg_var = RevokeAndACK_clone(&msg_var);
12067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12068         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12069         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12070         CHECK(obj != NULL);
12071         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
12072         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12073                 (*env)->ExceptionDescribe(env);
12074                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
12075         }
12076         if (get_jenv_res == JNI_EDETACHED) {
12077                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12078         }
12079 }
12080 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
12081         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12082         JNIEnv *env;
12083         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12084         if (get_jenv_res == JNI_EDETACHED) {
12085                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12086         } else {
12087                 DO_ASSERT(get_jenv_res == JNI_OK);
12088         }
12089         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12090         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12091         LDKUpdateFee msg_var = *msg;
12092         int64_t msg_ref = 0;
12093         msg_var = UpdateFee_clone(&msg_var);
12094         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12095         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12096         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12097         CHECK(obj != NULL);
12098         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
12099         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12100                 (*env)->ExceptionDescribe(env);
12101                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
12102         }
12103         if (get_jenv_res == JNI_EDETACHED) {
12104                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12105         }
12106 }
12107 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
12108         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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 their_node_id_arr = (*env)->NewByteArray(env, 33);
12117         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12118         LDKAnnouncementSignatures msg_var = *msg;
12119         int64_t msg_ref = 0;
12120         msg_var = AnnouncementSignatures_clone(&msg_var);
12121         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12122         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12123         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12124         CHECK(obj != NULL);
12125         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
12126         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12127                 (*env)->ExceptionDescribe(env);
12128                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
12129         }
12130         if (get_jenv_res == JNI_EDETACHED) {
12131                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12132         }
12133 }
12134 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
12135         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12136         JNIEnv *env;
12137         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12138         if (get_jenv_res == JNI_EDETACHED) {
12139                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12140         } else {
12141                 DO_ASSERT(get_jenv_res == JNI_OK);
12142         }
12143         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12144         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12145         jboolean no_connection_possible_conv = no_connection_possible;
12146         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12147         CHECK(obj != NULL);
12148         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
12149         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12150                 (*env)->ExceptionDescribe(env);
12151                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
12152         }
12153         if (get_jenv_res == JNI_EDETACHED) {
12154                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12155         }
12156 }
12157 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
12158         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12159         JNIEnv *env;
12160         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12161         if (get_jenv_res == JNI_EDETACHED) {
12162                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12163         } else {
12164                 DO_ASSERT(get_jenv_res == JNI_OK);
12165         }
12166         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12167         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12168         LDKInit msg_var = *msg;
12169         int64_t msg_ref = 0;
12170         msg_var = Init_clone(&msg_var);
12171         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12172         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12173         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12174         CHECK(obj != NULL);
12175         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
12176         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12177                 (*env)->ExceptionDescribe(env);
12178                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
12179         }
12180         if (get_jenv_res == JNI_EDETACHED) {
12181                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12182         }
12183 }
12184 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
12185         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12186         JNIEnv *env;
12187         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12188         if (get_jenv_res == JNI_EDETACHED) {
12189                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12190         } else {
12191                 DO_ASSERT(get_jenv_res == JNI_OK);
12192         }
12193         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12194         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12195         LDKChannelReestablish msg_var = *msg;
12196         int64_t msg_ref = 0;
12197         msg_var = ChannelReestablish_clone(&msg_var);
12198         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12199         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12200         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12201         CHECK(obj != NULL);
12202         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
12203         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12204                 (*env)->ExceptionDescribe(env);
12205                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
12206         }
12207         if (get_jenv_res == JNI_EDETACHED) {
12208                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12209         }
12210 }
12211 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
12212         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12213         JNIEnv *env;
12214         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12215         if (get_jenv_res == JNI_EDETACHED) {
12216                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12217         } else {
12218                 DO_ASSERT(get_jenv_res == JNI_OK);
12219         }
12220         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12221         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12222         LDKChannelUpdate msg_var = *msg;
12223         int64_t msg_ref = 0;
12224         msg_var = ChannelUpdate_clone(&msg_var);
12225         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12226         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12227         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12228         CHECK(obj != NULL);
12229         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
12230         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12231                 (*env)->ExceptionDescribe(env);
12232                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
12233         }
12234         if (get_jenv_res == JNI_EDETACHED) {
12235                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12236         }
12237 }
12238 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
12239         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12240         JNIEnv *env;
12241         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12242         if (get_jenv_res == JNI_EDETACHED) {
12243                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12244         } else {
12245                 DO_ASSERT(get_jenv_res == JNI_OK);
12246         }
12247         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12248         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12249         LDKErrorMessage msg_var = *msg;
12250         int64_t msg_ref = 0;
12251         msg_var = ErrorMessage_clone(&msg_var);
12252         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12253         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12254         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12255         CHECK(obj != NULL);
12256         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
12257         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12258                 (*env)->ExceptionDescribe(env);
12259                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
12260         }
12261         if (get_jenv_res == JNI_EDETACHED) {
12262                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12263         }
12264 }
12265 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
12266         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12267         JNIEnv *env;
12268         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12269         if (get_jenv_res == JNI_EDETACHED) {
12270                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12271         } else {
12272                 DO_ASSERT(get_jenv_res == JNI_OK);
12273         }
12274         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12275         CHECK(obj != NULL);
12276         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
12277         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12278                 (*env)->ExceptionDescribe(env);
12279                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
12280         }
12281         LDKNodeFeatures ret_conv;
12282         ret_conv.inner = untag_ptr(ret);
12283         ret_conv.is_owned = ptr_is_owned(ret);
12284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12285         if (get_jenv_res == JNI_EDETACHED) {
12286                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12287         }
12288         return ret_conv;
12289 }
12290 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12291         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
12292         JNIEnv *env;
12293         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12294         if (get_jenv_res == JNI_EDETACHED) {
12295                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12296         } else {
12297                 DO_ASSERT(get_jenv_res == JNI_OK);
12298         }
12299         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12300         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12301         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12302         CHECK(obj != NULL);
12303         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
12304         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12305                 (*env)->ExceptionDescribe(env);
12306                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
12307         }
12308         LDKInitFeatures ret_conv;
12309         ret_conv.inner = untag_ptr(ret);
12310         ret_conv.is_owned = ptr_is_owned(ret);
12311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12312         if (get_jenv_res == JNI_EDETACHED) {
12313                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12314         }
12315         return ret_conv;
12316 }
12317 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
12318         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
12319         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12320         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12321 }
12322 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12323         jclass c = (*env)->GetObjectClass(env, o);
12324         CHECK(c != NULL);
12325         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
12326         atomic_init(&calls->refcnt, 1);
12327         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12328         calls->o = (*env)->NewWeakGlobalRef(env, o);
12329         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
12330         CHECK(calls->handle_open_channel_meth != NULL);
12331         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
12332         CHECK(calls->handle_accept_channel_meth != NULL);
12333         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
12334         CHECK(calls->handle_funding_created_meth != NULL);
12335         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
12336         CHECK(calls->handle_funding_signed_meth != NULL);
12337         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
12338         CHECK(calls->handle_channel_ready_meth != NULL);
12339         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
12340         CHECK(calls->handle_shutdown_meth != NULL);
12341         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
12342         CHECK(calls->handle_closing_signed_meth != NULL);
12343         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
12344         CHECK(calls->handle_update_add_htlc_meth != NULL);
12345         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
12346         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
12347         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
12348         CHECK(calls->handle_update_fail_htlc_meth != NULL);
12349         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
12350         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
12351         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
12352         CHECK(calls->handle_commitment_signed_meth != NULL);
12353         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
12354         CHECK(calls->handle_revoke_and_ack_meth != NULL);
12355         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
12356         CHECK(calls->handle_update_fee_meth != NULL);
12357         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
12358         CHECK(calls->handle_announcement_signatures_meth != NULL);
12359         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
12360         CHECK(calls->peer_disconnected_meth != NULL);
12361         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12362         CHECK(calls->peer_connected_meth != NULL);
12363         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
12364         CHECK(calls->handle_channel_reestablish_meth != NULL);
12365         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
12366         CHECK(calls->handle_channel_update_meth != NULL);
12367         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
12368         CHECK(calls->handle_error_meth != NULL);
12369         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
12370         CHECK(calls->provided_node_features_meth != NULL);
12371         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
12372         CHECK(calls->provided_init_features_meth != NULL);
12373
12374         LDKChannelMessageHandler ret = {
12375                 .this_arg = (void*) calls,
12376                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
12377                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12378                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12379                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12380                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12381                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12382                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12383                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12384                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12385                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12386                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12387                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12388                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12389                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12390                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12391                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12392                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12393                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12394                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12395                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12396                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
12397                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
12398                 .free = LDKChannelMessageHandler_JCalls_free,
12399                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12400         };
12401         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12402         return ret;
12403 }
12404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12405         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12406         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12407         return tag_ptr(res_ptr, true);
12408 }
12409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12410         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
12411         return tag_ptr(&inp->MessageSendEventsProvider, false);
12412 }
12413 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) {
12414         void* this_arg_ptr = untag_ptr(this_arg);
12415         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12416         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12417         LDKPublicKey their_node_id_ref;
12418         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12419         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12420         LDKInitFeatures their_features_conv;
12421         their_features_conv.inner = untag_ptr(their_features);
12422         their_features_conv.is_owned = ptr_is_owned(their_features);
12423         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12424         their_features_conv = InitFeatures_clone(&their_features_conv);
12425         LDKOpenChannel msg_conv;
12426         msg_conv.inner = untag_ptr(msg);
12427         msg_conv.is_owned = ptr_is_owned(msg);
12428         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12429         msg_conv.is_owned = false;
12430         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12431 }
12432
12433 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) {
12434         void* this_arg_ptr = untag_ptr(this_arg);
12435         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12436         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12437         LDKPublicKey their_node_id_ref;
12438         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12439         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12440         LDKInitFeatures their_features_conv;
12441         their_features_conv.inner = untag_ptr(their_features);
12442         their_features_conv.is_owned = ptr_is_owned(their_features);
12443         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12444         their_features_conv = InitFeatures_clone(&their_features_conv);
12445         LDKAcceptChannel msg_conv;
12446         msg_conv.inner = untag_ptr(msg);
12447         msg_conv.is_owned = ptr_is_owned(msg);
12448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12449         msg_conv.is_owned = false;
12450         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
12451 }
12452
12453 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) {
12454         void* this_arg_ptr = untag_ptr(this_arg);
12455         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12456         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12457         LDKPublicKey their_node_id_ref;
12458         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12459         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12460         LDKFundingCreated msg_conv;
12461         msg_conv.inner = untag_ptr(msg);
12462         msg_conv.is_owned = ptr_is_owned(msg);
12463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12464         msg_conv.is_owned = false;
12465         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12466 }
12467
12468 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) {
12469         void* this_arg_ptr = untag_ptr(this_arg);
12470         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12471         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12472         LDKPublicKey their_node_id_ref;
12473         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12474         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12475         LDKFundingSigned msg_conv;
12476         msg_conv.inner = untag_ptr(msg);
12477         msg_conv.is_owned = ptr_is_owned(msg);
12478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12479         msg_conv.is_owned = false;
12480         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12481 }
12482
12483 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) {
12484         void* this_arg_ptr = untag_ptr(this_arg);
12485         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12486         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12487         LDKPublicKey their_node_id_ref;
12488         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12489         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12490         LDKChannelReady msg_conv;
12491         msg_conv.inner = untag_ptr(msg);
12492         msg_conv.is_owned = ptr_is_owned(msg);
12493         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12494         msg_conv.is_owned = false;
12495         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12496 }
12497
12498 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) {
12499         void* this_arg_ptr = untag_ptr(this_arg);
12500         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12501         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12502         LDKPublicKey their_node_id_ref;
12503         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12504         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12505         LDKInitFeatures their_features_conv;
12506         their_features_conv.inner = untag_ptr(their_features);
12507         their_features_conv.is_owned = ptr_is_owned(their_features);
12508         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
12509         their_features_conv.is_owned = false;
12510         LDKShutdown msg_conv;
12511         msg_conv.inner = untag_ptr(msg);
12512         msg_conv.is_owned = ptr_is_owned(msg);
12513         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12514         msg_conv.is_owned = false;
12515         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
12516 }
12517
12518 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) {
12519         void* this_arg_ptr = untag_ptr(this_arg);
12520         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12521         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12522         LDKPublicKey their_node_id_ref;
12523         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12524         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12525         LDKClosingSigned msg_conv;
12526         msg_conv.inner = untag_ptr(msg);
12527         msg_conv.is_owned = ptr_is_owned(msg);
12528         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12529         msg_conv.is_owned = false;
12530         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12531 }
12532
12533 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) {
12534         void* this_arg_ptr = untag_ptr(this_arg);
12535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12536         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12537         LDKPublicKey their_node_id_ref;
12538         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12539         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12540         LDKUpdateAddHTLC msg_conv;
12541         msg_conv.inner = untag_ptr(msg);
12542         msg_conv.is_owned = ptr_is_owned(msg);
12543         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12544         msg_conv.is_owned = false;
12545         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12546 }
12547
12548 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) {
12549         void* this_arg_ptr = untag_ptr(this_arg);
12550         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12551         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12552         LDKPublicKey their_node_id_ref;
12553         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12554         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12555         LDKUpdateFulfillHTLC msg_conv;
12556         msg_conv.inner = untag_ptr(msg);
12557         msg_conv.is_owned = ptr_is_owned(msg);
12558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12559         msg_conv.is_owned = false;
12560         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12561 }
12562
12563 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) {
12564         void* this_arg_ptr = untag_ptr(this_arg);
12565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12566         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12567         LDKPublicKey their_node_id_ref;
12568         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12569         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12570         LDKUpdateFailHTLC msg_conv;
12571         msg_conv.inner = untag_ptr(msg);
12572         msg_conv.is_owned = ptr_is_owned(msg);
12573         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12574         msg_conv.is_owned = false;
12575         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12576 }
12577
12578 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) {
12579         void* this_arg_ptr = untag_ptr(this_arg);
12580         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12581         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12582         LDKPublicKey their_node_id_ref;
12583         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12584         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12585         LDKUpdateFailMalformedHTLC msg_conv;
12586         msg_conv.inner = untag_ptr(msg);
12587         msg_conv.is_owned = ptr_is_owned(msg);
12588         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12589         msg_conv.is_owned = false;
12590         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12591 }
12592
12593 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) {
12594         void* this_arg_ptr = untag_ptr(this_arg);
12595         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12596         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12597         LDKPublicKey their_node_id_ref;
12598         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12599         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12600         LDKCommitmentSigned msg_conv;
12601         msg_conv.inner = untag_ptr(msg);
12602         msg_conv.is_owned = ptr_is_owned(msg);
12603         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12604         msg_conv.is_owned = false;
12605         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12606 }
12607
12608 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) {
12609         void* this_arg_ptr = untag_ptr(this_arg);
12610         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12611         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12612         LDKPublicKey their_node_id_ref;
12613         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12614         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12615         LDKRevokeAndACK msg_conv;
12616         msg_conv.inner = untag_ptr(msg);
12617         msg_conv.is_owned = ptr_is_owned(msg);
12618         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12619         msg_conv.is_owned = false;
12620         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12621 }
12622
12623 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) {
12624         void* this_arg_ptr = untag_ptr(this_arg);
12625         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12626         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12627         LDKPublicKey their_node_id_ref;
12628         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12629         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12630         LDKUpdateFee msg_conv;
12631         msg_conv.inner = untag_ptr(msg);
12632         msg_conv.is_owned = ptr_is_owned(msg);
12633         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12634         msg_conv.is_owned = false;
12635         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12636 }
12637
12638 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) {
12639         void* this_arg_ptr = untag_ptr(this_arg);
12640         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12641         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12642         LDKPublicKey their_node_id_ref;
12643         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12644         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12645         LDKAnnouncementSignatures msg_conv;
12646         msg_conv.inner = untag_ptr(msg);
12647         msg_conv.is_owned = ptr_is_owned(msg);
12648         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12649         msg_conv.is_owned = false;
12650         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12651 }
12652
12653 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) {
12654         void* this_arg_ptr = untag_ptr(this_arg);
12655         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12656         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12657         LDKPublicKey their_node_id_ref;
12658         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12659         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12660         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
12661 }
12662
12663 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) {
12664         void* this_arg_ptr = untag_ptr(this_arg);
12665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12666         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12667         LDKPublicKey their_node_id_ref;
12668         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12669         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12670         LDKInit msg_conv;
12671         msg_conv.inner = untag_ptr(msg);
12672         msg_conv.is_owned = ptr_is_owned(msg);
12673         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12674         msg_conv.is_owned = false;
12675         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12676 }
12677
12678 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) {
12679         void* this_arg_ptr = untag_ptr(this_arg);
12680         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12681         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12682         LDKPublicKey their_node_id_ref;
12683         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12684         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12685         LDKChannelReestablish msg_conv;
12686         msg_conv.inner = untag_ptr(msg);
12687         msg_conv.is_owned = ptr_is_owned(msg);
12688         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12689         msg_conv.is_owned = false;
12690         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12691 }
12692
12693 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) {
12694         void* this_arg_ptr = untag_ptr(this_arg);
12695         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12696         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12697         LDKPublicKey their_node_id_ref;
12698         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12699         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12700         LDKChannelUpdate msg_conv;
12701         msg_conv.inner = untag_ptr(msg);
12702         msg_conv.is_owned = ptr_is_owned(msg);
12703         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12704         msg_conv.is_owned = false;
12705         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12706 }
12707
12708 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) {
12709         void* this_arg_ptr = untag_ptr(this_arg);
12710         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12711         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12712         LDKPublicKey their_node_id_ref;
12713         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12714         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12715         LDKErrorMessage msg_conv;
12716         msg_conv.inner = untag_ptr(msg);
12717         msg_conv.is_owned = ptr_is_owned(msg);
12718         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12719         msg_conv.is_owned = false;
12720         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12721 }
12722
12723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
12724         void* this_arg_ptr = untag_ptr(this_arg);
12725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12726         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12727         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
12728         int64_t ret_ref = 0;
12729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12731         return ret_ref;
12732 }
12733
12734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
12735         void* this_arg_ptr = untag_ptr(this_arg);
12736         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12737         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12738         LDKPublicKey their_node_id_ref;
12739         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12740         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12741         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
12742         int64_t ret_ref = 0;
12743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12745         return ret_ref;
12746 }
12747
12748 typedef struct LDKRoutingMessageHandler_JCalls {
12749         atomic_size_t refcnt;
12750         JavaVM *vm;
12751         jweak o;
12752         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12753         jmethodID handle_node_announcement_meth;
12754         jmethodID handle_channel_announcement_meth;
12755         jmethodID handle_channel_update_meth;
12756         jmethodID get_next_channel_announcement_meth;
12757         jmethodID get_next_node_announcement_meth;
12758         jmethodID peer_connected_meth;
12759         jmethodID handle_reply_channel_range_meth;
12760         jmethodID handle_reply_short_channel_ids_end_meth;
12761         jmethodID handle_query_channel_range_meth;
12762         jmethodID handle_query_short_channel_ids_meth;
12763         jmethodID provided_node_features_meth;
12764         jmethodID provided_init_features_meth;
12765 } LDKRoutingMessageHandler_JCalls;
12766 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
12767         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12768         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12769                 JNIEnv *env;
12770                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12771                 if (get_jenv_res == JNI_EDETACHED) {
12772                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12773                 } else {
12774                         DO_ASSERT(get_jenv_res == JNI_OK);
12775                 }
12776                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12777                 if (get_jenv_res == JNI_EDETACHED) {
12778                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12779                 }
12780                 FREE(j_calls);
12781         }
12782 }
12783 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
12784         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12785         JNIEnv *env;
12786         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12787         if (get_jenv_res == JNI_EDETACHED) {
12788                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12789         } else {
12790                 DO_ASSERT(get_jenv_res == JNI_OK);
12791         }
12792         LDKNodeAnnouncement msg_var = *msg;
12793         int64_t msg_ref = 0;
12794         msg_var = NodeAnnouncement_clone(&msg_var);
12795         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12796         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12797         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12798         CHECK(obj != NULL);
12799         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
12800         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12801                 (*env)->ExceptionDescribe(env);
12802                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12803         }
12804         void* ret_ptr = untag_ptr(ret);
12805         CHECK_ACCESS(ret_ptr);
12806         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12807         FREE(untag_ptr(ret));
12808         if (get_jenv_res == JNI_EDETACHED) {
12809                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12810         }
12811         return ret_conv;
12812 }
12813 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
12814         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12815         JNIEnv *env;
12816         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12817         if (get_jenv_res == JNI_EDETACHED) {
12818                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12819         } else {
12820                 DO_ASSERT(get_jenv_res == JNI_OK);
12821         }
12822         LDKChannelAnnouncement msg_var = *msg;
12823         int64_t msg_ref = 0;
12824         msg_var = ChannelAnnouncement_clone(&msg_var);
12825         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12826         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12827         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12828         CHECK(obj != NULL);
12829         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
12830         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12831                 (*env)->ExceptionDescribe(env);
12832                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12833         }
12834         void* ret_ptr = untag_ptr(ret);
12835         CHECK_ACCESS(ret_ptr);
12836         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12837         FREE(untag_ptr(ret));
12838         if (get_jenv_res == JNI_EDETACHED) {
12839                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12840         }
12841         return ret_conv;
12842 }
12843 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
12844         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12845         JNIEnv *env;
12846         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12847         if (get_jenv_res == JNI_EDETACHED) {
12848                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12849         } else {
12850                 DO_ASSERT(get_jenv_res == JNI_OK);
12851         }
12852         LDKChannelUpdate msg_var = *msg;
12853         int64_t msg_ref = 0;
12854         msg_var = ChannelUpdate_clone(&msg_var);
12855         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12856         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12857         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12858         CHECK(obj != NULL);
12859         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
12860         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12861                 (*env)->ExceptionDescribe(env);
12862                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
12863         }
12864         void* ret_ptr = untag_ptr(ret);
12865         CHECK_ACCESS(ret_ptr);
12866         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12867         FREE(untag_ptr(ret));
12868         if (get_jenv_res == JNI_EDETACHED) {
12869                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12870         }
12871         return ret_conv;
12872 }
12873 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
12874         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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         int64_t starting_point_conv = starting_point;
12883         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12884         CHECK(obj != NULL);
12885         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
12886         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12887                 (*env)->ExceptionDescribe(env);
12888                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12889         }
12890         void* ret_ptr = untag_ptr(ret);
12891         CHECK_ACCESS(ret_ptr);
12892         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
12893         FREE(untag_ptr(ret));
12894         if (get_jenv_res == JNI_EDETACHED) {
12895                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12896         }
12897         return ret_conv;
12898 }
12899 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) {
12900         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12901         JNIEnv *env;
12902         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12903         if (get_jenv_res == JNI_EDETACHED) {
12904                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12905         } else {
12906                 DO_ASSERT(get_jenv_res == JNI_OK);
12907         }
12908         int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
12909         (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
12910         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12911         CHECK(obj != NULL);
12912         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_arr);
12913         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12914                 (*env)->ExceptionDescribe(env);
12915                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12916         }
12917         LDKNodeAnnouncement ret_conv;
12918         ret_conv.inner = untag_ptr(ret);
12919         ret_conv.is_owned = ptr_is_owned(ret);
12920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12921         if (get_jenv_res == JNI_EDETACHED) {
12922                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12923         }
12924         return ret_conv;
12925 }
12926 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
12927         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12928         JNIEnv *env;
12929         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12930         if (get_jenv_res == JNI_EDETACHED) {
12931                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12932         } else {
12933                 DO_ASSERT(get_jenv_res == JNI_OK);
12934         }
12935         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12936         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12937         LDKInit init_var = *init;
12938         int64_t init_ref = 0;
12939         init_var = Init_clone(&init_var);
12940         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12941         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
12942         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12943         CHECK(obj != NULL);
12944         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
12945         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12946                 (*env)->ExceptionDescribe(env);
12947                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
12948         }
12949         if (get_jenv_res == JNI_EDETACHED) {
12950                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12951         }
12952 }
12953 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12954         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12955         JNIEnv *env;
12956         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12957         if (get_jenv_res == JNI_EDETACHED) {
12958                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12959         } else {
12960                 DO_ASSERT(get_jenv_res == JNI_OK);
12961         }
12962         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12963         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12964         LDKReplyChannelRange msg_var = msg;
12965         int64_t msg_ref = 0;
12966         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12967         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12968         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12969         CHECK(obj != NULL);
12970         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
12971         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12972                 (*env)->ExceptionDescribe(env);
12973                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12974         }
12975         void* ret_ptr = untag_ptr(ret);
12976         CHECK_ACCESS(ret_ptr);
12977         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12978         FREE(untag_ptr(ret));
12979         if (get_jenv_res == JNI_EDETACHED) {
12980                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12981         }
12982         return ret_conv;
12983 }
12984 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12985         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12986         JNIEnv *env;
12987         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12988         if (get_jenv_res == JNI_EDETACHED) {
12989                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12990         } else {
12991                 DO_ASSERT(get_jenv_res == JNI_OK);
12992         }
12993         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12994         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12995         LDKReplyShortChannelIdsEnd msg_var = msg;
12996         int64_t msg_ref = 0;
12997         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12998         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12999         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13000         CHECK(obj != NULL);
13001         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
13002         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13003                 (*env)->ExceptionDescribe(env);
13004                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
13005         }
13006         void* ret_ptr = untag_ptr(ret);
13007         CHECK_ACCESS(ret_ptr);
13008         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13009         FREE(untag_ptr(ret));
13010         if (get_jenv_res == JNI_EDETACHED) {
13011                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13012         }
13013         return ret_conv;
13014 }
13015 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
13016         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13017         JNIEnv *env;
13018         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13019         if (get_jenv_res == JNI_EDETACHED) {
13020                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13021         } else {
13022                 DO_ASSERT(get_jenv_res == JNI_OK);
13023         }
13024         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13025         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13026         LDKQueryChannelRange msg_var = msg;
13027         int64_t msg_ref = 0;
13028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13029         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13030         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13031         CHECK(obj != NULL);
13032         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
13033         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13034                 (*env)->ExceptionDescribe(env);
13035                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
13036         }
13037         void* ret_ptr = untag_ptr(ret);
13038         CHECK_ACCESS(ret_ptr);
13039         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13040         FREE(untag_ptr(ret));
13041         if (get_jenv_res == JNI_EDETACHED) {
13042                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13043         }
13044         return ret_conv;
13045 }
13046 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
13047         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13048         JNIEnv *env;
13049         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13050         if (get_jenv_res == JNI_EDETACHED) {
13051                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13052         } else {
13053                 DO_ASSERT(get_jenv_res == JNI_OK);
13054         }
13055         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13056         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13057         LDKQueryShortChannelIds msg_var = msg;
13058         int64_t msg_ref = 0;
13059         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13060         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13061         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13062         CHECK(obj != NULL);
13063         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
13064         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13065                 (*env)->ExceptionDescribe(env);
13066                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
13067         }
13068         void* ret_ptr = untag_ptr(ret);
13069         CHECK_ACCESS(ret_ptr);
13070         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13071         FREE(untag_ptr(ret));
13072         if (get_jenv_res == JNI_EDETACHED) {
13073                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13074         }
13075         return ret_conv;
13076 }
13077 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
13078         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13079         JNIEnv *env;
13080         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13081         if (get_jenv_res == JNI_EDETACHED) {
13082                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13083         } else {
13084                 DO_ASSERT(get_jenv_res == JNI_OK);
13085         }
13086         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13087         CHECK(obj != NULL);
13088         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
13089         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13090                 (*env)->ExceptionDescribe(env);
13091                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
13092         }
13093         LDKNodeFeatures ret_conv;
13094         ret_conv.inner = untag_ptr(ret);
13095         ret_conv.is_owned = ptr_is_owned(ret);
13096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13097         if (get_jenv_res == JNI_EDETACHED) {
13098                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13099         }
13100         return ret_conv;
13101 }
13102 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13103         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
13104         JNIEnv *env;
13105         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13106         if (get_jenv_res == JNI_EDETACHED) {
13107                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13108         } else {
13109                 DO_ASSERT(get_jenv_res == JNI_OK);
13110         }
13111         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13112         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13113         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13114         CHECK(obj != NULL);
13115         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
13116         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13117                 (*env)->ExceptionDescribe(env);
13118                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
13119         }
13120         LDKInitFeatures ret_conv;
13121         ret_conv.inner = untag_ptr(ret);
13122         ret_conv.is_owned = ptr_is_owned(ret);
13123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13124         if (get_jenv_res == JNI_EDETACHED) {
13125                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13126         }
13127         return ret_conv;
13128 }
13129 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
13130         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
13131         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13132         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
13133 }
13134 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13135         jclass c = (*env)->GetObjectClass(env, o);
13136         CHECK(c != NULL);
13137         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
13138         atomic_init(&calls->refcnt, 1);
13139         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13140         calls->o = (*env)->NewWeakGlobalRef(env, o);
13141         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
13142         CHECK(calls->handle_node_announcement_meth != NULL);
13143         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
13144         CHECK(calls->handle_channel_announcement_meth != NULL);
13145         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
13146         CHECK(calls->handle_channel_update_meth != NULL);
13147         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
13148         CHECK(calls->get_next_channel_announcement_meth != NULL);
13149         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "([B)J");
13150         CHECK(calls->get_next_node_announcement_meth != NULL);
13151         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
13152         CHECK(calls->peer_connected_meth != NULL);
13153         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
13154         CHECK(calls->handle_reply_channel_range_meth != NULL);
13155         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
13156         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
13157         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
13158         CHECK(calls->handle_query_channel_range_meth != NULL);
13159         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
13160         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
13161         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
13162         CHECK(calls->provided_node_features_meth != NULL);
13163         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
13164         CHECK(calls->provided_init_features_meth != NULL);
13165
13166         LDKRoutingMessageHandler ret = {
13167                 .this_arg = (void*) calls,
13168                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
13169                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
13170                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
13171                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
13172                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
13173                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
13174                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
13175                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
13176                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
13177                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
13178                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
13179                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
13180                 .free = LDKRoutingMessageHandler_JCalls_free,
13181                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
13182         };
13183         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
13184         return ret;
13185 }
13186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
13187         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13188         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
13189         return tag_ptr(res_ptr, true);
13190 }
13191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
13192         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
13193         return tag_ptr(&inp->MessageSendEventsProvider, false);
13194 }
13195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13196         void* this_arg_ptr = untag_ptr(this_arg);
13197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13198         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13199         LDKNodeAnnouncement msg_conv;
13200         msg_conv.inner = untag_ptr(msg);
13201         msg_conv.is_owned = ptr_is_owned(msg);
13202         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13203         msg_conv.is_owned = false;
13204         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13205         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
13206         return tag_ptr(ret_conv, true);
13207 }
13208
13209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13210         void* this_arg_ptr = untag_ptr(this_arg);
13211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13212         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13213         LDKChannelAnnouncement msg_conv;
13214         msg_conv.inner = untag_ptr(msg);
13215         msg_conv.is_owned = ptr_is_owned(msg);
13216         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13217         msg_conv.is_owned = false;
13218         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13219         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
13220         return tag_ptr(ret_conv, true);
13221 }
13222
13223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
13224         void* this_arg_ptr = untag_ptr(this_arg);
13225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13226         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13227         LDKChannelUpdate msg_conv;
13228         msg_conv.inner = untag_ptr(msg);
13229         msg_conv.is_owned = ptr_is_owned(msg);
13230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13231         msg_conv.is_owned = false;
13232         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13233         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
13234         return tag_ptr(ret_conv, true);
13235 }
13236
13237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) {
13238         void* this_arg_ptr = untag_ptr(this_arg);
13239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13240         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13241         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
13242         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
13243         int64_t ret_ref = tag_ptr(ret_copy, true);
13244         return ret_ref;
13245 }
13246
13247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point) {
13248         void* this_arg_ptr = untag_ptr(this_arg);
13249         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13250         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13251         LDKPublicKey starting_point_ref;
13252         CHECK((*env)->GetArrayLength(env, starting_point) == 33);
13253         (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
13254         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref);
13255         int64_t ret_ref = 0;
13256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13258         return ret_ref;
13259 }
13260
13261 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) {
13262         void* this_arg_ptr = untag_ptr(this_arg);
13263         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13264         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13265         LDKPublicKey their_node_id_ref;
13266         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13267         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13268         LDKInit init_conv;
13269         init_conv.inner = untag_ptr(init);
13270         init_conv.is_owned = ptr_is_owned(init);
13271         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13272         init_conv.is_owned = false;
13273         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
13274 }
13275
13276 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) {
13277         void* this_arg_ptr = untag_ptr(this_arg);
13278         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13279         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13280         LDKPublicKey their_node_id_ref;
13281         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13282         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13283         LDKReplyChannelRange msg_conv;
13284         msg_conv.inner = untag_ptr(msg);
13285         msg_conv.is_owned = ptr_is_owned(msg);
13286         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13287         msg_conv = ReplyChannelRange_clone(&msg_conv);
13288         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13289         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13290         return tag_ptr(ret_conv, true);
13291 }
13292
13293 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) {
13294         void* this_arg_ptr = untag_ptr(this_arg);
13295         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13296         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13297         LDKPublicKey their_node_id_ref;
13298         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13299         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13300         LDKReplyShortChannelIdsEnd msg_conv;
13301         msg_conv.inner = untag_ptr(msg);
13302         msg_conv.is_owned = ptr_is_owned(msg);
13303         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13304         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
13305         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13306         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13307         return tag_ptr(ret_conv, true);
13308 }
13309
13310 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) {
13311         void* this_arg_ptr = untag_ptr(this_arg);
13312         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13313         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13314         LDKPublicKey their_node_id_ref;
13315         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13316         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13317         LDKQueryChannelRange msg_conv;
13318         msg_conv.inner = untag_ptr(msg);
13319         msg_conv.is_owned = ptr_is_owned(msg);
13320         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13321         msg_conv = QueryChannelRange_clone(&msg_conv);
13322         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13323         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13324         return tag_ptr(ret_conv, true);
13325 }
13326
13327 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) {
13328         void* this_arg_ptr = untag_ptr(this_arg);
13329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13330         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13331         LDKPublicKey their_node_id_ref;
13332         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13333         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13334         LDKQueryShortChannelIds msg_conv;
13335         msg_conv.inner = untag_ptr(msg);
13336         msg_conv.is_owned = ptr_is_owned(msg);
13337         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13338         msg_conv = QueryShortChannelIds_clone(&msg_conv);
13339         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13340         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
13341         return tag_ptr(ret_conv, true);
13342 }
13343
13344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
13345         void* this_arg_ptr = untag_ptr(this_arg);
13346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13347         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13348         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13349         int64_t ret_ref = 0;
13350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13352         return ret_ref;
13353 }
13354
13355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
13356         void* this_arg_ptr = untag_ptr(this_arg);
13357         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13358         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
13359         LDKPublicKey their_node_id_ref;
13360         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13361         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13362         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13363         int64_t ret_ref = 0;
13364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13366         return ret_ref;
13367 }
13368
13369 typedef struct LDKOnionMessageHandler_JCalls {
13370         atomic_size_t refcnt;
13371         JavaVM *vm;
13372         jweak o;
13373         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
13374         jmethodID handle_onion_message_meth;
13375         jmethodID peer_connected_meth;
13376         jmethodID peer_disconnected_meth;
13377         jmethodID provided_node_features_meth;
13378         jmethodID provided_init_features_meth;
13379 } LDKOnionMessageHandler_JCalls;
13380 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
13381         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13382         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13383                 JNIEnv *env;
13384                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13385                 if (get_jenv_res == JNI_EDETACHED) {
13386                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13387                 } else {
13388                         DO_ASSERT(get_jenv_res == JNI_OK);
13389                 }
13390                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13391                 if (get_jenv_res == JNI_EDETACHED) {
13392                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13393                 }
13394                 FREE(j_calls);
13395         }
13396 }
13397 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
13398         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13399         JNIEnv *env;
13400         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13401         if (get_jenv_res == JNI_EDETACHED) {
13402                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13403         } else {
13404                 DO_ASSERT(get_jenv_res == JNI_OK);
13405         }
13406         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
13407         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
13408         LDKOnionMessage msg_var = *msg;
13409         int64_t msg_ref = 0;
13410         msg_var = OnionMessage_clone(&msg_var);
13411         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13412         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13413         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13414         CHECK(obj != NULL);
13415         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
13416         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13417                 (*env)->ExceptionDescribe(env);
13418                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
13419         }
13420         if (get_jenv_res == JNI_EDETACHED) {
13421                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13422         }
13423 }
13424 void peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
13425         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13426         JNIEnv *env;
13427         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13428         if (get_jenv_res == JNI_EDETACHED) {
13429                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13430         } else {
13431                 DO_ASSERT(get_jenv_res == JNI_OK);
13432         }
13433         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13434         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13435         LDKInit init_var = *init;
13436         int64_t init_ref = 0;
13437         init_var = Init_clone(&init_var);
13438         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13439         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13440         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13441         CHECK(obj != NULL);
13442         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
13443         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13444                 (*env)->ExceptionDescribe(env);
13445                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
13446         }
13447         if (get_jenv_res == JNI_EDETACHED) {
13448                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13449         }
13450 }
13451 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
13452         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13453         JNIEnv *env;
13454         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13455         if (get_jenv_res == JNI_EDETACHED) {
13456                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13457         } else {
13458                 DO_ASSERT(get_jenv_res == JNI_OK);
13459         }
13460         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13461         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13462         jboolean no_connection_possible_conv = no_connection_possible;
13463         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13464         CHECK(obj != NULL);
13465         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
13466         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13467                 (*env)->ExceptionDescribe(env);
13468                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
13469         }
13470         if (get_jenv_res == JNI_EDETACHED) {
13471                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13472         }
13473 }
13474 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
13475         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13476         JNIEnv *env;
13477         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13478         if (get_jenv_res == JNI_EDETACHED) {
13479                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13480         } else {
13481                 DO_ASSERT(get_jenv_res == JNI_OK);
13482         }
13483         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13484         CHECK(obj != NULL);
13485         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
13486         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13487                 (*env)->ExceptionDescribe(env);
13488                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
13489         }
13490         LDKNodeFeatures ret_conv;
13491         ret_conv.inner = untag_ptr(ret);
13492         ret_conv.is_owned = ptr_is_owned(ret);
13493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13494         if (get_jenv_res == JNI_EDETACHED) {
13495                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13496         }
13497         return ret_conv;
13498 }
13499 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13500         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13501         JNIEnv *env;
13502         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13503         if (get_jenv_res == JNI_EDETACHED) {
13504                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13505         } else {
13506                 DO_ASSERT(get_jenv_res == JNI_OK);
13507         }
13508         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
13509         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
13510         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13511         CHECK(obj != NULL);
13512         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
13513         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13514                 (*env)->ExceptionDescribe(env);
13515                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
13516         }
13517         LDKInitFeatures ret_conv;
13518         ret_conv.inner = untag_ptr(ret);
13519         ret_conv.is_owned = ptr_is_owned(ret);
13520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13521         if (get_jenv_res == JNI_EDETACHED) {
13522                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13523         }
13524         return ret_conv;
13525 }
13526 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
13527         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
13528         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13529         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
13530 }
13531 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
13532         jclass c = (*env)->GetObjectClass(env, o);
13533         CHECK(c != NULL);
13534         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
13535         atomic_init(&calls->refcnt, 1);
13536         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13537         calls->o = (*env)->NewWeakGlobalRef(env, o);
13538         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
13539         CHECK(calls->handle_onion_message_meth != NULL);
13540         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
13541         CHECK(calls->peer_connected_meth != NULL);
13542         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
13543         CHECK(calls->peer_disconnected_meth != NULL);
13544         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
13545         CHECK(calls->provided_node_features_meth != NULL);
13546         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
13547         CHECK(calls->provided_init_features_meth != NULL);
13548
13549         LDKOnionMessageHandler ret = {
13550                 .this_arg = (void*) calls,
13551                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
13552                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
13553                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
13554                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
13555                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
13556                 .free = LDKOnionMessageHandler_JCalls_free,
13557                 .OnionMessageProvider = LDKOnionMessageProvider_init(env, clz, OnionMessageProvider),
13558         };
13559         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
13560         return ret;
13561 }
13562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
13563         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
13564         *res_ptr = LDKOnionMessageHandler_init(env, clz, o, OnionMessageProvider);
13565         return tag_ptr(res_ptr, true);
13566 }
13567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t arg) {
13568         LDKOnionMessageHandler *inp = (LDKOnionMessageHandler *)untag_ptr(arg);
13569         return tag_ptr(&inp->OnionMessageProvider, false);
13570 }
13571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
13572         void* this_arg_ptr = untag_ptr(this_arg);
13573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13574         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13575         LDKPublicKey peer_node_id_ref;
13576         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
13577         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
13578         LDKOnionMessage msg_conv;
13579         msg_conv.inner = untag_ptr(msg);
13580         msg_conv.is_owned = ptr_is_owned(msg);
13581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13582         msg_conv.is_owned = false;
13583         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
13584 }
13585
13586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
13587         void* this_arg_ptr = untag_ptr(this_arg);
13588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13589         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13590         LDKPublicKey their_node_id_ref;
13591         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13592         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13593         LDKInit init_conv;
13594         init_conv.inner = untag_ptr(init);
13595         init_conv.is_owned = ptr_is_owned(init);
13596         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13597         init_conv.is_owned = false;
13598         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
13599 }
13600
13601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
13602         void* this_arg_ptr = untag_ptr(this_arg);
13603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13604         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13605         LDKPublicKey their_node_id_ref;
13606         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13607         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13608         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
13609 }
13610
13611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
13612         void* this_arg_ptr = untag_ptr(this_arg);
13613         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13614         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13615         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13616         int64_t ret_ref = 0;
13617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13619         return ret_ref;
13620 }
13621
13622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
13623         void* this_arg_ptr = untag_ptr(this_arg);
13624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13625         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13626         LDKPublicKey their_node_id_ref;
13627         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
13628         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
13629         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13630         int64_t ret_ref = 0;
13631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13633         return ret_ref;
13634 }
13635
13636 typedef struct LDKCustomMessageReader_JCalls {
13637         atomic_size_t refcnt;
13638         JavaVM *vm;
13639         jweak o;
13640         jmethodID read_meth;
13641 } LDKCustomMessageReader_JCalls;
13642 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13643         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13644         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13645                 JNIEnv *env;
13646                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13647                 if (get_jenv_res == JNI_EDETACHED) {
13648                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13649                 } else {
13650                         DO_ASSERT(get_jenv_res == JNI_OK);
13651                 }
13652                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13653                 if (get_jenv_res == JNI_EDETACHED) {
13654                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13655                 }
13656                 FREE(j_calls);
13657         }
13658 }
13659 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13660         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13661         JNIEnv *env;
13662         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13663         if (get_jenv_res == JNI_EDETACHED) {
13664                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13665         } else {
13666                 DO_ASSERT(get_jenv_res == JNI_OK);
13667         }
13668         int16_t message_type_conv = message_type;
13669         LDKu8slice buffer_var = buffer;
13670         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
13671         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
13672         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13673         CHECK(obj != NULL);
13674         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
13675         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13676                 (*env)->ExceptionDescribe(env);
13677                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
13678         }
13679         void* ret_ptr = untag_ptr(ret);
13680         CHECK_ACCESS(ret_ptr);
13681         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13682         FREE(untag_ptr(ret));
13683         if (get_jenv_res == JNI_EDETACHED) {
13684                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13685         }
13686         return ret_conv;
13687 }
13688 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13689         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13690         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13691 }
13692 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
13693         jclass c = (*env)->GetObjectClass(env, o);
13694         CHECK(c != NULL);
13695         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13696         atomic_init(&calls->refcnt, 1);
13697         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13698         calls->o = (*env)->NewWeakGlobalRef(env, o);
13699         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
13700         CHECK(calls->read_meth != NULL);
13701
13702         LDKCustomMessageReader ret = {
13703                 .this_arg = (void*) calls,
13704                 .read = read_LDKCustomMessageReader_jcall,
13705                 .free = LDKCustomMessageReader_JCalls_free,
13706         };
13707         return ret;
13708 }
13709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
13710         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13711         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
13712         return tag_ptr(res_ptr, true);
13713 }
13714 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) {
13715         void* this_arg_ptr = untag_ptr(this_arg);
13716         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13717         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
13718         LDKu8slice buffer_ref;
13719         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
13720         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
13721         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
13722         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
13723         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
13724         return tag_ptr(ret_conv, true);
13725 }
13726
13727 typedef struct LDKCustomMessageHandler_JCalls {
13728         atomic_size_t refcnt;
13729         JavaVM *vm;
13730         jweak o;
13731         LDKCustomMessageReader_JCalls* CustomMessageReader;
13732         jmethodID handle_custom_message_meth;
13733         jmethodID get_and_clear_pending_msg_meth;
13734 } LDKCustomMessageHandler_JCalls;
13735 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
13736         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13737         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13738                 JNIEnv *env;
13739                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13740                 if (get_jenv_res == JNI_EDETACHED) {
13741                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13742                 } else {
13743                         DO_ASSERT(get_jenv_res == JNI_OK);
13744                 }
13745                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13746                 if (get_jenv_res == JNI_EDETACHED) {
13747                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13748                 }
13749                 FREE(j_calls);
13750         }
13751 }
13752 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
13753         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13754         JNIEnv *env;
13755         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13756         if (get_jenv_res == JNI_EDETACHED) {
13757                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13758         } else {
13759                 DO_ASSERT(get_jenv_res == JNI_OK);
13760         }
13761         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
13762         *msg_ret = msg;
13763         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
13764         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
13765         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13766         CHECK(obj != NULL);
13767         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
13768         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13769                 (*env)->ExceptionDescribe(env);
13770                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
13771         }
13772         void* ret_ptr = untag_ptr(ret);
13773         CHECK_ACCESS(ret_ptr);
13774         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13775         FREE(untag_ptr(ret));
13776         if (get_jenv_res == JNI_EDETACHED) {
13777                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13778         }
13779         return ret_conv;
13780 }
13781 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
13782         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13783         JNIEnv *env;
13784         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13785         if (get_jenv_res == JNI_EDETACHED) {
13786                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13787         } else {
13788                 DO_ASSERT(get_jenv_res == JNI_OK);
13789         }
13790         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13791         CHECK(obj != NULL);
13792         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
13793         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13794                 (*env)->ExceptionDescribe(env);
13795                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
13796         }
13797         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
13798         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13799         if (ret_constr.datalen > 0)
13800                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13801         else
13802                 ret_constr.data = NULL;
13803         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13804         for (size_t z = 0; z < ret_constr.datalen; z++) {
13805                 int64_t ret_conv_25 = ret_vals[z];
13806                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
13807                 CHECK_ACCESS(ret_conv_25_ptr);
13808                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
13809                 FREE(untag_ptr(ret_conv_25));
13810                 ret_constr.data[z] = ret_conv_25_conv;
13811         }
13812         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13813         if (get_jenv_res == JNI_EDETACHED) {
13814                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13815         }
13816         return ret_constr;
13817 }
13818 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
13819         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
13820         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13821         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
13822 }
13823 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13824         jclass c = (*env)->GetObjectClass(env, o);
13825         CHECK(c != NULL);
13826         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
13827         atomic_init(&calls->refcnt, 1);
13828         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13829         calls->o = (*env)->NewWeakGlobalRef(env, o);
13830         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
13831         CHECK(calls->handle_custom_message_meth != NULL);
13832         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
13833         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
13834
13835         LDKCustomMessageHandler ret = {
13836                 .this_arg = (void*) calls,
13837                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
13838                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
13839                 .free = LDKCustomMessageHandler_JCalls_free,
13840                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
13841         };
13842         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
13843         return ret;
13844 }
13845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
13846         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
13847         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
13848         return tag_ptr(res_ptr, true);
13849 }
13850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
13851         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
13852         return tag_ptr(&inp->CustomMessageReader, false);
13853 }
13854 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) {
13855         void* this_arg_ptr = untag_ptr(this_arg);
13856         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13857         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13858         void* msg_ptr = untag_ptr(msg);
13859         CHECK_ACCESS(msg_ptr);
13860         LDKType msg_conv = *(LDKType*)(msg_ptr);
13861         if (msg_conv.free == LDKType_JCalls_free) {
13862                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13863                 LDKType_JCalls_cloned(&msg_conv);
13864         }
13865         LDKPublicKey sender_node_id_ref;
13866         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
13867         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
13868         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13869         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
13870         return tag_ptr(ret_conv, true);
13871 }
13872
13873 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
13874         void* this_arg_ptr = untag_ptr(this_arg);
13875         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13876         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13877         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
13878         int64_tArray ret_arr = NULL;
13879         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13880         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13881         for (size_t z = 0; z < ret_var.datalen; z++) {
13882                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13883                 *ret_conv_25_conv = ret_var.data[z];
13884                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
13885         }
13886         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13887         FREE(ret_var.data);
13888         return ret_arr;
13889 }
13890
13891 typedef struct LDKSocketDescriptor_JCalls {
13892         atomic_size_t refcnt;
13893         JavaVM *vm;
13894         jweak o;
13895         jmethodID send_data_meth;
13896         jmethodID disconnect_socket_meth;
13897         jmethodID eq_meth;
13898         jmethodID hash_meth;
13899 } LDKSocketDescriptor_JCalls;
13900 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
13901         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13902         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13903                 JNIEnv *env;
13904                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13905                 if (get_jenv_res == JNI_EDETACHED) {
13906                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13907                 } else {
13908                         DO_ASSERT(get_jenv_res == JNI_OK);
13909                 }
13910                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13911                 if (get_jenv_res == JNI_EDETACHED) {
13912                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13913                 }
13914                 FREE(j_calls);
13915         }
13916 }
13917 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
13918         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13919         JNIEnv *env;
13920         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13921         if (get_jenv_res == JNI_EDETACHED) {
13922                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13923         } else {
13924                 DO_ASSERT(get_jenv_res == JNI_OK);
13925         }
13926         LDKu8slice data_var = data;
13927         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
13928         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
13929         jboolean resume_read_conv = resume_read;
13930         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13931         CHECK(obj != NULL);
13932         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
13933         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13934                 (*env)->ExceptionDescribe(env);
13935                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
13936         }
13937         if (get_jenv_res == JNI_EDETACHED) {
13938                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13939         }
13940         return ret;
13941 }
13942 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
13943         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13944         JNIEnv *env;
13945         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13946         if (get_jenv_res == JNI_EDETACHED) {
13947                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13948         } else {
13949                 DO_ASSERT(get_jenv_res == JNI_OK);
13950         }
13951         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13952         CHECK(obj != NULL);
13953         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
13954         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13955                 (*env)->ExceptionDescribe(env);
13956                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
13957         }
13958         if (get_jenv_res == JNI_EDETACHED) {
13959                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13960         }
13961 }
13962 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
13963         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13964         JNIEnv *env;
13965         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13966         if (get_jenv_res == JNI_EDETACHED) {
13967                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13968         } else {
13969                 DO_ASSERT(get_jenv_res == JNI_OK);
13970         }
13971         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13972         *other_arg_clone = SocketDescriptor_clone(other_arg);
13973         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13974         CHECK(obj != NULL);
13975         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
13976         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13977                 (*env)->ExceptionDescribe(env);
13978                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
13979         }
13980         if (get_jenv_res == JNI_EDETACHED) {
13981                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13982         }
13983         return ret;
13984 }
13985 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
13986         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13987         JNIEnv *env;
13988         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13989         if (get_jenv_res == JNI_EDETACHED) {
13990                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13991         } else {
13992                 DO_ASSERT(get_jenv_res == JNI_OK);
13993         }
13994         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13995         CHECK(obj != NULL);
13996         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
13997         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13998                 (*env)->ExceptionDescribe(env);
13999                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
14000         }
14001         if (get_jenv_res == JNI_EDETACHED) {
14002                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14003         }
14004         return ret;
14005 }
14006 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
14007         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
14008         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14009 }
14010 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
14011         jclass c = (*env)->GetObjectClass(env, o);
14012         CHECK(c != NULL);
14013         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
14014         atomic_init(&calls->refcnt, 1);
14015         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14016         calls->o = (*env)->NewWeakGlobalRef(env, o);
14017         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
14018         CHECK(calls->send_data_meth != NULL);
14019         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
14020         CHECK(calls->disconnect_socket_meth != NULL);
14021         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
14022         CHECK(calls->eq_meth != NULL);
14023         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
14024         CHECK(calls->hash_meth != NULL);
14025
14026         LDKSocketDescriptor ret = {
14027                 .this_arg = (void*) calls,
14028                 .send_data = send_data_LDKSocketDescriptor_jcall,
14029                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
14030                 .eq = eq_LDKSocketDescriptor_jcall,
14031                 .hash = hash_LDKSocketDescriptor_jcall,
14032                 .cloned = LDKSocketDescriptor_JCalls_cloned,
14033                 .free = LDKSocketDescriptor_JCalls_free,
14034         };
14035         return ret;
14036 }
14037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
14038         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14039         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
14040         return tag_ptr(res_ptr, true);
14041 }
14042 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) {
14043         void* this_arg_ptr = untag_ptr(this_arg);
14044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14045         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14046         LDKu8slice data_ref;
14047         data_ref.datalen = (*env)->GetArrayLength(env, data);
14048         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
14049         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
14050         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
14051         return ret_conv;
14052 }
14053
14054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
14055         void* this_arg_ptr = untag_ptr(this_arg);
14056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14057         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14058         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
14059 }
14060
14061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
14062         void* this_arg_ptr = untag_ptr(this_arg);
14063         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14064         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
14065         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
14066         return ret_conv;
14067 }
14068
14069 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
14070 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
14071 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
14072 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
14073 static jclass LDKEffectiveCapacity_Total_class = NULL;
14074 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
14075 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
14076 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
14077 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
14078 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
14079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
14080         LDKEffectiveCapacity_ExactLiquidity_class =
14081                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
14082         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
14083         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
14084         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
14085         LDKEffectiveCapacity_MaximumHTLC_class =
14086                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
14087         CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
14088         LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
14089         CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
14090         LDKEffectiveCapacity_Total_class =
14091                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
14092         CHECK(LDKEffectiveCapacity_Total_class != NULL);
14093         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
14094         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
14095         LDKEffectiveCapacity_Infinite_class =
14096                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
14097         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
14098         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
14099         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
14100         LDKEffectiveCapacity_Unknown_class =
14101                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
14102         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
14103         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
14104         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
14105 }
14106 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14107         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
14108         switch(obj->tag) {
14109                 case LDKEffectiveCapacity_ExactLiquidity: {
14110                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
14111                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
14112                 }
14113                 case LDKEffectiveCapacity_MaximumHTLC: {
14114                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
14115                         return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
14116                 }
14117                 case LDKEffectiveCapacity_Total: {
14118                         int64_t capacity_msat_conv = obj->total.capacity_msat;
14119                         int64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
14120                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_ref);
14121                 }
14122                 case LDKEffectiveCapacity_Infinite: {
14123                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
14124                 }
14125                 case LDKEffectiveCapacity_Unknown: {
14126                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
14127                 }
14128                 default: abort();
14129         }
14130 }
14131 static jclass LDKDestination_Node_class = NULL;
14132 static jmethodID LDKDestination_Node_meth = NULL;
14133 static jclass LDKDestination_BlindedRoute_class = NULL;
14134 static jmethodID LDKDestination_BlindedRoute_meth = NULL;
14135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
14136         LDKDestination_Node_class =
14137                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
14138         CHECK(LDKDestination_Node_class != NULL);
14139         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
14140         CHECK(LDKDestination_Node_meth != NULL);
14141         LDKDestination_BlindedRoute_class =
14142                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedRoute"));
14143         CHECK(LDKDestination_BlindedRoute_class != NULL);
14144         LDKDestination_BlindedRoute_meth = (*env)->GetMethodID(env, LDKDestination_BlindedRoute_class, "<init>", "(J)V");
14145         CHECK(LDKDestination_BlindedRoute_meth != NULL);
14146 }
14147 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14148         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
14149         switch(obj->tag) {
14150                 case LDKDestination_Node: {
14151                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
14152                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
14153                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
14154                 }
14155                 case LDKDestination_BlindedRoute: {
14156                         LDKBlindedRoute blinded_route_var = obj->blinded_route;
14157                         int64_t blinded_route_ref = 0;
14158                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_route_var);
14159                         blinded_route_ref = tag_ptr(blinded_route_var.inner, false);
14160                         return (*env)->NewObject(env, LDKDestination_BlindedRoute_class, LDKDestination_BlindedRoute_meth, blinded_route_ref);
14161                 }
14162                 default: abort();
14163         }
14164 }
14165 static jclass LDKGossipSync_P2P_class = NULL;
14166 static jmethodID LDKGossipSync_P2P_meth = NULL;
14167 static jclass LDKGossipSync_Rapid_class = NULL;
14168 static jmethodID LDKGossipSync_Rapid_meth = NULL;
14169 static jclass LDKGossipSync_None_class = NULL;
14170 static jmethodID LDKGossipSync_None_meth = NULL;
14171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
14172         LDKGossipSync_P2P_class =
14173                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
14174         CHECK(LDKGossipSync_P2P_class != NULL);
14175         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
14176         CHECK(LDKGossipSync_P2P_meth != NULL);
14177         LDKGossipSync_Rapid_class =
14178                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
14179         CHECK(LDKGossipSync_Rapid_class != NULL);
14180         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
14181         CHECK(LDKGossipSync_Rapid_meth != NULL);
14182         LDKGossipSync_None_class =
14183                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
14184         CHECK(LDKGossipSync_None_class != NULL);
14185         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
14186         CHECK(LDKGossipSync_None_meth != NULL);
14187 }
14188 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14189         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14190         switch(obj->tag) {
14191                 case LDKGossipSync_P2P: {
14192                         LDKP2PGossipSync p2p_var = obj->p2p;
14193                         int64_t p2p_ref = 0;
14194                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
14195                         p2p_ref = tag_ptr(p2p_var.inner, false);
14196                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
14197                 }
14198                 case LDKGossipSync_Rapid: {
14199                         LDKRapidGossipSync rapid_var = obj->rapid;
14200                         int64_t rapid_ref = 0;
14201                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
14202                         rapid_ref = tag_ptr(rapid_var.inner, false);
14203                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
14204                 }
14205                 case LDKGossipSync_None: {
14206                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
14207                 }
14208                 default: abort();
14209         }
14210 }
14211 static jclass LDKFallback_SegWitProgram_class = NULL;
14212 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
14213 static jclass LDKFallback_PubKeyHash_class = NULL;
14214 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
14215 static jclass LDKFallback_ScriptHash_class = NULL;
14216 static jmethodID LDKFallback_ScriptHash_meth = NULL;
14217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
14218         LDKFallback_SegWitProgram_class =
14219                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
14220         CHECK(LDKFallback_SegWitProgram_class != NULL);
14221         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
14222         CHECK(LDKFallback_SegWitProgram_meth != NULL);
14223         LDKFallback_PubKeyHash_class =
14224                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
14225         CHECK(LDKFallback_PubKeyHash_class != NULL);
14226         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
14227         CHECK(LDKFallback_PubKeyHash_meth != NULL);
14228         LDKFallback_ScriptHash_class =
14229                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
14230         CHECK(LDKFallback_ScriptHash_class != NULL);
14231         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
14232         CHECK(LDKFallback_ScriptHash_meth != NULL);
14233 }
14234 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14235         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14236         switch(obj->tag) {
14237                 case LDKFallback_SegWitProgram: {
14238                         uint8_t version_val = obj->seg_wit_program.version._0;
14239                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
14240                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
14241                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
14242                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
14243                 }
14244                 case LDKFallback_PubKeyHash: {
14245                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
14246                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
14247                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
14248                 }
14249                 case LDKFallback_ScriptHash: {
14250                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
14251                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
14252                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
14253                 }
14254                 default: abort();
14255         }
14256 }
14257 typedef struct LDKPayer_JCalls {
14258         atomic_size_t refcnt;
14259         JavaVM *vm;
14260         jweak o;
14261         jmethodID node_id_meth;
14262         jmethodID first_hops_meth;
14263         jmethodID send_payment_meth;
14264         jmethodID send_spontaneous_payment_meth;
14265         jmethodID retry_payment_meth;
14266         jmethodID abandon_payment_meth;
14267 } LDKPayer_JCalls;
14268 static void LDKPayer_JCalls_free(void* this_arg) {
14269         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14270         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14271                 JNIEnv *env;
14272                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14273                 if (get_jenv_res == JNI_EDETACHED) {
14274                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14275                 } else {
14276                         DO_ASSERT(get_jenv_res == JNI_OK);
14277                 }
14278                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14279                 if (get_jenv_res == JNI_EDETACHED) {
14280                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14281                 }
14282                 FREE(j_calls);
14283         }
14284 }
14285 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
14286         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14287         JNIEnv *env;
14288         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14289         if (get_jenv_res == JNI_EDETACHED) {
14290                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14291         } else {
14292                 DO_ASSERT(get_jenv_res == JNI_OK);
14293         }
14294         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14295         CHECK(obj != NULL);
14296         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
14297         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14298                 (*env)->ExceptionDescribe(env);
14299                 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
14300         }
14301         LDKPublicKey ret_ref;
14302         CHECK((*env)->GetArrayLength(env, ret) == 33);
14303         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
14304         if (get_jenv_res == JNI_EDETACHED) {
14305                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14306         }
14307         return ret_ref;
14308 }
14309 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
14310         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14311         JNIEnv *env;
14312         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14313         if (get_jenv_res == JNI_EDETACHED) {
14314                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14315         } else {
14316                 DO_ASSERT(get_jenv_res == JNI_OK);
14317         }
14318         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14319         CHECK(obj != NULL);
14320         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
14321         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14322                 (*env)->ExceptionDescribe(env);
14323                 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
14324         }
14325         LDKCVec_ChannelDetailsZ ret_constr;
14326         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14327         if (ret_constr.datalen > 0)
14328                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14329         else
14330                 ret_constr.data = NULL;
14331         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14332         for (size_t q = 0; q < ret_constr.datalen; q++) {
14333                 int64_t ret_conv_16 = ret_vals[q];
14334                 LDKChannelDetails ret_conv_16_conv;
14335                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
14336                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
14337                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
14338                 ret_constr.data[q] = ret_conv_16_conv;
14339         }
14340         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14341         if (get_jenv_res == JNI_EDETACHED) {
14342                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14343         }
14344         return ret_constr;
14345 }
14346 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
14347         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14348         JNIEnv *env;
14349         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14350         if (get_jenv_res == JNI_EDETACHED) {
14351                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14352         } else {
14353                 DO_ASSERT(get_jenv_res == JNI_OK);
14354         }
14355         LDKRoute route_var = *route;
14356         int64_t route_ref = 0;
14357         route_var = Route_clone(&route_var);
14358         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14359         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
14360         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14361         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
14362         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14363         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
14364         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14365         CHECK(obj != NULL);
14366         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
14367         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14368                 (*env)->ExceptionDescribe(env);
14369                 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
14370         }
14371         void* ret_ptr = untag_ptr(ret);
14372         CHECK_ACCESS(ret_ptr);
14373         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14374         FREE(untag_ptr(ret));
14375         if (get_jenv_res == JNI_EDETACHED) {
14376                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14377         }
14378         return ret_conv;
14379 }
14380 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
14381         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14382         JNIEnv *env;
14383         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14384         if (get_jenv_res == JNI_EDETACHED) {
14385                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14386         } else {
14387                 DO_ASSERT(get_jenv_res == JNI_OK);
14388         }
14389         LDKRoute route_var = *route;
14390         int64_t route_ref = 0;
14391         route_var = Route_clone(&route_var);
14392         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14393         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
14394         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
14395         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
14396         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14397         CHECK(obj != NULL);
14398         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
14399         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14400                 (*env)->ExceptionDescribe(env);
14401                 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
14402         }
14403         void* ret_ptr = untag_ptr(ret);
14404         CHECK_ACCESS(ret_ptr);
14405         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
14406         FREE(untag_ptr(ret));
14407         if (get_jenv_res == JNI_EDETACHED) {
14408                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14409         }
14410         return ret_conv;
14411 }
14412 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
14413         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14414         JNIEnv *env;
14415         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14416         if (get_jenv_res == JNI_EDETACHED) {
14417                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14418         } else {
14419                 DO_ASSERT(get_jenv_res == JNI_OK);
14420         }
14421         LDKRoute route_var = *route;
14422         int64_t route_ref = 0;
14423         route_var = Route_clone(&route_var);
14424         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
14425         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
14426         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14427         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14428         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14429         CHECK(obj != NULL);
14430         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
14431         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14432                 (*env)->ExceptionDescribe(env);
14433                 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
14434         }
14435         void* ret_ptr = untag_ptr(ret);
14436         CHECK_ACCESS(ret_ptr);
14437         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
14438         FREE(untag_ptr(ret));
14439         if (get_jenv_res == JNI_EDETACHED) {
14440                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14441         }
14442         return ret_conv;
14443 }
14444 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
14445         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
14446         JNIEnv *env;
14447         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14448         if (get_jenv_res == JNI_EDETACHED) {
14449                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14450         } else {
14451                 DO_ASSERT(get_jenv_res == JNI_OK);
14452         }
14453         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14454         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
14455         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14456         CHECK(obj != NULL);
14457         (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
14458         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14459                 (*env)->ExceptionDescribe(env);
14460                 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
14461         }
14462         if (get_jenv_res == JNI_EDETACHED) {
14463                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14464         }
14465 }
14466 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
14467         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
14468         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14469 }
14470 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
14471         jclass c = (*env)->GetObjectClass(env, o);
14472         CHECK(c != NULL);
14473         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
14474         atomic_init(&calls->refcnt, 1);
14475         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14476         calls->o = (*env)->NewWeakGlobalRef(env, o);
14477         calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
14478         CHECK(calls->node_id_meth != NULL);
14479         calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
14480         CHECK(calls->first_hops_meth != NULL);
14481         calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
14482         CHECK(calls->send_payment_meth != NULL);
14483         calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
14484         CHECK(calls->send_spontaneous_payment_meth != NULL);
14485         calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
14486         CHECK(calls->retry_payment_meth != NULL);
14487         calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
14488         CHECK(calls->abandon_payment_meth != NULL);
14489
14490         LDKPayer ret = {
14491                 .this_arg = (void*) calls,
14492                 .node_id = node_id_LDKPayer_jcall,
14493                 .first_hops = first_hops_LDKPayer_jcall,
14494                 .send_payment = send_payment_LDKPayer_jcall,
14495                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
14496                 .retry_payment = retry_payment_LDKPayer_jcall,
14497                 .abandon_payment = abandon_payment_LDKPayer_jcall,
14498                 .free = LDKPayer_JCalls_free,
14499         };
14500         return ret;
14501 }
14502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
14503         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
14504         *res_ptr = LDKPayer_init(env, clz, o);
14505         return tag_ptr(res_ptr, true);
14506 }
14507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14508         void* this_arg_ptr = untag_ptr(this_arg);
14509         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14510         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14511         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14512         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
14513         return ret_arr;
14514 }
14515
14516 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
14517         void* this_arg_ptr = untag_ptr(this_arg);
14518         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14519         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14520         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
14521         int64_tArray ret_arr = NULL;
14522         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14523         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14524         for (size_t q = 0; q < ret_var.datalen; q++) {
14525                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
14526                 int64_t ret_conv_16_ref = 0;
14527                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
14528                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
14529                 ret_arr_ptr[q] = ret_conv_16_ref;
14530         }
14531         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14532         FREE(ret_var.data);
14533         return ret_arr;
14534 }
14535
14536 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) {
14537         void* this_arg_ptr = untag_ptr(this_arg);
14538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14539         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14540         LDKRoute route_conv;
14541         route_conv.inner = untag_ptr(route);
14542         route_conv.is_owned = ptr_is_owned(route);
14543         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14544         route_conv.is_owned = false;
14545         LDKThirtyTwoBytes payment_hash_ref;
14546         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14547         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14548         LDKThirtyTwoBytes payment_secret_ref;
14549         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14550         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14551         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14552         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
14553         return tag_ptr(ret_conv, true);
14554 }
14555
14556 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) {
14557         void* this_arg_ptr = untag_ptr(this_arg);
14558         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14559         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14560         LDKRoute route_conv;
14561         route_conv.inner = untag_ptr(route);
14562         route_conv.is_owned = ptr_is_owned(route);
14563         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14564         route_conv.is_owned = false;
14565         LDKThirtyTwoBytes payment_preimage_ref;
14566         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14567         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14568         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
14569         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
14570         return tag_ptr(ret_conv, true);
14571 }
14572
14573 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) {
14574         void* this_arg_ptr = untag_ptr(this_arg);
14575         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14576         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14577         LDKRoute route_conv;
14578         route_conv.inner = untag_ptr(route);
14579         route_conv.is_owned = ptr_is_owned(route);
14580         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
14581         route_conv.is_owned = false;
14582         LDKThirtyTwoBytes payment_id_ref;
14583         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14584         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14585         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
14586         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
14587         return tag_ptr(ret_conv, true);
14588 }
14589
14590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
14591         void* this_arg_ptr = untag_ptr(this_arg);
14592         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14593         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
14594         LDKThirtyTwoBytes payment_id_ref;
14595         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
14596         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
14597         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
14598 }
14599
14600 typedef struct LDKRouter_JCalls {
14601         atomic_size_t refcnt;
14602         JavaVM *vm;
14603         jweak o;
14604         jmethodID find_route_meth;
14605         jmethodID notify_payment_path_failed_meth;
14606         jmethodID notify_payment_path_successful_meth;
14607         jmethodID notify_payment_probe_successful_meth;
14608         jmethodID notify_payment_probe_failed_meth;
14609 } LDKRouter_JCalls;
14610 static void LDKRouter_JCalls_free(void* this_arg) {
14611         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14612         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14613                 JNIEnv *env;
14614                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14615                 if (get_jenv_res == JNI_EDETACHED) {
14616                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14617                 } else {
14618                         DO_ASSERT(get_jenv_res == JNI_OK);
14619                 }
14620                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14621                 if (get_jenv_res == JNI_EDETACHED) {
14622                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14623                 }
14624                 FREE(j_calls);
14625         }
14626 }
14627 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, LDKInFlightHtlcs inflight_htlcs) {
14628         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14629         JNIEnv *env;
14630         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14631         if (get_jenv_res == JNI_EDETACHED) {
14632                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14633         } else {
14634                 DO_ASSERT(get_jenv_res == JNI_OK);
14635         }
14636         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
14637         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
14638         LDKRouteParameters route_params_var = *route_params;
14639         int64_t route_params_ref = 0;
14640         route_params_var = RouteParameters_clone(&route_params_var);
14641         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
14642         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
14643         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14644         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
14645         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
14646         int64_tArray first_hops_arr = NULL;
14647         if (first_hops != NULL) {
14648                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
14649                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
14650                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
14651                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
14652                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
14653                         int64_t first_hops_conv_16_ref = 0;
14654                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
14655                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
14656                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
14657                 }
14658                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
14659         }
14660         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
14661         int64_t inflight_htlcs_ref = 0;
14662         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
14663         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
14664         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14665         CHECK(obj != NULL);
14666         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, payment_hash_arr, first_hops_arr, inflight_htlcs_ref);
14667         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14668                 (*env)->ExceptionDescribe(env);
14669                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
14670         }
14671         void* ret_ptr = untag_ptr(ret);
14672         CHECK_ACCESS(ret_ptr);
14673         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
14674         FREE(untag_ptr(ret));
14675         if (get_jenv_res == JNI_EDETACHED) {
14676                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14677         }
14678         return ret_conv;
14679 }
14680 void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
14681         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14682         JNIEnv *env;
14683         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14684         if (get_jenv_res == JNI_EDETACHED) {
14685                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14686         } else {
14687                 DO_ASSERT(get_jenv_res == JNI_OK);
14688         }
14689         LDKCVec_RouteHopZ path_var = path;
14690         int64_tArray path_arr = NULL;
14691         path_arr = (*env)->NewLongArray(env, path_var.datalen);
14692         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
14693         for (size_t k = 0; k < path_var.datalen; k++) {
14694                 LDKRouteHop path_conv_10_var = path_var.data[k];
14695                 int64_t path_conv_10_ref = 0;
14696                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
14697                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
14698                 path_arr_ptr[k] = path_conv_10_ref;
14699         }
14700         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
14701         FREE(path_var.data);
14702         int64_t short_channel_id_conv = short_channel_id;
14703         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14704         CHECK(obj != NULL);
14705         (*env)->CallVoidMethod(env, obj, j_calls->notify_payment_path_failed_meth, path_arr, short_channel_id_conv);
14706         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14707                 (*env)->ExceptionDescribe(env);
14708                 (*env)->FatalError(env, "A call to notify_payment_path_failed in LDKRouter from rust threw an exception.");
14709         }
14710         if (get_jenv_res == JNI_EDETACHED) {
14711                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14712         }
14713 }
14714 void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
14715         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14716         JNIEnv *env;
14717         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14718         if (get_jenv_res == JNI_EDETACHED) {
14719                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14720         } else {
14721                 DO_ASSERT(get_jenv_res == JNI_OK);
14722         }
14723         LDKCVec_RouteHopZ path_var = path;
14724         int64_tArray path_arr = NULL;
14725         path_arr = (*env)->NewLongArray(env, path_var.datalen);
14726         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
14727         for (size_t k = 0; k < path_var.datalen; k++) {
14728                 LDKRouteHop path_conv_10_var = path_var.data[k];
14729                 int64_t path_conv_10_ref = 0;
14730                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
14731                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
14732                 path_arr_ptr[k] = path_conv_10_ref;
14733         }
14734         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
14735         FREE(path_var.data);
14736         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14737         CHECK(obj != NULL);
14738         (*env)->CallVoidMethod(env, obj, j_calls->notify_payment_path_successful_meth, path_arr);
14739         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14740                 (*env)->ExceptionDescribe(env);
14741                 (*env)->FatalError(env, "A call to notify_payment_path_successful in LDKRouter from rust threw an exception.");
14742         }
14743         if (get_jenv_res == JNI_EDETACHED) {
14744                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14745         }
14746 }
14747 void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
14748         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14749         JNIEnv *env;
14750         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14751         if (get_jenv_res == JNI_EDETACHED) {
14752                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14753         } else {
14754                 DO_ASSERT(get_jenv_res == JNI_OK);
14755         }
14756         LDKCVec_RouteHopZ path_var = path;
14757         int64_tArray path_arr = NULL;
14758         path_arr = (*env)->NewLongArray(env, path_var.datalen);
14759         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
14760         for (size_t k = 0; k < path_var.datalen; k++) {
14761                 LDKRouteHop path_conv_10_var = path_var.data[k];
14762                 int64_t path_conv_10_ref = 0;
14763                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
14764                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
14765                 path_arr_ptr[k] = path_conv_10_ref;
14766         }
14767         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
14768         FREE(path_var.data);
14769         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14770         CHECK(obj != NULL);
14771         (*env)->CallVoidMethod(env, obj, j_calls->notify_payment_probe_successful_meth, path_arr);
14772         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14773                 (*env)->ExceptionDescribe(env);
14774                 (*env)->FatalError(env, "A call to notify_payment_probe_successful in LDKRouter from rust threw an exception.");
14775         }
14776         if (get_jenv_res == JNI_EDETACHED) {
14777                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14778         }
14779 }
14780 void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
14781         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
14782         JNIEnv *env;
14783         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14784         if (get_jenv_res == JNI_EDETACHED) {
14785                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14786         } else {
14787                 DO_ASSERT(get_jenv_res == JNI_OK);
14788         }
14789         LDKCVec_RouteHopZ path_var = path;
14790         int64_tArray path_arr = NULL;
14791         path_arr = (*env)->NewLongArray(env, path_var.datalen);
14792         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
14793         for (size_t k = 0; k < path_var.datalen; k++) {
14794                 LDKRouteHop path_conv_10_var = path_var.data[k];
14795                 int64_t path_conv_10_ref = 0;
14796                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
14797                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
14798                 path_arr_ptr[k] = path_conv_10_ref;
14799         }
14800         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
14801         FREE(path_var.data);
14802         int64_t short_channel_id_conv = short_channel_id;
14803         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14804         CHECK(obj != NULL);
14805         (*env)->CallVoidMethod(env, obj, j_calls->notify_payment_probe_failed_meth, path_arr, short_channel_id_conv);
14806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14807                 (*env)->ExceptionDescribe(env);
14808                 (*env)->FatalError(env, "A call to notify_payment_probe_failed in LDKRouter from rust threw an exception.");
14809         }
14810         if (get_jenv_res == JNI_EDETACHED) {
14811                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14812         }
14813 }
14814 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
14815         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
14816         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14817 }
14818 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
14819         jclass c = (*env)->GetObjectClass(env, o);
14820         CHECK(c != NULL);
14821         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
14822         atomic_init(&calls->refcnt, 1);
14823         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14824         calls->o = (*env)->NewWeakGlobalRef(env, o);
14825         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
14826         CHECK(calls->find_route_meth != NULL);
14827         calls->notify_payment_path_failed_meth = (*env)->GetMethodID(env, c, "notify_payment_path_failed", "([JJ)V");
14828         CHECK(calls->notify_payment_path_failed_meth != NULL);
14829         calls->notify_payment_path_successful_meth = (*env)->GetMethodID(env, c, "notify_payment_path_successful", "([J)V");
14830         CHECK(calls->notify_payment_path_successful_meth != NULL);
14831         calls->notify_payment_probe_successful_meth = (*env)->GetMethodID(env, c, "notify_payment_probe_successful", "([J)V");
14832         CHECK(calls->notify_payment_probe_successful_meth != NULL);
14833         calls->notify_payment_probe_failed_meth = (*env)->GetMethodID(env, c, "notify_payment_probe_failed", "([JJ)V");
14834         CHECK(calls->notify_payment_probe_failed_meth != NULL);
14835
14836         LDKRouter ret = {
14837                 .this_arg = (void*) calls,
14838                 .find_route = find_route_LDKRouter_jcall,
14839                 .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall,
14840                 .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall,
14841                 .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall,
14842                 .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall,
14843                 .free = LDKRouter_JCalls_free,
14844         };
14845         return ret;
14846 }
14847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
14848         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
14849         *res_ptr = LDKRouter_init(env, clz, o);
14850         return tag_ptr(res_ptr, true);
14851 }
14852 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 inflight_htlcs) {
14853         void* this_arg_ptr = untag_ptr(this_arg);
14854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14855         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14856         LDKPublicKey payer_ref;
14857         CHECK((*env)->GetArrayLength(env, payer) == 33);
14858         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
14859         LDKRouteParameters route_params_conv;
14860         route_params_conv.inner = untag_ptr(route_params);
14861         route_params_conv.is_owned = ptr_is_owned(route_params);
14862         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
14863         route_params_conv.is_owned = false;
14864         unsigned char payment_hash_arr[32];
14865         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14866         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
14867         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14868         LDKCVec_ChannelDetailsZ first_hops_constr;
14869         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
14870         if (first_hops != NULL) {
14871                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
14872                 if (first_hops_constr.datalen > 0)
14873                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14874                 else
14875                         first_hops_constr.data = NULL;
14876                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
14877                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14878                         int64_t first_hops_conv_16 = first_hops_vals[q];
14879                         LDKChannelDetails first_hops_conv_16_conv;
14880                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
14881                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
14882                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
14883                         first_hops_conv_16_conv.is_owned = false;
14884                         first_hops_constr.data[q] = first_hops_conv_16_conv;
14885                 }
14886                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
14887                 first_hops_ptr = &first_hops_constr;
14888         }
14889         LDKInFlightHtlcs inflight_htlcs_conv;
14890         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
14891         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
14892         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
14893         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
14894         
14895         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14896         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, inflight_htlcs_conv);
14897         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
14898         return tag_ptr(ret_conv, true);
14899 }
14900
14901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
14902         void* this_arg_ptr = untag_ptr(this_arg);
14903         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14904         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14905         LDKCVec_RouteHopZ path_constr;
14906         path_constr.datalen = (*env)->GetArrayLength(env, path);
14907         if (path_constr.datalen > 0)
14908                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14909         else
14910                 path_constr.data = NULL;
14911         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
14912         for (size_t k = 0; k < path_constr.datalen; k++) {
14913                 int64_t path_conv_10 = path_vals[k];
14914                 LDKRouteHop path_conv_10_conv;
14915                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
14916                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
14917                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
14918                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
14919                 path_constr.data[k] = path_conv_10_conv;
14920         }
14921         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
14922         (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
14923 }
14924
14925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
14926         void* this_arg_ptr = untag_ptr(this_arg);
14927         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14928         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14929         LDKCVec_RouteHopZ path_constr;
14930         path_constr.datalen = (*env)->GetArrayLength(env, path);
14931         if (path_constr.datalen > 0)
14932                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14933         else
14934                 path_constr.data = NULL;
14935         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
14936         for (size_t k = 0; k < path_constr.datalen; k++) {
14937                 int64_t path_conv_10 = path_vals[k];
14938                 LDKRouteHop path_conv_10_conv;
14939                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
14940                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
14941                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
14942                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
14943                 path_constr.data[k] = path_conv_10_conv;
14944         }
14945         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
14946         (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr);
14947 }
14948
14949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
14950         void* this_arg_ptr = untag_ptr(this_arg);
14951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14952         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14953         LDKCVec_RouteHopZ path_constr;
14954         path_constr.datalen = (*env)->GetArrayLength(env, path);
14955         if (path_constr.datalen > 0)
14956                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14957         else
14958                 path_constr.data = NULL;
14959         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
14960         for (size_t k = 0; k < path_constr.datalen; k++) {
14961                 int64_t path_conv_10 = path_vals[k];
14962                 LDKRouteHop path_conv_10_conv;
14963                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
14964                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
14965                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
14966                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
14967                 path_constr.data[k] = path_conv_10_conv;
14968         }
14969         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
14970         (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr);
14971 }
14972
14973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1notify_1payment_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
14974         void* this_arg_ptr = untag_ptr(this_arg);
14975         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14976         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14977         LDKCVec_RouteHopZ path_constr;
14978         path_constr.datalen = (*env)->GetArrayLength(env, path);
14979         if (path_constr.datalen > 0)
14980                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14981         else
14982                 path_constr.data = NULL;
14983         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
14984         for (size_t k = 0; k < path_constr.datalen; k++) {
14985                 int64_t path_conv_10 = path_vals[k];
14986                 LDKRouteHop path_conv_10_conv;
14987                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
14988                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
14989                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
14990                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
14991                 path_constr.data[k] = path_conv_10_conv;
14992         }
14993         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
14994         (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
14995 }
14996
14997 static jclass LDKRetry_Attempts_class = NULL;
14998 static jmethodID LDKRetry_Attempts_meth = NULL;
14999 static jclass LDKRetry_Timeout_class = NULL;
15000 static jmethodID LDKRetry_Timeout_meth = NULL;
15001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
15002         LDKRetry_Attempts_class =
15003                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
15004         CHECK(LDKRetry_Attempts_class != NULL);
15005         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
15006         CHECK(LDKRetry_Attempts_meth != NULL);
15007         LDKRetry_Timeout_class =
15008                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
15009         CHECK(LDKRetry_Timeout_class != NULL);
15010         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
15011         CHECK(LDKRetry_Timeout_meth != NULL);
15012 }
15013 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15014         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
15015         switch(obj->tag) {
15016                 case LDKRetry_Attempts: {
15017                         int64_t attempts_conv = obj->attempts;
15018                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
15019                 }
15020                 case LDKRetry_Timeout: {
15021                         int64_t timeout_conv = obj->timeout;
15022                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
15023                 }
15024                 default: abort();
15025         }
15026 }
15027 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
15028         LDKStr ret_str = _ldk_get_compiled_version();
15029         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
15030         Str_free(ret_str);
15031         return ret_conv;
15032 }
15033
15034 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
15035         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
15036         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
15037         Str_free(ret_str);
15038         return ret_conv;
15039 }
15040
15041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
15042         LDKThirtyTwoBytes big_endian_bytes_ref;
15043         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
15044         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
15045         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
15046         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
15047         return tag_ptr(ret_ref, true);
15048 }
15049
15050 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
15051         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15052         *ret_copy = Bech32Error_clone(arg);
15053         int64_t ret_ref = tag_ptr(ret_copy, true);
15054         return ret_ref;
15055 }
15056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15057         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
15058         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
15059         return ret_conv;
15060 }
15061
15062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15063         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
15064         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
15065         *ret_copy = Bech32Error_clone(orig_conv);
15066         int64_t ret_ref = tag_ptr(ret_copy, true);
15067         return ret_ref;
15068 }
15069
15070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
15071         if (!ptr_is_owned(o)) return;
15072         void* o_ptr = untag_ptr(o);
15073         CHECK_ACCESS(o_ptr);
15074         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
15075         FREE(untag_ptr(o));
15076         Bech32Error_free(o_conv);
15077 }
15078
15079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
15080         LDKTransaction _res_ref;
15081         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
15082         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
15083         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
15084         _res_ref.data_is_owned = true;
15085         Transaction_free(_res_ref);
15086 }
15087
15088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
15089         LDKCVec_u8Z script_pubkey_ref;
15090         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
15091         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
15092         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
15093         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15094         *ret_ref = TxOut_new(script_pubkey_ref, value);
15095         return tag_ptr(ret_ref, true);
15096 }
15097
15098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
15099         if (!ptr_is_owned(_res)) return;
15100         void* _res_ptr = untag_ptr(_res);
15101         CHECK_ACCESS(_res_ptr);
15102         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
15103         FREE(untag_ptr(_res));
15104         TxOut_free(_res_conv);
15105 }
15106
15107 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
15108         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15109         *ret_ref = TxOut_clone(arg);
15110         return tag_ptr(ret_ref, true);
15111 }
15112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15113         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
15114         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
15115         return ret_conv;
15116 }
15117
15118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15119         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
15120         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
15121         *ret_ref = TxOut_clone(orig_conv);
15122         return tag_ptr(ret_ref, true);
15123 }
15124
15125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
15126         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
15127         Str_free(dummy);
15128 }
15129
15130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15131         LDKCVec_PublicKeyZ _res_constr;
15132         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15133         if (_res_constr.datalen > 0)
15134                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
15135         else
15136                 _res_constr.data = NULL;
15137         for (size_t i = 0; i < _res_constr.datalen; i++) {
15138                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15139                 LDKPublicKey _res_conv_8_ref;
15140                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
15141                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
15142                 _res_constr.data[i] = _res_conv_8_ref;
15143         }
15144         CVec_PublicKeyZ_free(_res_constr);
15145 }
15146
15147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15148         LDKBlindedRoute o_conv;
15149         o_conv.inner = untag_ptr(o);
15150         o_conv.is_owned = ptr_is_owned(o);
15151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15152         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
15153         
15154         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
15155         *ret_conv = CResult_BlindedRouteNoneZ_ok(o_conv);
15156         return tag_ptr(ret_conv, true);
15157 }
15158
15159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteNoneZ_1err(JNIEnv *env, jclass clz) {
15160         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
15161         *ret_conv = CResult_BlindedRouteNoneZ_err();
15162         return tag_ptr(ret_conv, true);
15163 }
15164
15165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15166         LDKCResult_BlindedRouteNoneZ* o_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(o);
15167         jboolean ret_conv = CResult_BlindedRouteNoneZ_is_ok(o_conv);
15168         return ret_conv;
15169 }
15170
15171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15172         if (!ptr_is_owned(_res)) return;
15173         void* _res_ptr = untag_ptr(_res);
15174         CHECK_ACCESS(_res_ptr);
15175         LDKCResult_BlindedRouteNoneZ _res_conv = *(LDKCResult_BlindedRouteNoneZ*)(_res_ptr);
15176         FREE(untag_ptr(_res));
15177         CResult_BlindedRouteNoneZ_free(_res_conv);
15178 }
15179
15180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15181         LDKBlindedRoute o_conv;
15182         o_conv.inner = untag_ptr(o);
15183         o_conv.is_owned = ptr_is_owned(o);
15184         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15185         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
15186         
15187         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
15188         *ret_conv = CResult_BlindedRouteDecodeErrorZ_ok(o_conv);
15189         return tag_ptr(ret_conv, true);
15190 }
15191
15192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15193         LDKDecodeError e_conv;
15194         e_conv.inner = untag_ptr(e);
15195         e_conv.is_owned = ptr_is_owned(e);
15196         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15197         e_conv = DecodeError_clone(&e_conv);
15198         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
15199         *ret_conv = CResult_BlindedRouteDecodeErrorZ_err(e_conv);
15200         return tag_ptr(ret_conv, true);
15201 }
15202
15203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15204         LDKCResult_BlindedRouteDecodeErrorZ* o_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(o);
15205         jboolean ret_conv = CResult_BlindedRouteDecodeErrorZ_is_ok(o_conv);
15206         return ret_conv;
15207 }
15208
15209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedRouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15210         if (!ptr_is_owned(_res)) return;
15211         void* _res_ptr = untag_ptr(_res);
15212         CHECK_ACCESS(_res_ptr);
15213         LDKCResult_BlindedRouteDecodeErrorZ _res_conv = *(LDKCResult_BlindedRouteDecodeErrorZ*)(_res_ptr);
15214         FREE(untag_ptr(_res));
15215         CResult_BlindedRouteDecodeErrorZ_free(_res_conv);
15216 }
15217
15218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15219         LDKBlindedHop o_conv;
15220         o_conv.inner = untag_ptr(o);
15221         o_conv.is_owned = ptr_is_owned(o);
15222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15223         // WARNING: we need a move here but no clone is available for LDKBlindedHop
15224         
15225         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
15226         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
15227         return tag_ptr(ret_conv, true);
15228 }
15229
15230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15231         LDKDecodeError e_conv;
15232         e_conv.inner = untag_ptr(e);
15233         e_conv.is_owned = ptr_is_owned(e);
15234         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15235         e_conv = DecodeError_clone(&e_conv);
15236         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
15237         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
15238         return tag_ptr(ret_conv, true);
15239 }
15240
15241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15242         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
15243         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
15244         return ret_conv;
15245 }
15246
15247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15248         if (!ptr_is_owned(_res)) return;
15249         void* _res_ptr = untag_ptr(_res);
15250         CHECK_ACCESS(_res_ptr);
15251         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
15252         FREE(untag_ptr(_res));
15253         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
15254 }
15255
15256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
15257         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15258         *ret_conv = CResult_NoneNoneZ_ok();
15259         return tag_ptr(ret_conv, true);
15260 }
15261
15262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
15263         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15264         *ret_conv = CResult_NoneNoneZ_err();
15265         return tag_ptr(ret_conv, true);
15266 }
15267
15268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15269         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
15270         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
15271         return ret_conv;
15272 }
15273
15274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15275         if (!ptr_is_owned(_res)) return;
15276         void* _res_ptr = untag_ptr(_res);
15277         CHECK_ACCESS(_res_ptr);
15278         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
15279         FREE(untag_ptr(_res));
15280         CResult_NoneNoneZ_free(_res_conv);
15281 }
15282
15283 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
15284         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15285         *ret_conv = CResult_NoneNoneZ_clone(arg);
15286         return tag_ptr(ret_conv, true);
15287 }
15288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15289         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
15290         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
15291         return ret_conv;
15292 }
15293
15294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15295         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
15296         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15297         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
15298         return tag_ptr(ret_conv, true);
15299 }
15300
15301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15302         LDKCounterpartyCommitmentSecrets o_conv;
15303         o_conv.inner = untag_ptr(o);
15304         o_conv.is_owned = ptr_is_owned(o);
15305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15306         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
15307         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
15308         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
15309         return tag_ptr(ret_conv, true);
15310 }
15311
15312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15313         LDKDecodeError e_conv;
15314         e_conv.inner = untag_ptr(e);
15315         e_conv.is_owned = ptr_is_owned(e);
15316         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15317         e_conv = DecodeError_clone(&e_conv);
15318         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
15319         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
15320         return tag_ptr(ret_conv, true);
15321 }
15322
15323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15324         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
15325         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
15326         return ret_conv;
15327 }
15328
15329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15330         if (!ptr_is_owned(_res)) return;
15331         void* _res_ptr = untag_ptr(_res);
15332         CHECK_ACCESS(_res_ptr);
15333         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
15334         FREE(untag_ptr(_res));
15335         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
15336 }
15337
15338 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
15339         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
15340         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
15341         return tag_ptr(ret_conv, true);
15342 }
15343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15344         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
15345         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
15346         return ret_conv;
15347 }
15348
15349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15350         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
15351         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
15352         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
15353         return tag_ptr(ret_conv, true);
15354 }
15355
15356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15357         LDKSecretKey o_ref;
15358         CHECK((*env)->GetArrayLength(env, o) == 32);
15359         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
15360         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15361         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
15362         return tag_ptr(ret_conv, true);
15363 }
15364
15365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15366         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15367         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15368         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
15369         return tag_ptr(ret_conv, true);
15370 }
15371
15372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15373         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
15374         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
15375         return ret_conv;
15376 }
15377
15378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15379         if (!ptr_is_owned(_res)) return;
15380         void* _res_ptr = untag_ptr(_res);
15381         CHECK_ACCESS(_res_ptr);
15382         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
15383         FREE(untag_ptr(_res));
15384         CResult_SecretKeyErrorZ_free(_res_conv);
15385 }
15386
15387 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
15388         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15389         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
15390         return tag_ptr(ret_conv, true);
15391 }
15392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15393         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
15394         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
15395         return ret_conv;
15396 }
15397
15398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15399         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
15400         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
15401         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
15402         return tag_ptr(ret_conv, true);
15403 }
15404
15405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15406         LDKPublicKey o_ref;
15407         CHECK((*env)->GetArrayLength(env, o) == 33);
15408         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
15409         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15410         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
15411         return tag_ptr(ret_conv, true);
15412 }
15413
15414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15415         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15416         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15417         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
15418         return tag_ptr(ret_conv, true);
15419 }
15420
15421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15422         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
15423         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
15424         return ret_conv;
15425 }
15426
15427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15428         if (!ptr_is_owned(_res)) return;
15429         void* _res_ptr = untag_ptr(_res);
15430         CHECK_ACCESS(_res_ptr);
15431         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
15432         FREE(untag_ptr(_res));
15433         CResult_PublicKeyErrorZ_free(_res_conv);
15434 }
15435
15436 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
15437         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15438         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
15439         return tag_ptr(ret_conv, true);
15440 }
15441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15442         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
15443         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
15444         return ret_conv;
15445 }
15446
15447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15448         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
15449         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15450         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
15451         return tag_ptr(ret_conv, true);
15452 }
15453
15454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15455         LDKTxCreationKeys o_conv;
15456         o_conv.inner = untag_ptr(o);
15457         o_conv.is_owned = ptr_is_owned(o);
15458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15459         o_conv = TxCreationKeys_clone(&o_conv);
15460         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15461         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
15462         return tag_ptr(ret_conv, true);
15463 }
15464
15465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15466         LDKDecodeError e_conv;
15467         e_conv.inner = untag_ptr(e);
15468         e_conv.is_owned = ptr_is_owned(e);
15469         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15470         e_conv = DecodeError_clone(&e_conv);
15471         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15472         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
15473         return tag_ptr(ret_conv, true);
15474 }
15475
15476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15477         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
15478         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
15479         return ret_conv;
15480 }
15481
15482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15483         if (!ptr_is_owned(_res)) return;
15484         void* _res_ptr = untag_ptr(_res);
15485         CHECK_ACCESS(_res_ptr);
15486         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
15487         FREE(untag_ptr(_res));
15488         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
15489 }
15490
15491 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
15492         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15493         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
15494         return tag_ptr(ret_conv, true);
15495 }
15496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15497         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
15498         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
15499         return ret_conv;
15500 }
15501
15502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15503         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
15504         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
15505         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
15506         return tag_ptr(ret_conv, true);
15507 }
15508
15509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15510         LDKChannelPublicKeys o_conv;
15511         o_conv.inner = untag_ptr(o);
15512         o_conv.is_owned = ptr_is_owned(o);
15513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15514         o_conv = ChannelPublicKeys_clone(&o_conv);
15515         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15516         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
15517         return tag_ptr(ret_conv, true);
15518 }
15519
15520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15521         LDKDecodeError e_conv;
15522         e_conv.inner = untag_ptr(e);
15523         e_conv.is_owned = ptr_is_owned(e);
15524         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15525         e_conv = DecodeError_clone(&e_conv);
15526         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15527         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
15528         return tag_ptr(ret_conv, true);
15529 }
15530
15531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15532         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
15533         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
15534         return ret_conv;
15535 }
15536
15537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15538         if (!ptr_is_owned(_res)) return;
15539         void* _res_ptr = untag_ptr(_res);
15540         CHECK_ACCESS(_res_ptr);
15541         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
15542         FREE(untag_ptr(_res));
15543         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
15544 }
15545
15546 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
15547         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15548         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
15549         return tag_ptr(ret_conv, true);
15550 }
15551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15552         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
15553         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
15554         return ret_conv;
15555 }
15556
15557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15558         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
15559         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15560         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
15561         return tag_ptr(ret_conv, true);
15562 }
15563
15564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15565         LDKTxCreationKeys o_conv;
15566         o_conv.inner = untag_ptr(o);
15567         o_conv.is_owned = ptr_is_owned(o);
15568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15569         o_conv = TxCreationKeys_clone(&o_conv);
15570         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15571         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
15572         return tag_ptr(ret_conv, true);
15573 }
15574
15575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15576         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
15577         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15578         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
15579         return tag_ptr(ret_conv, true);
15580 }
15581
15582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15583         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
15584         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
15585         return ret_conv;
15586 }
15587
15588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15589         if (!ptr_is_owned(_res)) return;
15590         void* _res_ptr = untag_ptr(_res);
15591         CHECK_ACCESS(_res_ptr);
15592         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
15593         FREE(untag_ptr(_res));
15594         CResult_TxCreationKeysErrorZ_free(_res_conv);
15595 }
15596
15597 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
15598         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15599         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
15600         return tag_ptr(ret_conv, true);
15601 }
15602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15603         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
15604         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
15605         return ret_conv;
15606 }
15607
15608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15609         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
15610         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
15611         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
15612         return tag_ptr(ret_conv, true);
15613 }
15614
15615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
15616         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15617         *ret_copy = COption_u32Z_some(o);
15618         int64_t ret_ref = tag_ptr(ret_copy, true);
15619         return ret_ref;
15620 }
15621
15622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
15623         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15624         *ret_copy = COption_u32Z_none();
15625         int64_t ret_ref = tag_ptr(ret_copy, true);
15626         return ret_ref;
15627 }
15628
15629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15630         if (!ptr_is_owned(_res)) return;
15631         void* _res_ptr = untag_ptr(_res);
15632         CHECK_ACCESS(_res_ptr);
15633         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
15634         FREE(untag_ptr(_res));
15635         COption_u32Z_free(_res_conv);
15636 }
15637
15638 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
15639         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15640         *ret_copy = COption_u32Z_clone(arg);
15641         int64_t ret_ref = tag_ptr(ret_copy, true);
15642         return ret_ref;
15643 }
15644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15645         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
15646         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
15647         return ret_conv;
15648 }
15649
15650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15651         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
15652         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15653         *ret_copy = COption_u32Z_clone(orig_conv);
15654         int64_t ret_ref = tag_ptr(ret_copy, true);
15655         return ret_ref;
15656 }
15657
15658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15659         LDKHTLCOutputInCommitment o_conv;
15660         o_conv.inner = untag_ptr(o);
15661         o_conv.is_owned = ptr_is_owned(o);
15662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15663         o_conv = HTLCOutputInCommitment_clone(&o_conv);
15664         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15665         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
15666         return tag_ptr(ret_conv, true);
15667 }
15668
15669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15670         LDKDecodeError e_conv;
15671         e_conv.inner = untag_ptr(e);
15672         e_conv.is_owned = ptr_is_owned(e);
15673         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15674         e_conv = DecodeError_clone(&e_conv);
15675         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15676         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
15677         return tag_ptr(ret_conv, true);
15678 }
15679
15680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15681         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
15682         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
15683         return ret_conv;
15684 }
15685
15686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15687         if (!ptr_is_owned(_res)) return;
15688         void* _res_ptr = untag_ptr(_res);
15689         CHECK_ACCESS(_res_ptr);
15690         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
15691         FREE(untag_ptr(_res));
15692         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
15693 }
15694
15695 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
15696         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15697         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
15698         return tag_ptr(ret_conv, true);
15699 }
15700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15701         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
15702         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
15703         return ret_conv;
15704 }
15705
15706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15707         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
15708         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15709         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
15710         return tag_ptr(ret_conv, true);
15711 }
15712
15713 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
15714         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
15715         return ret_conv;
15716 }
15717
15718 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
15719         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
15720         return ret_conv;
15721 }
15722
15723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
15724         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
15725         COption_NoneZ_free(_res_conv);
15726 }
15727
15728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15729         LDKCounterpartyChannelTransactionParameters o_conv;
15730         o_conv.inner = untag_ptr(o);
15731         o_conv.is_owned = ptr_is_owned(o);
15732         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15733         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
15734         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15735         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15736         return tag_ptr(ret_conv, true);
15737 }
15738
15739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15740         LDKDecodeError e_conv;
15741         e_conv.inner = untag_ptr(e);
15742         e_conv.is_owned = ptr_is_owned(e);
15743         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15744         e_conv = DecodeError_clone(&e_conv);
15745         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15746         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
15747         return tag_ptr(ret_conv, true);
15748 }
15749
15750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15751         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
15752         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15753         return ret_conv;
15754 }
15755
15756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15757         if (!ptr_is_owned(_res)) return;
15758         void* _res_ptr = untag_ptr(_res);
15759         CHECK_ACCESS(_res_ptr);
15760         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15761         FREE(untag_ptr(_res));
15762         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15763 }
15764
15765 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15766         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15767         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
15768         return tag_ptr(ret_conv, true);
15769 }
15770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15771         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
15772         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15773         return ret_conv;
15774 }
15775
15776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15777         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
15778         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15779         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15780         return tag_ptr(ret_conv, true);
15781 }
15782
15783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15784         LDKChannelTransactionParameters o_conv;
15785         o_conv.inner = untag_ptr(o);
15786         o_conv.is_owned = ptr_is_owned(o);
15787         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15788         o_conv = ChannelTransactionParameters_clone(&o_conv);
15789         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15790         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15791         return tag_ptr(ret_conv, true);
15792 }
15793
15794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15795         LDKDecodeError e_conv;
15796         e_conv.inner = untag_ptr(e);
15797         e_conv.is_owned = ptr_is_owned(e);
15798         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15799         e_conv = DecodeError_clone(&e_conv);
15800         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15801         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
15802         return tag_ptr(ret_conv, true);
15803 }
15804
15805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15806         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
15807         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15808         return ret_conv;
15809 }
15810
15811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15812         if (!ptr_is_owned(_res)) return;
15813         void* _res_ptr = untag_ptr(_res);
15814         CHECK_ACCESS(_res_ptr);
15815         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15816         FREE(untag_ptr(_res));
15817         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15818 }
15819
15820 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15821         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15822         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
15823         return tag_ptr(ret_conv, true);
15824 }
15825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15826         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
15827         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15828         return ret_conv;
15829 }
15830
15831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15832         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
15833         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15834         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15835         return tag_ptr(ret_conv, true);
15836 }
15837
15838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15839         LDKCVec_SignatureZ _res_constr;
15840         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15841         if (_res_constr.datalen > 0)
15842                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15843         else
15844                 _res_constr.data = NULL;
15845         for (size_t i = 0; i < _res_constr.datalen; i++) {
15846                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15847                 LDKSignature _res_conv_8_ref;
15848                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
15849                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
15850                 _res_constr.data[i] = _res_conv_8_ref;
15851         }
15852         CVec_SignatureZ_free(_res_constr);
15853 }
15854
15855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15856         LDKHolderCommitmentTransaction o_conv;
15857         o_conv.inner = untag_ptr(o);
15858         o_conv.is_owned = ptr_is_owned(o);
15859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15860         o_conv = HolderCommitmentTransaction_clone(&o_conv);
15861         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15862         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
15863         return tag_ptr(ret_conv, true);
15864 }
15865
15866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15867         LDKDecodeError e_conv;
15868         e_conv.inner = untag_ptr(e);
15869         e_conv.is_owned = ptr_is_owned(e);
15870         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15871         e_conv = DecodeError_clone(&e_conv);
15872         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15873         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
15874         return tag_ptr(ret_conv, true);
15875 }
15876
15877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15878         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15879         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15880         return ret_conv;
15881 }
15882
15883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15884         if (!ptr_is_owned(_res)) return;
15885         void* _res_ptr = untag_ptr(_res);
15886         CHECK_ACCESS(_res_ptr);
15887         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15888         FREE(untag_ptr(_res));
15889         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
15890 }
15891
15892 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15893         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15894         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
15895         return tag_ptr(ret_conv, true);
15896 }
15897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15898         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15899         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15900         return ret_conv;
15901 }
15902
15903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15904         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15905         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15906         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15907         return tag_ptr(ret_conv, true);
15908 }
15909
15910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15911         LDKBuiltCommitmentTransaction o_conv;
15912         o_conv.inner = untag_ptr(o);
15913         o_conv.is_owned = ptr_is_owned(o);
15914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15915         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
15916         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15917         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
15918         return tag_ptr(ret_conv, true);
15919 }
15920
15921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15922         LDKDecodeError e_conv;
15923         e_conv.inner = untag_ptr(e);
15924         e_conv.is_owned = ptr_is_owned(e);
15925         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15926         e_conv = DecodeError_clone(&e_conv);
15927         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15928         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
15929         return tag_ptr(ret_conv, true);
15930 }
15931
15932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15933         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15934         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15935         return ret_conv;
15936 }
15937
15938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15939         if (!ptr_is_owned(_res)) return;
15940         void* _res_ptr = untag_ptr(_res);
15941         CHECK_ACCESS(_res_ptr);
15942         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15943         FREE(untag_ptr(_res));
15944         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
15945 }
15946
15947 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15948         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15949         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
15950         return tag_ptr(ret_conv, true);
15951 }
15952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15953         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15954         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15955         return ret_conv;
15956 }
15957
15958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15959         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15960         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15961         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15962         return tag_ptr(ret_conv, true);
15963 }
15964
15965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15966         LDKTrustedClosingTransaction o_conv;
15967         o_conv.inner = untag_ptr(o);
15968         o_conv.is_owned = ptr_is_owned(o);
15969         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15970         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
15971         
15972         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15973         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
15974         return tag_ptr(ret_conv, true);
15975 }
15976
15977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
15978         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15979         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
15980         return tag_ptr(ret_conv, true);
15981 }
15982
15983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15984         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
15985         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
15986         return ret_conv;
15987 }
15988
15989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15990         if (!ptr_is_owned(_res)) return;
15991         void* _res_ptr = untag_ptr(_res);
15992         CHECK_ACCESS(_res_ptr);
15993         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
15994         FREE(untag_ptr(_res));
15995         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
15996 }
15997
15998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15999         LDKCommitmentTransaction o_conv;
16000         o_conv.inner = untag_ptr(o);
16001         o_conv.is_owned = ptr_is_owned(o);
16002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16003         o_conv = CommitmentTransaction_clone(&o_conv);
16004         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16005         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
16006         return tag_ptr(ret_conv, true);
16007 }
16008
16009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16010         LDKDecodeError e_conv;
16011         e_conv.inner = untag_ptr(e);
16012         e_conv.is_owned = ptr_is_owned(e);
16013         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16014         e_conv = DecodeError_clone(&e_conv);
16015         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16016         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
16017         return tag_ptr(ret_conv, true);
16018 }
16019
16020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16021         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
16022         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
16023         return ret_conv;
16024 }
16025
16026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16027         if (!ptr_is_owned(_res)) return;
16028         void* _res_ptr = untag_ptr(_res);
16029         CHECK_ACCESS(_res_ptr);
16030         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
16031         FREE(untag_ptr(_res));
16032         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
16033 }
16034
16035 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
16036         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16037         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
16038         return tag_ptr(ret_conv, true);
16039 }
16040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16041         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
16042         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
16043         return ret_conv;
16044 }
16045
16046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16047         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
16048         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
16049         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
16050         return tag_ptr(ret_conv, true);
16051 }
16052
16053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16054         LDKTrustedCommitmentTransaction o_conv;
16055         o_conv.inner = untag_ptr(o);
16056         o_conv.is_owned = ptr_is_owned(o);
16057         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16058         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
16059         
16060         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
16061         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
16062         return tag_ptr(ret_conv, true);
16063 }
16064
16065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
16066         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
16067         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
16068         return tag_ptr(ret_conv, true);
16069 }
16070
16071 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16072         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
16073         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
16074         return ret_conv;
16075 }
16076
16077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16078         if (!ptr_is_owned(_res)) return;
16079         void* _res_ptr = untag_ptr(_res);
16080         CHECK_ACCESS(_res_ptr);
16081         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
16082         FREE(untag_ptr(_res));
16083         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
16084 }
16085
16086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
16087         LDKCVec_SignatureZ o_constr;
16088         o_constr.datalen = (*env)->GetArrayLength(env, o);
16089         if (o_constr.datalen > 0)
16090                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16091         else
16092                 o_constr.data = NULL;
16093         for (size_t i = 0; i < o_constr.datalen; i++) {
16094                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
16095                 LDKSignature o_conv_8_ref;
16096                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
16097                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
16098                 o_constr.data[i] = o_conv_8_ref;
16099         }
16100         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16101         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
16102         return tag_ptr(ret_conv, true);
16103 }
16104
16105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
16106         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16107         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
16108         return tag_ptr(ret_conv, true);
16109 }
16110
16111 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16112         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
16113         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
16114         return ret_conv;
16115 }
16116
16117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16118         if (!ptr_is_owned(_res)) return;
16119         void* _res_ptr = untag_ptr(_res);
16120         CHECK_ACCESS(_res_ptr);
16121         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
16122         FREE(untag_ptr(_res));
16123         CResult_CVec_SignatureZNoneZ_free(_res_conv);
16124 }
16125
16126 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
16127         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16128         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
16129         return tag_ptr(ret_conv, true);
16130 }
16131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16132         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
16133         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
16134         return ret_conv;
16135 }
16136
16137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16138         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
16139         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
16140         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
16141         return tag_ptr(ret_conv, true);
16142 }
16143
16144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16145         LDKShutdownScript o_conv;
16146         o_conv.inner = untag_ptr(o);
16147         o_conv.is_owned = ptr_is_owned(o);
16148         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16149         o_conv = ShutdownScript_clone(&o_conv);
16150         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16151         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
16152         return tag_ptr(ret_conv, true);
16153 }
16154
16155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16156         LDKDecodeError e_conv;
16157         e_conv.inner = untag_ptr(e);
16158         e_conv.is_owned = ptr_is_owned(e);
16159         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16160         e_conv = DecodeError_clone(&e_conv);
16161         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16162         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
16163         return tag_ptr(ret_conv, true);
16164 }
16165
16166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16167         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
16168         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
16169         return ret_conv;
16170 }
16171
16172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16173         if (!ptr_is_owned(_res)) return;
16174         void* _res_ptr = untag_ptr(_res);
16175         CHECK_ACCESS(_res_ptr);
16176         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
16177         FREE(untag_ptr(_res));
16178         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
16179 }
16180
16181 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
16182         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16183         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
16184         return tag_ptr(ret_conv, true);
16185 }
16186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16187         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
16188         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
16189         return ret_conv;
16190 }
16191
16192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16193         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
16194         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
16195         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
16196         return tag_ptr(ret_conv, true);
16197 }
16198
16199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16200         LDKShutdownScript o_conv;
16201         o_conv.inner = untag_ptr(o);
16202         o_conv.is_owned = ptr_is_owned(o);
16203         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16204         o_conv = ShutdownScript_clone(&o_conv);
16205         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16206         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
16207         return tag_ptr(ret_conv, true);
16208 }
16209
16210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16211         LDKInvalidShutdownScript e_conv;
16212         e_conv.inner = untag_ptr(e);
16213         e_conv.is_owned = ptr_is_owned(e);
16214         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16215         e_conv = InvalidShutdownScript_clone(&e_conv);
16216         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16217         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
16218         return tag_ptr(ret_conv, true);
16219 }
16220
16221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16222         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
16223         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
16224         return ret_conv;
16225 }
16226
16227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16228         if (!ptr_is_owned(_res)) return;
16229         void* _res_ptr = untag_ptr(_res);
16230         CHECK_ACCESS(_res_ptr);
16231         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
16232         FREE(untag_ptr(_res));
16233         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
16234 }
16235
16236 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
16237         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16238         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
16239         return tag_ptr(ret_conv, true);
16240 }
16241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16242         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
16243         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
16244         return ret_conv;
16245 }
16246
16247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16248         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
16249         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
16250         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
16251         return tag_ptr(ret_conv, true);
16252 }
16253
16254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16255         void* o_ptr = untag_ptr(o);
16256         CHECK_ACCESS(o_ptr);
16257         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
16258         if (o_conv.free == LDKWriteableScore_JCalls_free) {
16259                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16260                 LDKWriteableScore_JCalls_cloned(&o_conv);
16261         }
16262         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
16263         *ret_copy = COption_WriteableScoreZ_some(o_conv);
16264         int64_t ret_ref = tag_ptr(ret_copy, true);
16265         return ret_ref;
16266 }
16267
16268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
16269         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
16270         *ret_copy = COption_WriteableScoreZ_none();
16271         int64_t ret_ref = tag_ptr(ret_copy, true);
16272         return ret_ref;
16273 }
16274
16275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16276         if (!ptr_is_owned(_res)) return;
16277         void* _res_ptr = untag_ptr(_res);
16278         CHECK_ACCESS(_res_ptr);
16279         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
16280         FREE(untag_ptr(_res));
16281         COption_WriteableScoreZ_free(_res_conv);
16282 }
16283
16284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
16285         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
16286         *ret_conv = CResult_NoneErrorZ_ok();
16287         return tag_ptr(ret_conv, true);
16288 }
16289
16290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16291         LDKIOError e_conv = LDKIOError_from_java(env, e);
16292         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
16293         *ret_conv = CResult_NoneErrorZ_err(e_conv);
16294         return tag_ptr(ret_conv, true);
16295 }
16296
16297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16298         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
16299         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
16300         return ret_conv;
16301 }
16302
16303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16304         if (!ptr_is_owned(_res)) return;
16305         void* _res_ptr = untag_ptr(_res);
16306         CHECK_ACCESS(_res_ptr);
16307         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
16308         FREE(untag_ptr(_res));
16309         CResult_NoneErrorZ_free(_res_conv);
16310 }
16311
16312 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
16313         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
16314         *ret_conv = CResult_NoneErrorZ_clone(arg);
16315         return tag_ptr(ret_conv, true);
16316 }
16317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16318         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
16319         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
16320         return ret_conv;
16321 }
16322
16323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16324         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
16325         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
16326         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
16327         return tag_ptr(ret_conv, true);
16328 }
16329
16330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16331         LDKRouteHop o_conv;
16332         o_conv.inner = untag_ptr(o);
16333         o_conv.is_owned = ptr_is_owned(o);
16334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16335         o_conv = RouteHop_clone(&o_conv);
16336         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16337         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
16338         return tag_ptr(ret_conv, true);
16339 }
16340
16341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16342         LDKDecodeError e_conv;
16343         e_conv.inner = untag_ptr(e);
16344         e_conv.is_owned = ptr_is_owned(e);
16345         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16346         e_conv = DecodeError_clone(&e_conv);
16347         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16348         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
16349         return tag_ptr(ret_conv, true);
16350 }
16351
16352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16353         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
16354         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
16355         return ret_conv;
16356 }
16357
16358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16359         if (!ptr_is_owned(_res)) return;
16360         void* _res_ptr = untag_ptr(_res);
16361         CHECK_ACCESS(_res_ptr);
16362         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
16363         FREE(untag_ptr(_res));
16364         CResult_RouteHopDecodeErrorZ_free(_res_conv);
16365 }
16366
16367 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
16368         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16369         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
16370         return tag_ptr(ret_conv, true);
16371 }
16372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16373         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
16374         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
16375         return ret_conv;
16376 }
16377
16378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16379         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
16380         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16381         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
16382         return tag_ptr(ret_conv, true);
16383 }
16384
16385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16386         LDKCVec_RouteHopZ _res_constr;
16387         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16388         if (_res_constr.datalen > 0)
16389                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16390         else
16391                 _res_constr.data = NULL;
16392         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16393         for (size_t k = 0; k < _res_constr.datalen; k++) {
16394                 int64_t _res_conv_10 = _res_vals[k];
16395                 LDKRouteHop _res_conv_10_conv;
16396                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
16397                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
16398                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
16399                 _res_constr.data[k] = _res_conv_10_conv;
16400         }
16401         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16402         CVec_RouteHopZ_free(_res_constr);
16403 }
16404
16405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16406         LDKCVec_CVec_RouteHopZZ _res_constr;
16407         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16408         if (_res_constr.datalen > 0)
16409                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
16410         else
16411                 _res_constr.data = NULL;
16412         for (size_t m = 0; m < _res_constr.datalen; m++) {
16413                 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
16414                 LDKCVec_RouteHopZ _res_conv_12_constr;
16415                 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
16416                 if (_res_conv_12_constr.datalen > 0)
16417                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
16418                 else
16419                         _res_conv_12_constr.data = NULL;
16420                 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
16421                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
16422                         int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
16423                         LDKRouteHop _res_conv_12_conv_10_conv;
16424                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
16425                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
16426                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
16427                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
16428                 }
16429                 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
16430                 _res_constr.data[m] = _res_conv_12_constr;
16431         }
16432         CVec_CVec_RouteHopZZ_free(_res_constr);
16433 }
16434
16435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16436         LDKRoute o_conv;
16437         o_conv.inner = untag_ptr(o);
16438         o_conv.is_owned = ptr_is_owned(o);
16439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16440         o_conv = Route_clone(&o_conv);
16441         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16442         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
16443         return tag_ptr(ret_conv, true);
16444 }
16445
16446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16447         LDKDecodeError e_conv;
16448         e_conv.inner = untag_ptr(e);
16449         e_conv.is_owned = ptr_is_owned(e);
16450         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16451         e_conv = DecodeError_clone(&e_conv);
16452         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16453         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
16454         return tag_ptr(ret_conv, true);
16455 }
16456
16457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16458         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
16459         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
16460         return ret_conv;
16461 }
16462
16463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16464         if (!ptr_is_owned(_res)) return;
16465         void* _res_ptr = untag_ptr(_res);
16466         CHECK_ACCESS(_res_ptr);
16467         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
16468         FREE(untag_ptr(_res));
16469         CResult_RouteDecodeErrorZ_free(_res_conv);
16470 }
16471
16472 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
16473         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16474         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
16475         return tag_ptr(ret_conv, true);
16476 }
16477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16478         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
16479         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
16480         return ret_conv;
16481 }
16482
16483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16484         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
16485         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16486         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
16487         return tag_ptr(ret_conv, true);
16488 }
16489
16490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16491         LDKRouteParameters o_conv;
16492         o_conv.inner = untag_ptr(o);
16493         o_conv.is_owned = ptr_is_owned(o);
16494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16495         o_conv = RouteParameters_clone(&o_conv);
16496         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16497         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
16498         return tag_ptr(ret_conv, true);
16499 }
16500
16501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16502         LDKDecodeError e_conv;
16503         e_conv.inner = untag_ptr(e);
16504         e_conv.is_owned = ptr_is_owned(e);
16505         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16506         e_conv = DecodeError_clone(&e_conv);
16507         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16508         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
16509         return tag_ptr(ret_conv, true);
16510 }
16511
16512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16513         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
16514         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
16515         return ret_conv;
16516 }
16517
16518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16519         if (!ptr_is_owned(_res)) return;
16520         void* _res_ptr = untag_ptr(_res);
16521         CHECK_ACCESS(_res_ptr);
16522         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
16523         FREE(untag_ptr(_res));
16524         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
16525 }
16526
16527 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
16528         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16529         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
16530         return tag_ptr(ret_conv, true);
16531 }
16532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16533         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
16534         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
16535         return ret_conv;
16536 }
16537
16538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16539         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
16540         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
16541         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
16542         return tag_ptr(ret_conv, true);
16543 }
16544
16545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16546         LDKCVec_RouteHintZ _res_constr;
16547         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16548         if (_res_constr.datalen > 0)
16549                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16550         else
16551                 _res_constr.data = NULL;
16552         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16553         for (size_t l = 0; l < _res_constr.datalen; l++) {
16554                 int64_t _res_conv_11 = _res_vals[l];
16555                 LDKRouteHint _res_conv_11_conv;
16556                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
16557                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
16558                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
16559                 _res_constr.data[l] = _res_conv_11_conv;
16560         }
16561         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16562         CVec_RouteHintZ_free(_res_constr);
16563 }
16564
16565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
16566         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16567         *ret_copy = COption_u64Z_some(o);
16568         int64_t ret_ref = tag_ptr(ret_copy, true);
16569         return ret_ref;
16570 }
16571
16572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
16573         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16574         *ret_copy = COption_u64Z_none();
16575         int64_t ret_ref = tag_ptr(ret_copy, true);
16576         return ret_ref;
16577 }
16578
16579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16580         if (!ptr_is_owned(_res)) return;
16581         void* _res_ptr = untag_ptr(_res);
16582         CHECK_ACCESS(_res_ptr);
16583         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
16584         FREE(untag_ptr(_res));
16585         COption_u64Z_free(_res_conv);
16586 }
16587
16588 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
16589         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16590         *ret_copy = COption_u64Z_clone(arg);
16591         int64_t ret_ref = tag_ptr(ret_copy, true);
16592         return ret_ref;
16593 }
16594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16595         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
16596         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
16597         return ret_conv;
16598 }
16599
16600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16601         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
16602         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16603         *ret_copy = COption_u64Z_clone(orig_conv);
16604         int64_t ret_ref = tag_ptr(ret_copy, true);
16605         return ret_ref;
16606 }
16607
16608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16609         LDKCVec_u64Z _res_constr;
16610         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16611         if (_res_constr.datalen > 0)
16612                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16613         else
16614                 _res_constr.data = NULL;
16615         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16616         for (size_t g = 0; g < _res_constr.datalen; g++) {
16617                 int64_t _res_conv_6 = _res_vals[g];
16618                 _res_constr.data[g] = _res_conv_6;
16619         }
16620         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16621         CVec_u64Z_free(_res_constr);
16622 }
16623
16624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16625         LDKPaymentParameters o_conv;
16626         o_conv.inner = untag_ptr(o);
16627         o_conv.is_owned = ptr_is_owned(o);
16628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16629         o_conv = PaymentParameters_clone(&o_conv);
16630         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16631         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
16632         return tag_ptr(ret_conv, true);
16633 }
16634
16635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16636         LDKDecodeError e_conv;
16637         e_conv.inner = untag_ptr(e);
16638         e_conv.is_owned = ptr_is_owned(e);
16639         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16640         e_conv = DecodeError_clone(&e_conv);
16641         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16642         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
16643         return tag_ptr(ret_conv, true);
16644 }
16645
16646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16647         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
16648         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
16649         return ret_conv;
16650 }
16651
16652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16653         if (!ptr_is_owned(_res)) return;
16654         void* _res_ptr = untag_ptr(_res);
16655         CHECK_ACCESS(_res_ptr);
16656         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
16657         FREE(untag_ptr(_res));
16658         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
16659 }
16660
16661 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
16662         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16663         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
16664         return tag_ptr(ret_conv, true);
16665 }
16666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16667         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
16668         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
16669         return ret_conv;
16670 }
16671
16672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16673         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
16674         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
16675         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
16676         return tag_ptr(ret_conv, true);
16677 }
16678
16679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16680         LDKCVec_RouteHintHopZ _res_constr;
16681         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16682         if (_res_constr.datalen > 0)
16683                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
16684         else
16685                 _res_constr.data = NULL;
16686         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16687         for (size_t o = 0; o < _res_constr.datalen; o++) {
16688                 int64_t _res_conv_14 = _res_vals[o];
16689                 LDKRouteHintHop _res_conv_14_conv;
16690                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
16691                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
16692                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
16693                 _res_constr.data[o] = _res_conv_14_conv;
16694         }
16695         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16696         CVec_RouteHintHopZ_free(_res_constr);
16697 }
16698
16699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16700         LDKRouteHint o_conv;
16701         o_conv.inner = untag_ptr(o);
16702         o_conv.is_owned = ptr_is_owned(o);
16703         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16704         o_conv = RouteHint_clone(&o_conv);
16705         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16706         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
16707         return tag_ptr(ret_conv, true);
16708 }
16709
16710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16711         LDKDecodeError e_conv;
16712         e_conv.inner = untag_ptr(e);
16713         e_conv.is_owned = ptr_is_owned(e);
16714         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16715         e_conv = DecodeError_clone(&e_conv);
16716         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16717         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
16718         return tag_ptr(ret_conv, true);
16719 }
16720
16721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16722         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
16723         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
16724         return ret_conv;
16725 }
16726
16727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16728         if (!ptr_is_owned(_res)) return;
16729         void* _res_ptr = untag_ptr(_res);
16730         CHECK_ACCESS(_res_ptr);
16731         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
16732         FREE(untag_ptr(_res));
16733         CResult_RouteHintDecodeErrorZ_free(_res_conv);
16734 }
16735
16736 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
16737         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16738         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
16739         return tag_ptr(ret_conv, true);
16740 }
16741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16742         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
16743         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
16744         return ret_conv;
16745 }
16746
16747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16748         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
16749         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
16750         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
16751         return tag_ptr(ret_conv, true);
16752 }
16753
16754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16755         LDKRouteHintHop o_conv;
16756         o_conv.inner = untag_ptr(o);
16757         o_conv.is_owned = ptr_is_owned(o);
16758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16759         o_conv = RouteHintHop_clone(&o_conv);
16760         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16761         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
16762         return tag_ptr(ret_conv, true);
16763 }
16764
16765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16766         LDKDecodeError e_conv;
16767         e_conv.inner = untag_ptr(e);
16768         e_conv.is_owned = ptr_is_owned(e);
16769         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16770         e_conv = DecodeError_clone(&e_conv);
16771         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16772         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
16773         return tag_ptr(ret_conv, true);
16774 }
16775
16776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16777         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
16778         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
16779         return ret_conv;
16780 }
16781
16782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16783         if (!ptr_is_owned(_res)) return;
16784         void* _res_ptr = untag_ptr(_res);
16785         CHECK_ACCESS(_res_ptr);
16786         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
16787         FREE(untag_ptr(_res));
16788         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
16789 }
16790
16791 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
16792         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16793         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
16794         return tag_ptr(ret_conv, true);
16795 }
16796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16797         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
16798         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
16799         return ret_conv;
16800 }
16801
16802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16803         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
16804         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
16805         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
16806         return tag_ptr(ret_conv, true);
16807 }
16808
16809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16810         LDKCVec_ChannelDetailsZ _res_constr;
16811         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16812         if (_res_constr.datalen > 0)
16813                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16814         else
16815                 _res_constr.data = NULL;
16816         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16817         for (size_t q = 0; q < _res_constr.datalen; q++) {
16818                 int64_t _res_conv_16 = _res_vals[q];
16819                 LDKChannelDetails _res_conv_16_conv;
16820                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
16821                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
16822                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16823                 _res_constr.data[q] = _res_conv_16_conv;
16824         }
16825         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16826         CVec_ChannelDetailsZ_free(_res_constr);
16827 }
16828
16829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16830         LDKRoute o_conv;
16831         o_conv.inner = untag_ptr(o);
16832         o_conv.is_owned = ptr_is_owned(o);
16833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16834         o_conv = Route_clone(&o_conv);
16835         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16836         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
16837         return tag_ptr(ret_conv, true);
16838 }
16839
16840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16841         LDKLightningError e_conv;
16842         e_conv.inner = untag_ptr(e);
16843         e_conv.is_owned = ptr_is_owned(e);
16844         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16845         e_conv = LightningError_clone(&e_conv);
16846         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16847         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
16848         return tag_ptr(ret_conv, true);
16849 }
16850
16851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16852         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
16853         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
16854         return ret_conv;
16855 }
16856
16857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16858         if (!ptr_is_owned(_res)) return;
16859         void* _res_ptr = untag_ptr(_res);
16860         CHECK_ACCESS(_res_ptr);
16861         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
16862         FREE(untag_ptr(_res));
16863         CResult_RouteLightningErrorZ_free(_res_conv);
16864 }
16865
16866 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
16867         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16868         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
16869         return tag_ptr(ret_conv, true);
16870 }
16871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16872         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
16873         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
16874         return ret_conv;
16875 }
16876
16877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16878         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
16879         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16880         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
16881         return tag_ptr(ret_conv, true);
16882 }
16883
16884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16885         void* o_ptr = untag_ptr(o);
16886         CHECK_ACCESS(o_ptr);
16887         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
16888         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
16889         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16890         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
16891         return tag_ptr(ret_conv, true);
16892 }
16893
16894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16895         LDKDecodeError e_conv;
16896         e_conv.inner = untag_ptr(e);
16897         e_conv.is_owned = ptr_is_owned(e);
16898         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16899         e_conv = DecodeError_clone(&e_conv);
16900         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16901         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
16902         return tag_ptr(ret_conv, true);
16903 }
16904
16905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16906         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
16907         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
16908         return ret_conv;
16909 }
16910
16911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16912         if (!ptr_is_owned(_res)) return;
16913         void* _res_ptr = untag_ptr(_res);
16914         CHECK_ACCESS(_res_ptr);
16915         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
16916         FREE(untag_ptr(_res));
16917         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
16918 }
16919
16920 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
16921         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16922         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
16923         return tag_ptr(ret_conv, true);
16924 }
16925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16926         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
16927         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
16928         return ret_conv;
16929 }
16930
16931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16932         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
16933         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
16934         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
16935         return tag_ptr(ret_conv, true);
16936 }
16937
16938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16939         void* o_ptr = untag_ptr(o);
16940         CHECK_ACCESS(o_ptr);
16941         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
16942         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
16943         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16944         *ret_copy = COption_ClosureReasonZ_some(o_conv);
16945         int64_t ret_ref = tag_ptr(ret_copy, true);
16946         return ret_ref;
16947 }
16948
16949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
16950         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16951         *ret_copy = COption_ClosureReasonZ_none();
16952         int64_t ret_ref = tag_ptr(ret_copy, true);
16953         return ret_ref;
16954 }
16955
16956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16957         if (!ptr_is_owned(_res)) return;
16958         void* _res_ptr = untag_ptr(_res);
16959         CHECK_ACCESS(_res_ptr);
16960         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
16961         FREE(untag_ptr(_res));
16962         COption_ClosureReasonZ_free(_res_conv);
16963 }
16964
16965 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
16966         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16967         *ret_copy = COption_ClosureReasonZ_clone(arg);
16968         int64_t ret_ref = tag_ptr(ret_copy, true);
16969         return ret_ref;
16970 }
16971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16972         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
16973         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
16974         return ret_conv;
16975 }
16976
16977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16978         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
16979         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16980         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
16981         int64_t ret_ref = tag_ptr(ret_copy, true);
16982         return ret_ref;
16983 }
16984
16985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16986         void* o_ptr = untag_ptr(o);
16987         CHECK_ACCESS(o_ptr);
16988         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
16989         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
16990         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16991         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
16992         return tag_ptr(ret_conv, true);
16993 }
16994
16995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16996         LDKDecodeError e_conv;
16997         e_conv.inner = untag_ptr(e);
16998         e_conv.is_owned = ptr_is_owned(e);
16999         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17000         e_conv = DecodeError_clone(&e_conv);
17001         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
17002         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
17003         return tag_ptr(ret_conv, true);
17004 }
17005
17006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17007         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
17008         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
17009         return ret_conv;
17010 }
17011
17012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17013         if (!ptr_is_owned(_res)) return;
17014         void* _res_ptr = untag_ptr(_res);
17015         CHECK_ACCESS(_res_ptr);
17016         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
17017         FREE(untag_ptr(_res));
17018         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
17019 }
17020
17021 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
17022         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
17023         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
17024         return tag_ptr(ret_conv, true);
17025 }
17026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17027         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
17028         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
17029         return ret_conv;
17030 }
17031
17032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17033         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
17034         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
17035         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
17036         return tag_ptr(ret_conv, true);
17037 }
17038
17039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17040         void* o_ptr = untag_ptr(o);
17041         CHECK_ACCESS(o_ptr);
17042         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
17043         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
17044         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
17045         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
17046         int64_t ret_ref = tag_ptr(ret_copy, true);
17047         return ret_ref;
17048 }
17049
17050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
17051         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
17052         *ret_copy = COption_HTLCDestinationZ_none();
17053         int64_t ret_ref = tag_ptr(ret_copy, true);
17054         return ret_ref;
17055 }
17056
17057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17058         if (!ptr_is_owned(_res)) return;
17059         void* _res_ptr = untag_ptr(_res);
17060         CHECK_ACCESS(_res_ptr);
17061         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
17062         FREE(untag_ptr(_res));
17063         COption_HTLCDestinationZ_free(_res_conv);
17064 }
17065
17066 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
17067         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
17068         *ret_copy = COption_HTLCDestinationZ_clone(arg);
17069         int64_t ret_ref = tag_ptr(ret_copy, true);
17070         return ret_ref;
17071 }
17072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17073         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
17074         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
17075         return ret_conv;
17076 }
17077
17078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17079         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
17080         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
17081         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
17082         int64_t ret_ref = tag_ptr(ret_copy, true);
17083         return ret_ref;
17084 }
17085
17086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17087         void* o_ptr = untag_ptr(o);
17088         CHECK_ACCESS(o_ptr);
17089         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
17090         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
17091         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
17092         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
17093         return tag_ptr(ret_conv, true);
17094 }
17095
17096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17097         LDKDecodeError e_conv;
17098         e_conv.inner = untag_ptr(e);
17099         e_conv.is_owned = ptr_is_owned(e);
17100         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17101         e_conv = DecodeError_clone(&e_conv);
17102         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
17103         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
17104         return tag_ptr(ret_conv, true);
17105 }
17106
17107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17108         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
17109         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
17110         return ret_conv;
17111 }
17112
17113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17114         if (!ptr_is_owned(_res)) return;
17115         void* _res_ptr = untag_ptr(_res);
17116         CHECK_ACCESS(_res_ptr);
17117         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
17118         FREE(untag_ptr(_res));
17119         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
17120 }
17121
17122 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
17123         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
17124         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
17125         return tag_ptr(ret_conv, true);
17126 }
17127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17128         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
17129         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
17130         return ret_conv;
17131 }
17132
17133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17134         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
17135         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
17136         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
17137         return tag_ptr(ret_conv, true);
17138 }
17139
17140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17141         void* o_ptr = untag_ptr(o);
17142         CHECK_ACCESS(o_ptr);
17143         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
17144         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
17145         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17146         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
17147         int64_t ret_ref = tag_ptr(ret_copy, true);
17148         return ret_ref;
17149 }
17150
17151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
17152         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17153         *ret_copy = COption_NetworkUpdateZ_none();
17154         int64_t ret_ref = tag_ptr(ret_copy, true);
17155         return ret_ref;
17156 }
17157
17158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17159         if (!ptr_is_owned(_res)) return;
17160         void* _res_ptr = untag_ptr(_res);
17161         CHECK_ACCESS(_res_ptr);
17162         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
17163         FREE(untag_ptr(_res));
17164         COption_NetworkUpdateZ_free(_res_conv);
17165 }
17166
17167 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
17168         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17169         *ret_copy = COption_NetworkUpdateZ_clone(arg);
17170         int64_t ret_ref = tag_ptr(ret_copy, true);
17171         return ret_ref;
17172 }
17173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17174         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
17175         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
17176         return ret_conv;
17177 }
17178
17179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17180         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
17181         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
17182         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
17183         int64_t ret_ref = tag_ptr(ret_copy, true);
17184         return ret_ref;
17185 }
17186
17187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17188         LDKCVec_SpendableOutputDescriptorZ _res_constr;
17189         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17190         if (_res_constr.datalen > 0)
17191                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17192         else
17193                 _res_constr.data = NULL;
17194         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17195         for (size_t b = 0; b < _res_constr.datalen; b++) {
17196                 int64_t _res_conv_27 = _res_vals[b];
17197                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
17198                 CHECK_ACCESS(_res_conv_27_ptr);
17199                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
17200                 FREE(untag_ptr(_res_conv_27));
17201                 _res_constr.data[b] = _res_conv_27_conv;
17202         }
17203         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17204         CVec_SpendableOutputDescriptorZ_free(_res_constr);
17205 }
17206
17207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17208         void* o_ptr = untag_ptr(o);
17209         CHECK_ACCESS(o_ptr);
17210         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
17211         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
17212         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
17213         *ret_copy = COption_EventZ_some(o_conv);
17214         int64_t ret_ref = tag_ptr(ret_copy, true);
17215         return ret_ref;
17216 }
17217
17218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
17219         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
17220         *ret_copy = COption_EventZ_none();
17221         int64_t ret_ref = tag_ptr(ret_copy, true);
17222         return ret_ref;
17223 }
17224
17225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17226         if (!ptr_is_owned(_res)) return;
17227         void* _res_ptr = untag_ptr(_res);
17228         CHECK_ACCESS(_res_ptr);
17229         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
17230         FREE(untag_ptr(_res));
17231         COption_EventZ_free(_res_conv);
17232 }
17233
17234 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
17235         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
17236         *ret_copy = COption_EventZ_clone(arg);
17237         int64_t ret_ref = tag_ptr(ret_copy, true);
17238         return ret_ref;
17239 }
17240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17241         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
17242         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
17243         return ret_conv;
17244 }
17245
17246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17247         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
17248         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
17249         *ret_copy = COption_EventZ_clone(orig_conv);
17250         int64_t ret_ref = tag_ptr(ret_copy, true);
17251         return ret_ref;
17252 }
17253
17254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17255         void* o_ptr = untag_ptr(o);
17256         CHECK_ACCESS(o_ptr);
17257         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
17258         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
17259         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
17260         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
17261         return tag_ptr(ret_conv, true);
17262 }
17263
17264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17265         LDKDecodeError e_conv;
17266         e_conv.inner = untag_ptr(e);
17267         e_conv.is_owned = ptr_is_owned(e);
17268         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17269         e_conv = DecodeError_clone(&e_conv);
17270         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
17271         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
17272         return tag_ptr(ret_conv, true);
17273 }
17274
17275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17276         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
17277         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
17278         return ret_conv;
17279 }
17280
17281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17282         if (!ptr_is_owned(_res)) return;
17283         void* _res_ptr = untag_ptr(_res);
17284         CHECK_ACCESS(_res_ptr);
17285         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
17286         FREE(untag_ptr(_res));
17287         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
17288 }
17289
17290 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
17291         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
17292         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
17293         return tag_ptr(ret_conv, true);
17294 }
17295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17296         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
17297         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
17298         return ret_conv;
17299 }
17300
17301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17302         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
17303         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
17304         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
17305         return tag_ptr(ret_conv, true);
17306 }
17307
17308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17309         LDKCVec_MessageSendEventZ _res_constr;
17310         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17311         if (_res_constr.datalen > 0)
17312                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
17313         else
17314                 _res_constr.data = NULL;
17315         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17316         for (size_t s = 0; s < _res_constr.datalen; s++) {
17317                 int64_t _res_conv_18 = _res_vals[s];
17318                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
17319                 CHECK_ACCESS(_res_conv_18_ptr);
17320                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
17321                 FREE(untag_ptr(_res_conv_18));
17322                 _res_constr.data[s] = _res_conv_18_conv;
17323         }
17324         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17325         CVec_MessageSendEventZ_free(_res_constr);
17326 }
17327
17328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17329         void* o_ptr = untag_ptr(o);
17330         CHECK_ACCESS(o_ptr);
17331         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
17332         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
17333         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
17334         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
17335         return tag_ptr(ret_conv, true);
17336 }
17337
17338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17339         LDKAccessError e_conv = LDKAccessError_from_java(env, e);
17340         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
17341         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
17342         return tag_ptr(ret_conv, true);
17343 }
17344
17345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17346         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
17347         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
17348         return ret_conv;
17349 }
17350
17351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17352         if (!ptr_is_owned(_res)) return;
17353         void* _res_ptr = untag_ptr(_res);
17354         CHECK_ACCESS(_res_ptr);
17355         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
17356         FREE(untag_ptr(_res));
17357         CResult_TxOutAccessErrorZ_free(_res_conv);
17358 }
17359
17360 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
17361         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
17362         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
17363         return tag_ptr(ret_conv, true);
17364 }
17365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17366         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
17367         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
17368         return ret_conv;
17369 }
17370
17371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17372         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
17373         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
17374         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
17375         return tag_ptr(ret_conv, true);
17376 }
17377
17378 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
17379         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17380         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
17381         return tag_ptr(ret_conv, true);
17382 }
17383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17384         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
17385         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
17386         return ret_conv;
17387 }
17388
17389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17390         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
17391         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17392         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
17393         return tag_ptr(ret_conv, true);
17394 }
17395
17396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
17397         LDKTransaction b_ref;
17398         b_ref.datalen = (*env)->GetArrayLength(env, b);
17399         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
17400         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
17401         b_ref.data_is_owned = true;
17402         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17403         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
17404         return tag_ptr(ret_conv, true);
17405 }
17406
17407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17408         if (!ptr_is_owned(_res)) return;
17409         void* _res_ptr = untag_ptr(_res);
17410         CHECK_ACCESS(_res_ptr);
17411         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
17412         FREE(untag_ptr(_res));
17413         C2Tuple_usizeTransactionZ_free(_res_conv);
17414 }
17415
17416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17417         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
17418         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17419         if (_res_constr.datalen > 0)
17420                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17421         else
17422                 _res_constr.data = NULL;
17423         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17424         for (size_t c = 0; c < _res_constr.datalen; c++) {
17425                 int64_t _res_conv_28 = _res_vals[c];
17426                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
17427                 CHECK_ACCESS(_res_conv_28_ptr);
17428                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
17429                 FREE(untag_ptr(_res_conv_28));
17430                 _res_constr.data[c] = _res_conv_28_conv;
17431         }
17432         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17433         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
17434 }
17435
17436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17437         LDKCVec_TxidZ _res_constr;
17438         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17439         if (_res_constr.datalen > 0)
17440                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
17441         else
17442                 _res_constr.data = NULL;
17443         for (size_t i = 0; i < _res_constr.datalen; i++) {
17444                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17445                 LDKThirtyTwoBytes _res_conv_8_ref;
17446                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
17447                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
17448                 _res_constr.data[i] = _res_conv_8_ref;
17449         }
17450         CVec_TxidZ_free(_res_constr);
17451 }
17452
17453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
17454         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17455         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
17456         return tag_ptr(ret_conv, true);
17457 }
17458
17459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
17460         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
17461         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17462         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
17463         return tag_ptr(ret_conv, true);
17464 }
17465
17466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17467         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
17468         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
17469         return ret_conv;
17470 }
17471
17472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17473         if (!ptr_is_owned(_res)) return;
17474         void* _res_ptr = untag_ptr(_res);
17475         CHECK_ACCESS(_res_ptr);
17476         LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
17477         FREE(untag_ptr(_res));
17478         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
17479 }
17480
17481 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
17482         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17483         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
17484         return tag_ptr(ret_conv, true);
17485 }
17486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17487         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
17488         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
17489         return ret_conv;
17490 }
17491
17492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17493         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
17494         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
17495         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
17496         return tag_ptr(ret_conv, true);
17497 }
17498
17499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17500         LDKCVec_MonitorEventZ _res_constr;
17501         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17502         if (_res_constr.datalen > 0)
17503                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17504         else
17505                 _res_constr.data = NULL;
17506         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17507         for (size_t o = 0; o < _res_constr.datalen; o++) {
17508                 int64_t _res_conv_14 = _res_vals[o];
17509                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
17510                 CHECK_ACCESS(_res_conv_14_ptr);
17511                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
17512                 FREE(untag_ptr(_res_conv_14));
17513                 _res_constr.data[o] = _res_conv_14_conv;
17514         }
17515         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17516         CVec_MonitorEventZ_free(_res_constr);
17517 }
17518
17519 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
17520         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17521         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
17522         return tag_ptr(ret_conv, true);
17523 }
17524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17525         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
17526         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
17527         return ret_conv;
17528 }
17529
17530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17531         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
17532         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17533         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
17534         return tag_ptr(ret_conv, true);
17535 }
17536
17537 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) {
17538         LDKOutPoint a_conv;
17539         a_conv.inner = untag_ptr(a);
17540         a_conv.is_owned = ptr_is_owned(a);
17541         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17542         a_conv = OutPoint_clone(&a_conv);
17543         LDKCVec_MonitorEventZ b_constr;
17544         b_constr.datalen = (*env)->GetArrayLength(env, b);
17545         if (b_constr.datalen > 0)
17546                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17547         else
17548                 b_constr.data = NULL;
17549         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
17550         for (size_t o = 0; o < b_constr.datalen; o++) {
17551                 int64_t b_conv_14 = b_vals[o];
17552                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
17553                 CHECK_ACCESS(b_conv_14_ptr);
17554                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
17555                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
17556                 b_constr.data[o] = b_conv_14_conv;
17557         }
17558         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
17559         LDKPublicKey c_ref;
17560         CHECK((*env)->GetArrayLength(env, c) == 33);
17561         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
17562         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17563         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
17564         return tag_ptr(ret_conv, true);
17565 }
17566
17567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17568         if (!ptr_is_owned(_res)) return;
17569         void* _res_ptr = untag_ptr(_res);
17570         CHECK_ACCESS(_res_ptr);
17571         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
17572         FREE(untag_ptr(_res));
17573         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
17574 }
17575
17576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17577         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
17578         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17579         if (_res_constr.datalen > 0)
17580                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
17581         else
17582                 _res_constr.data = NULL;
17583         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17584         for (size_t x = 0; x < _res_constr.datalen; x++) {
17585                 int64_t _res_conv_49 = _res_vals[x];
17586                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
17587                 CHECK_ACCESS(_res_conv_49_ptr);
17588                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
17589                 FREE(untag_ptr(_res_conv_49));
17590                 _res_constr.data[x] = _res_conv_49_conv;
17591         }
17592         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17593         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
17594 }
17595
17596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17597         LDKFixedPenaltyScorer o_conv;
17598         o_conv.inner = untag_ptr(o);
17599         o_conv.is_owned = ptr_is_owned(o);
17600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17601         o_conv = FixedPenaltyScorer_clone(&o_conv);
17602         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17603         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
17604         return tag_ptr(ret_conv, true);
17605 }
17606
17607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17608         LDKDecodeError e_conv;
17609         e_conv.inner = untag_ptr(e);
17610         e_conv.is_owned = ptr_is_owned(e);
17611         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17612         e_conv = DecodeError_clone(&e_conv);
17613         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17614         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
17615         return tag_ptr(ret_conv, true);
17616 }
17617
17618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17619         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
17620         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
17621         return ret_conv;
17622 }
17623
17624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17625         if (!ptr_is_owned(_res)) return;
17626         void* _res_ptr = untag_ptr(_res);
17627         CHECK_ACCESS(_res_ptr);
17628         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
17629         FREE(untag_ptr(_res));
17630         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
17631 }
17632
17633 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
17634         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17635         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
17636         return tag_ptr(ret_conv, true);
17637 }
17638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17639         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
17640         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
17641         return ret_conv;
17642 }
17643
17644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17645         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
17646         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17647         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
17648         return tag_ptr(ret_conv, true);
17649 }
17650
17651 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
17652         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17653         *ret_conv = C2Tuple_u64u64Z_clone(arg);
17654         return tag_ptr(ret_conv, true);
17655 }
17656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17657         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
17658         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
17659         return ret_conv;
17660 }
17661
17662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17663         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
17664         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17665         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
17666         return tag_ptr(ret_conv, true);
17667 }
17668
17669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17670         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17671         *ret_conv = C2Tuple_u64u64Z_new(a, b);
17672         return tag_ptr(ret_conv, true);
17673 }
17674
17675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17676         if (!ptr_is_owned(_res)) return;
17677         void* _res_ptr = untag_ptr(_res);
17678         CHECK_ACCESS(_res_ptr);
17679         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
17680         FREE(untag_ptr(_res));
17681         C2Tuple_u64u64Z_free(_res_conv);
17682 }
17683
17684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17685         void* o_ptr = untag_ptr(o);
17686         CHECK_ACCESS(o_ptr);
17687         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
17688         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
17689         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17690         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
17691         int64_t ret_ref = tag_ptr(ret_copy, true);
17692         return ret_ref;
17693 }
17694
17695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
17696         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17697         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
17698         int64_t ret_ref = tag_ptr(ret_copy, true);
17699         return ret_ref;
17700 }
17701
17702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17703         if (!ptr_is_owned(_res)) return;
17704         void* _res_ptr = untag_ptr(_res);
17705         CHECK_ACCESS(_res_ptr);
17706         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
17707         FREE(untag_ptr(_res));
17708         COption_C2Tuple_u64u64ZZ_free(_res_conv);
17709 }
17710
17711 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
17712         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17713         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
17714         int64_t ret_ref = tag_ptr(ret_copy, true);
17715         return ret_ref;
17716 }
17717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17718         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
17719         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
17720         return ret_conv;
17721 }
17722
17723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17724         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
17725         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17726         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
17727         int64_t ret_ref = tag_ptr(ret_copy, true);
17728         return ret_ref;
17729 }
17730
17731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17732         LDKCVec_NodeIdZ _res_constr;
17733         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17734         if (_res_constr.datalen > 0)
17735                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
17736         else
17737                 _res_constr.data = NULL;
17738         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17739         for (size_t i = 0; i < _res_constr.datalen; i++) {
17740                 int64_t _res_conv_8 = _res_vals[i];
17741                 LDKNodeId _res_conv_8_conv;
17742                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
17743                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
17744                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
17745                 _res_constr.data[i] = _res_conv_8_conv;
17746         }
17747         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17748         CVec_NodeIdZ_free(_res_constr);
17749 }
17750
17751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17752         LDKProbabilisticScorer o_conv;
17753         o_conv.inner = untag_ptr(o);
17754         o_conv.is_owned = ptr_is_owned(o);
17755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17756         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
17757         
17758         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
17759         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
17760         return tag_ptr(ret_conv, true);
17761 }
17762
17763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17764         LDKDecodeError e_conv;
17765         e_conv.inner = untag_ptr(e);
17766         e_conv.is_owned = ptr_is_owned(e);
17767         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17768         e_conv = DecodeError_clone(&e_conv);
17769         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
17770         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
17771         return tag_ptr(ret_conv, true);
17772 }
17773
17774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17775         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
17776         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
17777         return ret_conv;
17778 }
17779
17780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17781         if (!ptr_is_owned(_res)) return;
17782         void* _res_ptr = untag_ptr(_res);
17783         CHECK_ACCESS(_res_ptr);
17784         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
17785         FREE(untag_ptr(_res));
17786         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
17787 }
17788
17789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17790         LDKInitFeatures o_conv;
17791         o_conv.inner = untag_ptr(o);
17792         o_conv.is_owned = ptr_is_owned(o);
17793         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17794         o_conv = InitFeatures_clone(&o_conv);
17795         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17796         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
17797         return tag_ptr(ret_conv, true);
17798 }
17799
17800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17801         LDKDecodeError e_conv;
17802         e_conv.inner = untag_ptr(e);
17803         e_conv.is_owned = ptr_is_owned(e);
17804         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17805         e_conv = DecodeError_clone(&e_conv);
17806         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17807         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
17808         return tag_ptr(ret_conv, true);
17809 }
17810
17811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17812         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
17813         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
17814         return ret_conv;
17815 }
17816
17817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17818         if (!ptr_is_owned(_res)) return;
17819         void* _res_ptr = untag_ptr(_res);
17820         CHECK_ACCESS(_res_ptr);
17821         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
17822         FREE(untag_ptr(_res));
17823         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
17824 }
17825
17826 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17827         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17828         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
17829         return tag_ptr(ret_conv, true);
17830 }
17831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17832         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
17833         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17834         return ret_conv;
17835 }
17836
17837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17838         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
17839         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17840         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
17841         return tag_ptr(ret_conv, true);
17842 }
17843
17844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17845         LDKChannelFeatures o_conv;
17846         o_conv.inner = untag_ptr(o);
17847         o_conv.is_owned = ptr_is_owned(o);
17848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17849         o_conv = ChannelFeatures_clone(&o_conv);
17850         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17851         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
17852         return tag_ptr(ret_conv, true);
17853 }
17854
17855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17856         LDKDecodeError e_conv;
17857         e_conv.inner = untag_ptr(e);
17858         e_conv.is_owned = ptr_is_owned(e);
17859         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17860         e_conv = DecodeError_clone(&e_conv);
17861         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17862         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
17863         return tag_ptr(ret_conv, true);
17864 }
17865
17866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17867         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
17868         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
17869         return ret_conv;
17870 }
17871
17872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17873         if (!ptr_is_owned(_res)) return;
17874         void* _res_ptr = untag_ptr(_res);
17875         CHECK_ACCESS(_res_ptr);
17876         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
17877         FREE(untag_ptr(_res));
17878         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
17879 }
17880
17881 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17882         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17883         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
17884         return tag_ptr(ret_conv, true);
17885 }
17886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17887         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
17888         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17889         return ret_conv;
17890 }
17891
17892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17893         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
17894         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
17895         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
17896         return tag_ptr(ret_conv, true);
17897 }
17898
17899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17900         LDKNodeFeatures o_conv;
17901         o_conv.inner = untag_ptr(o);
17902         o_conv.is_owned = ptr_is_owned(o);
17903         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17904         o_conv = NodeFeatures_clone(&o_conv);
17905         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17906         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
17907         return tag_ptr(ret_conv, true);
17908 }
17909
17910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17911         LDKDecodeError e_conv;
17912         e_conv.inner = untag_ptr(e);
17913         e_conv.is_owned = ptr_is_owned(e);
17914         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17915         e_conv = DecodeError_clone(&e_conv);
17916         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17917         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
17918         return tag_ptr(ret_conv, true);
17919 }
17920
17921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17922         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
17923         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
17924         return ret_conv;
17925 }
17926
17927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17928         if (!ptr_is_owned(_res)) return;
17929         void* _res_ptr = untag_ptr(_res);
17930         CHECK_ACCESS(_res_ptr);
17931         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
17932         FREE(untag_ptr(_res));
17933         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
17934 }
17935
17936 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17937         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17938         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
17939         return tag_ptr(ret_conv, true);
17940 }
17941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17942         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
17943         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17944         return ret_conv;
17945 }
17946
17947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17948         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
17949         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
17950         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
17951         return tag_ptr(ret_conv, true);
17952 }
17953
17954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17955         LDKInvoiceFeatures o_conv;
17956         o_conv.inner = untag_ptr(o);
17957         o_conv.is_owned = ptr_is_owned(o);
17958         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17959         o_conv = InvoiceFeatures_clone(&o_conv);
17960         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17961         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
17962         return tag_ptr(ret_conv, true);
17963 }
17964
17965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17966         LDKDecodeError e_conv;
17967         e_conv.inner = untag_ptr(e);
17968         e_conv.is_owned = ptr_is_owned(e);
17969         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17970         e_conv = DecodeError_clone(&e_conv);
17971         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17972         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
17973         return tag_ptr(ret_conv, true);
17974 }
17975
17976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17977         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
17978         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
17979         return ret_conv;
17980 }
17981
17982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17983         if (!ptr_is_owned(_res)) return;
17984         void* _res_ptr = untag_ptr(_res);
17985         CHECK_ACCESS(_res_ptr);
17986         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
17987         FREE(untag_ptr(_res));
17988         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
17989 }
17990
17991 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
17992         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
17993         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
17994         return tag_ptr(ret_conv, true);
17995 }
17996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17997         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
17998         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
17999         return ret_conv;
18000 }
18001
18002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18003         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18004         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18005         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18006         return tag_ptr(ret_conv, true);
18007 }
18008
18009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18010         LDKChannelTypeFeatures o_conv;
18011         o_conv.inner = untag_ptr(o);
18012         o_conv.is_owned = ptr_is_owned(o);
18013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18014         o_conv = ChannelTypeFeatures_clone(&o_conv);
18015         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18016         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
18017         return tag_ptr(ret_conv, true);
18018 }
18019
18020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18021         LDKDecodeError e_conv;
18022         e_conv.inner = untag_ptr(e);
18023         e_conv.is_owned = ptr_is_owned(e);
18024         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18025         e_conv = DecodeError_clone(&e_conv);
18026         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18027         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
18028         return tag_ptr(ret_conv, true);
18029 }
18030
18031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18032         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
18033         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
18034         return ret_conv;
18035 }
18036
18037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18038         if (!ptr_is_owned(_res)) return;
18039         void* _res_ptr = untag_ptr(_res);
18040         CHECK_ACCESS(_res_ptr);
18041         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
18042         FREE(untag_ptr(_res));
18043         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
18044 }
18045
18046 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18047         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18048         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
18049         return tag_ptr(ret_conv, true);
18050 }
18051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18052         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
18053         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18054         return ret_conv;
18055 }
18056
18057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18058         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
18059         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18060         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
18061         return tag_ptr(ret_conv, true);
18062 }
18063
18064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18065         LDKNodeId o_conv;
18066         o_conv.inner = untag_ptr(o);
18067         o_conv.is_owned = ptr_is_owned(o);
18068         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18069         o_conv = NodeId_clone(&o_conv);
18070         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18071         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
18072         return tag_ptr(ret_conv, true);
18073 }
18074
18075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18076         LDKDecodeError e_conv;
18077         e_conv.inner = untag_ptr(e);
18078         e_conv.is_owned = ptr_is_owned(e);
18079         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18080         e_conv = DecodeError_clone(&e_conv);
18081         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18082         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
18083         return tag_ptr(ret_conv, true);
18084 }
18085
18086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18087         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
18088         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
18089         return ret_conv;
18090 }
18091
18092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18093         if (!ptr_is_owned(_res)) return;
18094         void* _res_ptr = untag_ptr(_res);
18095         CHECK_ACCESS(_res_ptr);
18096         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
18097         FREE(untag_ptr(_res));
18098         CResult_NodeIdDecodeErrorZ_free(_res_conv);
18099 }
18100
18101 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
18102         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18103         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
18104         return tag_ptr(ret_conv, true);
18105 }
18106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18107         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
18108         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
18109         return ret_conv;
18110 }
18111
18112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18113         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
18114         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18115         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
18116         return tag_ptr(ret_conv, true);
18117 }
18118
18119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18120         void* o_ptr = untag_ptr(o);
18121         CHECK_ACCESS(o_ptr);
18122         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
18123         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
18124         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18125         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
18126         return tag_ptr(ret_conv, true);
18127 }
18128
18129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18130         LDKDecodeError e_conv;
18131         e_conv.inner = untag_ptr(e);
18132         e_conv.is_owned = ptr_is_owned(e);
18133         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18134         e_conv = DecodeError_clone(&e_conv);
18135         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18136         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
18137         return tag_ptr(ret_conv, true);
18138 }
18139
18140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18141         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
18142         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
18143         return ret_conv;
18144 }
18145
18146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18147         if (!ptr_is_owned(_res)) return;
18148         void* _res_ptr = untag_ptr(_res);
18149         CHECK_ACCESS(_res_ptr);
18150         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
18151         FREE(untag_ptr(_res));
18152         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
18153 }
18154
18155 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
18156         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18157         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
18158         return tag_ptr(ret_conv, true);
18159 }
18160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18161         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
18162         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
18163         return ret_conv;
18164 }
18165
18166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18167         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
18168         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18169         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
18170         return tag_ptr(ret_conv, true);
18171 }
18172
18173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18174         void* o_ptr = untag_ptr(o);
18175         CHECK_ACCESS(o_ptr);
18176         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
18177         if (o_conv.free == LDKAccess_JCalls_free) {
18178                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18179                 LDKAccess_JCalls_cloned(&o_conv);
18180         }
18181         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
18182         *ret_copy = COption_AccessZ_some(o_conv);
18183         int64_t ret_ref = tag_ptr(ret_copy, true);
18184         return ret_ref;
18185 }
18186
18187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
18188         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
18189         *ret_copy = COption_AccessZ_none();
18190         int64_t ret_ref = tag_ptr(ret_copy, true);
18191         return ret_ref;
18192 }
18193
18194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18195         if (!ptr_is_owned(_res)) return;
18196         void* _res_ptr = untag_ptr(_res);
18197         CHECK_ACCESS(_res_ptr);
18198         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
18199         FREE(untag_ptr(_res));
18200         COption_AccessZ_free(_res_conv);
18201 }
18202
18203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
18204         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18205         *ret_conv = CResult_boolLightningErrorZ_ok(o);
18206         return tag_ptr(ret_conv, true);
18207 }
18208
18209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18210         LDKLightningError e_conv;
18211         e_conv.inner = untag_ptr(e);
18212         e_conv.is_owned = ptr_is_owned(e);
18213         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18214         e_conv = LightningError_clone(&e_conv);
18215         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18216         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
18217         return tag_ptr(ret_conv, true);
18218 }
18219
18220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18221         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
18222         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
18223         return ret_conv;
18224 }
18225
18226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18227         if (!ptr_is_owned(_res)) return;
18228         void* _res_ptr = untag_ptr(_res);
18229         CHECK_ACCESS(_res_ptr);
18230         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
18231         FREE(untag_ptr(_res));
18232         CResult_boolLightningErrorZ_free(_res_conv);
18233 }
18234
18235 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
18236         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18237         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
18238         return tag_ptr(ret_conv, true);
18239 }
18240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18241         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
18242         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
18243         return ret_conv;
18244 }
18245
18246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18247         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
18248         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18249         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
18250         return tag_ptr(ret_conv, true);
18251 }
18252
18253 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
18254         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
18255         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
18256         return tag_ptr(ret_conv, true);
18257 }
18258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18259         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
18260         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
18261         return ret_conv;
18262 }
18263
18264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18265         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
18266         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
18267         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
18268         return tag_ptr(ret_conv, true);
18269 }
18270
18271 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) {
18272         LDKChannelAnnouncement a_conv;
18273         a_conv.inner = untag_ptr(a);
18274         a_conv.is_owned = ptr_is_owned(a);
18275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18276         a_conv = ChannelAnnouncement_clone(&a_conv);
18277         LDKChannelUpdate b_conv;
18278         b_conv.inner = untag_ptr(b);
18279         b_conv.is_owned = ptr_is_owned(b);
18280         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18281         b_conv = ChannelUpdate_clone(&b_conv);
18282         LDKChannelUpdate c_conv;
18283         c_conv.inner = untag_ptr(c);
18284         c_conv.is_owned = ptr_is_owned(c);
18285         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
18286         c_conv = ChannelUpdate_clone(&c_conv);
18287         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
18288         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
18289         return tag_ptr(ret_conv, true);
18290 }
18291
18292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18293         if (!ptr_is_owned(_res)) return;
18294         void* _res_ptr = untag_ptr(_res);
18295         CHECK_ACCESS(_res_ptr);
18296         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
18297         FREE(untag_ptr(_res));
18298         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
18299 }
18300
18301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18302         void* o_ptr = untag_ptr(o);
18303         CHECK_ACCESS(o_ptr);
18304         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
18305         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
18306         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18307         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
18308         int64_t ret_ref = tag_ptr(ret_copy, true);
18309         return ret_ref;
18310 }
18311
18312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
18313         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18314         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
18315         int64_t ret_ref = tag_ptr(ret_copy, true);
18316         return ret_ref;
18317 }
18318
18319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18320         if (!ptr_is_owned(_res)) return;
18321         void* _res_ptr = untag_ptr(_res);
18322         CHECK_ACCESS(_res_ptr);
18323         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
18324         FREE(untag_ptr(_res));
18325         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
18326 }
18327
18328 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
18329         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18330         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
18331         int64_t ret_ref = tag_ptr(ret_copy, true);
18332         return ret_ref;
18333 }
18334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18335         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
18336         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
18337         return ret_conv;
18338 }
18339
18340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18341         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
18342         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
18343         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
18344         int64_t ret_ref = tag_ptr(ret_copy, true);
18345         return ret_ref;
18346 }
18347
18348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
18349         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18350         *ret_conv = CResult_NoneLightningErrorZ_ok();
18351         return tag_ptr(ret_conv, true);
18352 }
18353
18354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18355         LDKLightningError e_conv;
18356         e_conv.inner = untag_ptr(e);
18357         e_conv.is_owned = ptr_is_owned(e);
18358         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18359         e_conv = LightningError_clone(&e_conv);
18360         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18361         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
18362         return tag_ptr(ret_conv, true);
18363 }
18364
18365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18366         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
18367         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
18368         return ret_conv;
18369 }
18370
18371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18372         if (!ptr_is_owned(_res)) return;
18373         void* _res_ptr = untag_ptr(_res);
18374         CHECK_ACCESS(_res_ptr);
18375         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
18376         FREE(untag_ptr(_res));
18377         CResult_NoneLightningErrorZ_free(_res_conv);
18378 }
18379
18380 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
18381         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18382         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
18383         return tag_ptr(ret_conv, true);
18384 }
18385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18386         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
18387         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
18388         return ret_conv;
18389 }
18390
18391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18392         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
18393         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18394         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
18395         return tag_ptr(ret_conv, true);
18396 }
18397
18398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18399         LDKChannelUpdateInfo o_conv;
18400         o_conv.inner = untag_ptr(o);
18401         o_conv.is_owned = ptr_is_owned(o);
18402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18403         o_conv = ChannelUpdateInfo_clone(&o_conv);
18404         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18405         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
18406         return tag_ptr(ret_conv, true);
18407 }
18408
18409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18410         LDKDecodeError e_conv;
18411         e_conv.inner = untag_ptr(e);
18412         e_conv.is_owned = ptr_is_owned(e);
18413         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18414         e_conv = DecodeError_clone(&e_conv);
18415         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18416         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
18417         return tag_ptr(ret_conv, true);
18418 }
18419
18420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18421         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
18422         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
18423         return ret_conv;
18424 }
18425
18426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18427         if (!ptr_is_owned(_res)) return;
18428         void* _res_ptr = untag_ptr(_res);
18429         CHECK_ACCESS(_res_ptr);
18430         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
18431         FREE(untag_ptr(_res));
18432         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
18433 }
18434
18435 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
18436         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18437         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
18438         return tag_ptr(ret_conv, true);
18439 }
18440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18441         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
18442         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
18443         return ret_conv;
18444 }
18445
18446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18447         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
18448         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
18449         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
18450         return tag_ptr(ret_conv, true);
18451 }
18452
18453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18454         LDKChannelInfo o_conv;
18455         o_conv.inner = untag_ptr(o);
18456         o_conv.is_owned = ptr_is_owned(o);
18457         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18458         o_conv = ChannelInfo_clone(&o_conv);
18459         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18460         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
18461         return tag_ptr(ret_conv, true);
18462 }
18463
18464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18465         LDKDecodeError e_conv;
18466         e_conv.inner = untag_ptr(e);
18467         e_conv.is_owned = ptr_is_owned(e);
18468         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18469         e_conv = DecodeError_clone(&e_conv);
18470         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18471         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
18472         return tag_ptr(ret_conv, true);
18473 }
18474
18475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18476         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
18477         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
18478         return ret_conv;
18479 }
18480
18481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18482         if (!ptr_is_owned(_res)) return;
18483         void* _res_ptr = untag_ptr(_res);
18484         CHECK_ACCESS(_res_ptr);
18485         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
18486         FREE(untag_ptr(_res));
18487         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
18488 }
18489
18490 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
18491         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18492         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
18493         return tag_ptr(ret_conv, true);
18494 }
18495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18496         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
18497         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
18498         return ret_conv;
18499 }
18500
18501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18502         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
18503         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
18504         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
18505         return tag_ptr(ret_conv, true);
18506 }
18507
18508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18509         LDKRoutingFees o_conv;
18510         o_conv.inner = untag_ptr(o);
18511         o_conv.is_owned = ptr_is_owned(o);
18512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18513         o_conv = RoutingFees_clone(&o_conv);
18514         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18515         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
18516         return tag_ptr(ret_conv, true);
18517 }
18518
18519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18520         LDKDecodeError e_conv;
18521         e_conv.inner = untag_ptr(e);
18522         e_conv.is_owned = ptr_is_owned(e);
18523         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18524         e_conv = DecodeError_clone(&e_conv);
18525         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18526         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
18527         return tag_ptr(ret_conv, true);
18528 }
18529
18530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18531         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
18532         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
18533         return ret_conv;
18534 }
18535
18536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18537         if (!ptr_is_owned(_res)) return;
18538         void* _res_ptr = untag_ptr(_res);
18539         CHECK_ACCESS(_res_ptr);
18540         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
18541         FREE(untag_ptr(_res));
18542         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
18543 }
18544
18545 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
18546         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18547         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
18548         return tag_ptr(ret_conv, true);
18549 }
18550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18551         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
18552         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
18553         return ret_conv;
18554 }
18555
18556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18557         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
18558         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
18559         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
18560         return tag_ptr(ret_conv, true);
18561 }
18562
18563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18564         LDKCVec_NetAddressZ _res_constr;
18565         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18566         if (_res_constr.datalen > 0)
18567                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18568         else
18569                 _res_constr.data = NULL;
18570         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18571         for (size_t m = 0; m < _res_constr.datalen; m++) {
18572                 int64_t _res_conv_12 = _res_vals[m];
18573                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
18574                 CHECK_ACCESS(_res_conv_12_ptr);
18575                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
18576                 FREE(untag_ptr(_res_conv_12));
18577                 _res_constr.data[m] = _res_conv_12_conv;
18578         }
18579         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18580         CVec_NetAddressZ_free(_res_constr);
18581 }
18582
18583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18584         LDKNodeAnnouncementInfo o_conv;
18585         o_conv.inner = untag_ptr(o);
18586         o_conv.is_owned = ptr_is_owned(o);
18587         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18588         o_conv = NodeAnnouncementInfo_clone(&o_conv);
18589         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18590         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
18591         return tag_ptr(ret_conv, true);
18592 }
18593
18594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18595         LDKDecodeError e_conv;
18596         e_conv.inner = untag_ptr(e);
18597         e_conv.is_owned = ptr_is_owned(e);
18598         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18599         e_conv = DecodeError_clone(&e_conv);
18600         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18601         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
18602         return tag_ptr(ret_conv, true);
18603 }
18604
18605 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18606         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
18607         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
18608         return ret_conv;
18609 }
18610
18611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18612         if (!ptr_is_owned(_res)) return;
18613         void* _res_ptr = untag_ptr(_res);
18614         CHECK_ACCESS(_res_ptr);
18615         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
18616         FREE(untag_ptr(_res));
18617         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
18618 }
18619
18620 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
18621         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18622         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
18623         return tag_ptr(ret_conv, true);
18624 }
18625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18626         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
18627         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
18628         return ret_conv;
18629 }
18630
18631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18632         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
18633         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
18634         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
18635         return tag_ptr(ret_conv, true);
18636 }
18637
18638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18639         LDKNodeAlias o_conv;
18640         o_conv.inner = untag_ptr(o);
18641         o_conv.is_owned = ptr_is_owned(o);
18642         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18643         o_conv = NodeAlias_clone(&o_conv);
18644         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18645         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
18646         return tag_ptr(ret_conv, true);
18647 }
18648
18649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18650         LDKDecodeError e_conv;
18651         e_conv.inner = untag_ptr(e);
18652         e_conv.is_owned = ptr_is_owned(e);
18653         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18654         e_conv = DecodeError_clone(&e_conv);
18655         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18656         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
18657         return tag_ptr(ret_conv, true);
18658 }
18659
18660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18661         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
18662         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
18663         return ret_conv;
18664 }
18665
18666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18667         if (!ptr_is_owned(_res)) return;
18668         void* _res_ptr = untag_ptr(_res);
18669         CHECK_ACCESS(_res_ptr);
18670         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
18671         FREE(untag_ptr(_res));
18672         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
18673 }
18674
18675 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
18676         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18677         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
18678         return tag_ptr(ret_conv, true);
18679 }
18680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18681         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
18682         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
18683         return ret_conv;
18684 }
18685
18686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18687         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
18688         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
18689         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
18690         return tag_ptr(ret_conv, true);
18691 }
18692
18693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18694         LDKNodeInfo o_conv;
18695         o_conv.inner = untag_ptr(o);
18696         o_conv.is_owned = ptr_is_owned(o);
18697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18698         o_conv = NodeInfo_clone(&o_conv);
18699         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18700         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
18701         return tag_ptr(ret_conv, true);
18702 }
18703
18704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18705         LDKDecodeError e_conv;
18706         e_conv.inner = untag_ptr(e);
18707         e_conv.is_owned = ptr_is_owned(e);
18708         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18709         e_conv = DecodeError_clone(&e_conv);
18710         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18711         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
18712         return tag_ptr(ret_conv, true);
18713 }
18714
18715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18716         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
18717         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
18718         return ret_conv;
18719 }
18720
18721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18722         if (!ptr_is_owned(_res)) return;
18723         void* _res_ptr = untag_ptr(_res);
18724         CHECK_ACCESS(_res_ptr);
18725         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
18726         FREE(untag_ptr(_res));
18727         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
18728 }
18729
18730 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
18731         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18732         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
18733         return tag_ptr(ret_conv, true);
18734 }
18735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18736         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
18737         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
18738         return ret_conv;
18739 }
18740
18741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18742         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
18743         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
18744         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
18745         return tag_ptr(ret_conv, true);
18746 }
18747
18748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18749         LDKNetworkGraph o_conv;
18750         o_conv.inner = untag_ptr(o);
18751         o_conv.is_owned = ptr_is_owned(o);
18752         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18753         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
18754         
18755         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18756         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
18757         return tag_ptr(ret_conv, true);
18758 }
18759
18760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18761         LDKDecodeError e_conv;
18762         e_conv.inner = untag_ptr(e);
18763         e_conv.is_owned = ptr_is_owned(e);
18764         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18765         e_conv = DecodeError_clone(&e_conv);
18766         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
18767         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
18768         return tag_ptr(ret_conv, true);
18769 }
18770
18771 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18772         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
18773         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
18774         return ret_conv;
18775 }
18776
18777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18778         if (!ptr_is_owned(_res)) return;
18779         void* _res_ptr = untag_ptr(_res);
18780         CHECK_ACCESS(_res_ptr);
18781         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
18782         FREE(untag_ptr(_res));
18783         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
18784 }
18785
18786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
18787         LDKCVec_NetAddressZ o_constr;
18788         o_constr.datalen = (*env)->GetArrayLength(env, o);
18789         if (o_constr.datalen > 0)
18790                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18791         else
18792                 o_constr.data = NULL;
18793         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18794         for (size_t m = 0; m < o_constr.datalen; m++) {
18795                 int64_t o_conv_12 = o_vals[m];
18796                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
18797                 CHECK_ACCESS(o_conv_12_ptr);
18798                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
18799                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
18800                 o_constr.data[m] = o_conv_12_conv;
18801         }
18802         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18803         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18804         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
18805         int64_t ret_ref = tag_ptr(ret_copy, true);
18806         return ret_ref;
18807 }
18808
18809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
18810         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18811         *ret_copy = COption_CVec_NetAddressZZ_none();
18812         int64_t ret_ref = tag_ptr(ret_copy, true);
18813         return ret_ref;
18814 }
18815
18816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18817         if (!ptr_is_owned(_res)) return;
18818         void* _res_ptr = untag_ptr(_res);
18819         CHECK_ACCESS(_res_ptr);
18820         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
18821         FREE(untag_ptr(_res));
18822         COption_CVec_NetAddressZZ_free(_res_conv);
18823 }
18824
18825 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
18826         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18827         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
18828         int64_t ret_ref = tag_ptr(ret_copy, true);
18829         return ret_ref;
18830 }
18831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18832         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
18833         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
18834         return ret_conv;
18835 }
18836
18837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18838         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
18839         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
18840         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
18841         int64_t ret_ref = tag_ptr(ret_copy, true);
18842         return ret_ref;
18843 }
18844
18845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18846         LDKDelayedPaymentOutputDescriptor o_conv;
18847         o_conv.inner = untag_ptr(o);
18848         o_conv.is_owned = ptr_is_owned(o);
18849         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18850         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
18851         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18852         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18853         return tag_ptr(ret_conv, true);
18854 }
18855
18856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18857         LDKDecodeError e_conv;
18858         e_conv.inner = untag_ptr(e);
18859         e_conv.is_owned = ptr_is_owned(e);
18860         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18861         e_conv = DecodeError_clone(&e_conv);
18862         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18863         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18864         return tag_ptr(ret_conv, true);
18865 }
18866
18867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18868         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
18869         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18870         return ret_conv;
18871 }
18872
18873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18874         if (!ptr_is_owned(_res)) return;
18875         void* _res_ptr = untag_ptr(_res);
18876         CHECK_ACCESS(_res_ptr);
18877         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18878         FREE(untag_ptr(_res));
18879         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18880 }
18881
18882 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18883         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18884         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18885         return tag_ptr(ret_conv, true);
18886 }
18887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18888         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
18889         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18890         return ret_conv;
18891 }
18892
18893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18894         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
18895         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
18896         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18897         return tag_ptr(ret_conv, true);
18898 }
18899
18900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18901         LDKStaticPaymentOutputDescriptor o_conv;
18902         o_conv.inner = untag_ptr(o);
18903         o_conv.is_owned = ptr_is_owned(o);
18904         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18905         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
18906         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18907         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
18908         return tag_ptr(ret_conv, true);
18909 }
18910
18911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18912         LDKDecodeError e_conv;
18913         e_conv.inner = untag_ptr(e);
18914         e_conv.is_owned = ptr_is_owned(e);
18915         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18916         e_conv = DecodeError_clone(&e_conv);
18917         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18918         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
18919         return tag_ptr(ret_conv, true);
18920 }
18921
18922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18923         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
18924         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18925         return ret_conv;
18926 }
18927
18928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18929         if (!ptr_is_owned(_res)) return;
18930         void* _res_ptr = untag_ptr(_res);
18931         CHECK_ACCESS(_res_ptr);
18932         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
18933         FREE(untag_ptr(_res));
18934         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
18935 }
18936
18937 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18938         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18939         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
18940         return tag_ptr(ret_conv, true);
18941 }
18942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18943         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
18944         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18945         return ret_conv;
18946 }
18947
18948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18949         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
18950         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
18951         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
18952         return tag_ptr(ret_conv, true);
18953 }
18954
18955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18956         void* o_ptr = untag_ptr(o);
18957         CHECK_ACCESS(o_ptr);
18958         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
18959         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
18960         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18961         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
18962         return tag_ptr(ret_conv, true);
18963 }
18964
18965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18966         LDKDecodeError e_conv;
18967         e_conv.inner = untag_ptr(e);
18968         e_conv.is_owned = ptr_is_owned(e);
18969         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18970         e_conv = DecodeError_clone(&e_conv);
18971         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18972         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
18973         return tag_ptr(ret_conv, true);
18974 }
18975
18976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18977         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
18978         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
18979         return ret_conv;
18980 }
18981
18982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18983         if (!ptr_is_owned(_res)) return;
18984         void* _res_ptr = untag_ptr(_res);
18985         CHECK_ACCESS(_res_ptr);
18986         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
18987         FREE(untag_ptr(_res));
18988         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
18989 }
18990
18991 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
18992         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
18993         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
18994         return tag_ptr(ret_conv, true);
18995 }
18996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18997         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
18998         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
18999         return ret_conv;
19000 }
19001
19002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19003         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19004         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19005         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19006         return tag_ptr(ret_conv, true);
19007 }
19008
19009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19010         LDKCVec_PaymentPreimageZ _res_constr;
19011         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19012         if (_res_constr.datalen > 0)
19013                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
19014         else
19015                 _res_constr.data = NULL;
19016         for (size_t i = 0; i < _res_constr.datalen; i++) {
19017                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19018                 LDKThirtyTwoBytes _res_conv_8_ref;
19019                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
19020                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
19021                 _res_constr.data[i] = _res_conv_8_ref;
19022         }
19023         CVec_PaymentPreimageZ_free(_res_constr);
19024 }
19025
19026 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
19027         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
19028         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
19029         return tag_ptr(ret_conv, true);
19030 }
19031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19032         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
19033         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
19034         return ret_conv;
19035 }
19036
19037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19038         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
19039         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
19040         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
19041         return tag_ptr(ret_conv, true);
19042 }
19043
19044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
19045         LDKSignature a_ref;
19046         CHECK((*env)->GetArrayLength(env, a) == 64);
19047         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
19048         LDKCVec_SignatureZ b_constr;
19049         b_constr.datalen = (*env)->GetArrayLength(env, b);
19050         if (b_constr.datalen > 0)
19051                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19052         else
19053                 b_constr.data = NULL;
19054         for (size_t i = 0; i < b_constr.datalen; i++) {
19055                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
19056                 LDKSignature b_conv_8_ref;
19057                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
19058                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
19059                 b_constr.data[i] = b_conv_8_ref;
19060         }
19061         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
19062         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
19063         return tag_ptr(ret_conv, true);
19064 }
19065
19066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19067         if (!ptr_is_owned(_res)) return;
19068         void* _res_ptr = untag_ptr(_res);
19069         CHECK_ACCESS(_res_ptr);
19070         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
19071         FREE(untag_ptr(_res));
19072         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
19073 }
19074
19075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19076         void* o_ptr = untag_ptr(o);
19077         CHECK_ACCESS(o_ptr);
19078         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
19079         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
19080         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
19081         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
19082         return tag_ptr(ret_conv, true);
19083 }
19084
19085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
19086         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
19087         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
19088         return tag_ptr(ret_conv, true);
19089 }
19090
19091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19092         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
19093         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
19094         return ret_conv;
19095 }
19096
19097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19098         if (!ptr_is_owned(_res)) return;
19099         void* _res_ptr = untag_ptr(_res);
19100         CHECK_ACCESS(_res_ptr);
19101         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
19102         FREE(untag_ptr(_res));
19103         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
19104 }
19105
19106 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
19107         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
19108         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
19109         return tag_ptr(ret_conv, true);
19110 }
19111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19112         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
19113         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
19114         return ret_conv;
19115 }
19116
19117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19118         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
19119         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
19120         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
19121         return tag_ptr(ret_conv, true);
19122 }
19123
19124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19125         LDKSignature o_ref;
19126         CHECK((*env)->GetArrayLength(env, o) == 64);
19127         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
19128         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
19129         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
19130         return tag_ptr(ret_conv, true);
19131 }
19132
19133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
19134         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
19135         *ret_conv = CResult_SignatureNoneZ_err();
19136         return tag_ptr(ret_conv, true);
19137 }
19138
19139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19140         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
19141         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
19142         return ret_conv;
19143 }
19144
19145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19146         if (!ptr_is_owned(_res)) return;
19147         void* _res_ptr = untag_ptr(_res);
19148         CHECK_ACCESS(_res_ptr);
19149         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
19150         FREE(untag_ptr(_res));
19151         CResult_SignatureNoneZ_free(_res_conv);
19152 }
19153
19154 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
19155         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
19156         *ret_conv = CResult_SignatureNoneZ_clone(arg);
19157         return tag_ptr(ret_conv, true);
19158 }
19159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19160         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
19161         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
19162         return ret_conv;
19163 }
19164
19165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19166         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
19167         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
19168         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
19169         return tag_ptr(ret_conv, true);
19170 }
19171
19172 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
19173         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
19174         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
19175         return tag_ptr(ret_conv, true);
19176 }
19177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19178         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
19179         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
19180         return ret_conv;
19181 }
19182
19183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19184         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
19185         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
19186         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
19187         return tag_ptr(ret_conv, true);
19188 }
19189
19190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
19191         LDKSignature a_ref;
19192         CHECK((*env)->GetArrayLength(env, a) == 64);
19193         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
19194         LDKSignature b_ref;
19195         CHECK((*env)->GetArrayLength(env, b) == 64);
19196         (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
19197         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
19198         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
19199         return tag_ptr(ret_conv, true);
19200 }
19201
19202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19203         if (!ptr_is_owned(_res)) return;
19204         void* _res_ptr = untag_ptr(_res);
19205         CHECK_ACCESS(_res_ptr);
19206         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
19207         FREE(untag_ptr(_res));
19208         C2Tuple_SignatureSignatureZ_free(_res_conv);
19209 }
19210
19211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19212         void* o_ptr = untag_ptr(o);
19213         CHECK_ACCESS(o_ptr);
19214         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
19215         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
19216         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
19217         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
19218         return tag_ptr(ret_conv, true);
19219 }
19220
19221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
19222         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
19223         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
19224         return tag_ptr(ret_conv, true);
19225 }
19226
19227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19228         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
19229         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
19230         return ret_conv;
19231 }
19232
19233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19234         if (!ptr_is_owned(_res)) return;
19235         void* _res_ptr = untag_ptr(_res);
19236         CHECK_ACCESS(_res_ptr);
19237         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
19238         FREE(untag_ptr(_res));
19239         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
19240 }
19241
19242 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
19243         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
19244         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
19245         return tag_ptr(ret_conv, true);
19246 }
19247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19248         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
19249         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
19250         return ret_conv;
19251 }
19252
19253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19254         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
19255         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
19256         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
19257         return tag_ptr(ret_conv, true);
19258 }
19259
19260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19261         LDKSecretKey o_ref;
19262         CHECK((*env)->GetArrayLength(env, o) == 32);
19263         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
19264         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
19265         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
19266         return tag_ptr(ret_conv, true);
19267 }
19268
19269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
19270         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
19271         *ret_conv = CResult_SecretKeyNoneZ_err();
19272         return tag_ptr(ret_conv, true);
19273 }
19274
19275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19276         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
19277         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
19278         return ret_conv;
19279 }
19280
19281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19282         if (!ptr_is_owned(_res)) return;
19283         void* _res_ptr = untag_ptr(_res);
19284         CHECK_ACCESS(_res_ptr);
19285         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
19286         FREE(untag_ptr(_res));
19287         CResult_SecretKeyNoneZ_free(_res_conv);
19288 }
19289
19290 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
19291         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
19292         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
19293         return tag_ptr(ret_conv, true);
19294 }
19295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19296         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
19297         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
19298         return ret_conv;
19299 }
19300
19301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19302         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
19303         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
19304         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
19305         return tag_ptr(ret_conv, true);
19306 }
19307
19308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19309         void* o_ptr = untag_ptr(o);
19310         CHECK_ACCESS(o_ptr);
19311         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
19312         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
19313         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
19314         *ret_copy = COption_ScalarZ_some(o_conv);
19315         int64_t ret_ref = tag_ptr(ret_copy, true);
19316         return ret_ref;
19317 }
19318
19319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1none(JNIEnv *env, jclass clz) {
19320         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
19321         *ret_copy = COption_ScalarZ_none();
19322         int64_t ret_ref = tag_ptr(ret_copy, true);
19323         return ret_ref;
19324 }
19325
19326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19327         if (!ptr_is_owned(_res)) return;
19328         void* _res_ptr = untag_ptr(_res);
19329         CHECK_ACCESS(_res_ptr);
19330         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
19331         FREE(untag_ptr(_res));
19332         COption_ScalarZ_free(_res_conv);
19333 }
19334
19335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19336         LDKThirtyTwoBytes o_ref;
19337         CHECK((*env)->GetArrayLength(env, o) == 32);
19338         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19339         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
19340         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
19341         return tag_ptr(ret_conv, true);
19342 }
19343
19344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1err(JNIEnv *env, jclass clz) {
19345         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
19346         *ret_conv = CResult_SharedSecretNoneZ_err();
19347         return tag_ptr(ret_conv, true);
19348 }
19349
19350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19351         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
19352         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
19353         return ret_conv;
19354 }
19355
19356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19357         if (!ptr_is_owned(_res)) return;
19358         void* _res_ptr = untag_ptr(_res);
19359         CHECK_ACCESS(_res_ptr);
19360         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
19361         FREE(untag_ptr(_res));
19362         CResult_SharedSecretNoneZ_free(_res_conv);
19363 }
19364
19365 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
19366         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
19367         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
19368         return tag_ptr(ret_conv, true);
19369 }
19370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19371         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
19372         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
19373         return ret_conv;
19374 }
19375
19376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19377         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
19378         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
19379         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
19380         return tag_ptr(ret_conv, true);
19381 }
19382
19383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19384         void* o_ptr = untag_ptr(o);
19385         CHECK_ACCESS(o_ptr);
19386         LDKSign o_conv = *(LDKSign*)(o_ptr);
19387         if (o_conv.free == LDKSign_JCalls_free) {
19388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19389                 LDKSign_JCalls_cloned(&o_conv);
19390         }
19391         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19392         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
19393         return tag_ptr(ret_conv, true);
19394 }
19395
19396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19397         LDKDecodeError e_conv;
19398         e_conv.inner = untag_ptr(e);
19399         e_conv.is_owned = ptr_is_owned(e);
19400         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19401         e_conv = DecodeError_clone(&e_conv);
19402         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19403         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
19404         return tag_ptr(ret_conv, true);
19405 }
19406
19407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19408         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
19409         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
19410         return ret_conv;
19411 }
19412
19413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19414         if (!ptr_is_owned(_res)) return;
19415         void* _res_ptr = untag_ptr(_res);
19416         CHECK_ACCESS(_res_ptr);
19417         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
19418         FREE(untag_ptr(_res));
19419         CResult_SignDecodeErrorZ_free(_res_conv);
19420 }
19421
19422 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
19423         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19424         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
19425         return tag_ptr(ret_conv, true);
19426 }
19427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19428         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
19429         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
19430         return ret_conv;
19431 }
19432
19433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19434         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
19435         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
19436         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
19437         return tag_ptr(ret_conv, true);
19438 }
19439
19440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19441         LDKCVec_u5Z _res_constr;
19442         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19443         if (_res_constr.datalen > 0)
19444                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
19445         else
19446                 _res_constr.data = NULL;
19447         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
19448         for (size_t h = 0; h < _res_constr.datalen; h++) {
19449                 int8_t _res_conv_7 = _res_vals[h];
19450                 
19451                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
19452         }
19453         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
19454         CVec_u5Z_free(_res_constr);
19455 }
19456
19457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19458         LDKRecoverableSignature o_ref;
19459         CHECK((*env)->GetArrayLength(env, o) == 68);
19460         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
19461         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19462         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
19463         return tag_ptr(ret_conv, true);
19464 }
19465
19466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
19467         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19468         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
19469         return tag_ptr(ret_conv, true);
19470 }
19471
19472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19473         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
19474         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
19475         return ret_conv;
19476 }
19477
19478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19479         if (!ptr_is_owned(_res)) return;
19480         void* _res_ptr = untag_ptr(_res);
19481         CHECK_ACCESS(_res_ptr);
19482         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
19483         FREE(untag_ptr(_res));
19484         CResult_RecoverableSignatureNoneZ_free(_res_conv);
19485 }
19486
19487 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
19488         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19489         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
19490         return tag_ptr(ret_conv, true);
19491 }
19492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19493         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
19494         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
19495         return ret_conv;
19496 }
19497
19498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19499         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
19500         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
19501         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
19502         return tag_ptr(ret_conv, true);
19503 }
19504
19505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19506         LDKCVec_u8Z _res_ref;
19507         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19508         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
19509         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19510         CVec_u8Z_free(_res_ref);
19511 }
19512
19513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19514         LDKCVec_CVec_u8ZZ _res_constr;
19515         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19516         if (_res_constr.datalen > 0)
19517                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
19518         else
19519                 _res_constr.data = NULL;
19520         for (size_t i = 0; i < _res_constr.datalen; i++) {
19521                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19522                 LDKCVec_u8Z _res_conv_8_ref;
19523                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
19524                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
19525                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
19526                 _res_constr.data[i] = _res_conv_8_ref;
19527         }
19528         CVec_CVec_u8ZZ_free(_res_constr);
19529 }
19530
19531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
19532         LDKCVec_CVec_u8ZZ o_constr;
19533         o_constr.datalen = (*env)->GetArrayLength(env, o);
19534         if (o_constr.datalen > 0)
19535                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
19536         else
19537                 o_constr.data = NULL;
19538         for (size_t i = 0; i < o_constr.datalen; i++) {
19539                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
19540                 LDKCVec_u8Z o_conv_8_ref;
19541                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
19542                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
19543                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
19544                 o_constr.data[i] = o_conv_8_ref;
19545         }
19546         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19547         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
19548         return tag_ptr(ret_conv, true);
19549 }
19550
19551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
19552         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19553         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
19554         return tag_ptr(ret_conv, true);
19555 }
19556
19557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19558         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
19559         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
19560         return ret_conv;
19561 }
19562
19563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19564         if (!ptr_is_owned(_res)) return;
19565         void* _res_ptr = untag_ptr(_res);
19566         CHECK_ACCESS(_res_ptr);
19567         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
19568         FREE(untag_ptr(_res));
19569         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
19570 }
19571
19572 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
19573         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19574         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
19575         return tag_ptr(ret_conv, true);
19576 }
19577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19578         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
19579         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
19580         return ret_conv;
19581 }
19582
19583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19584         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
19585         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
19586         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
19587         return tag_ptr(ret_conv, true);
19588 }
19589
19590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19591         LDKInMemorySigner o_conv;
19592         o_conv.inner = untag_ptr(o);
19593         o_conv.is_owned = ptr_is_owned(o);
19594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19595         o_conv = InMemorySigner_clone(&o_conv);
19596         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19597         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
19598         return tag_ptr(ret_conv, true);
19599 }
19600
19601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19602         LDKDecodeError e_conv;
19603         e_conv.inner = untag_ptr(e);
19604         e_conv.is_owned = ptr_is_owned(e);
19605         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19606         e_conv = DecodeError_clone(&e_conv);
19607         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19608         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
19609         return tag_ptr(ret_conv, true);
19610 }
19611
19612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19613         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
19614         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
19615         return ret_conv;
19616 }
19617
19618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19619         if (!ptr_is_owned(_res)) return;
19620         void* _res_ptr = untag_ptr(_res);
19621         CHECK_ACCESS(_res_ptr);
19622         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
19623         FREE(untag_ptr(_res));
19624         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
19625 }
19626
19627 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
19628         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19629         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
19630         return tag_ptr(ret_conv, true);
19631 }
19632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19633         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
19634         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
19635         return ret_conv;
19636 }
19637
19638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19639         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
19640         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
19641         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
19642         return tag_ptr(ret_conv, true);
19643 }
19644
19645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19646         LDKCVec_TxOutZ _res_constr;
19647         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19648         if (_res_constr.datalen > 0)
19649                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19650         else
19651                 _res_constr.data = NULL;
19652         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19653         for (size_t h = 0; h < _res_constr.datalen; h++) {
19654                 int64_t _res_conv_7 = _res_vals[h];
19655                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
19656                 CHECK_ACCESS(_res_conv_7_ptr);
19657                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19658                 FREE(untag_ptr(_res_conv_7));
19659                 _res_constr.data[h] = _res_conv_7_conv;
19660         }
19661         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19662         CVec_TxOutZ_free(_res_constr);
19663 }
19664
19665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19666         LDKTransaction o_ref;
19667         o_ref.datalen = (*env)->GetArrayLength(env, o);
19668         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
19669         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
19670         o_ref.data_is_owned = true;
19671         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19672         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
19673         return tag_ptr(ret_conv, true);
19674 }
19675
19676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
19677         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19678         *ret_conv = CResult_TransactionNoneZ_err();
19679         return tag_ptr(ret_conv, true);
19680 }
19681
19682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19683         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
19684         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
19685         return ret_conv;
19686 }
19687
19688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19689         if (!ptr_is_owned(_res)) return;
19690         void* _res_ptr = untag_ptr(_res);
19691         CHECK_ACCESS(_res_ptr);
19692         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
19693         FREE(untag_ptr(_res));
19694         CResult_TransactionNoneZ_free(_res_conv);
19695 }
19696
19697 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
19698         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19699         *ret_conv = CResult_TransactionNoneZ_clone(arg);
19700         return tag_ptr(ret_conv, true);
19701 }
19702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19703         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
19704         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
19705         return ret_conv;
19706 }
19707
19708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19709         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
19710         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19711         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
19712         return tag_ptr(ret_conv, true);
19713 }
19714
19715 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
19716         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19717         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
19718         return tag_ptr(ret_conv, true);
19719 }
19720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19721         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
19722         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
19723         return ret_conv;
19724 }
19725
19726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19727         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
19728         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19729         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
19730         return tag_ptr(ret_conv, true);
19731 }
19732
19733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19734         LDKThirtyTwoBytes a_ref;
19735         CHECK((*env)->GetArrayLength(env, a) == 32);
19736         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19737         LDKChannelMonitor b_conv;
19738         b_conv.inner = untag_ptr(b);
19739         b_conv.is_owned = ptr_is_owned(b);
19740         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19741         b_conv = ChannelMonitor_clone(&b_conv);
19742         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
19743         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
19744         return tag_ptr(ret_conv, true);
19745 }
19746
19747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19748         if (!ptr_is_owned(_res)) return;
19749         void* _res_ptr = untag_ptr(_res);
19750         CHECK_ACCESS(_res_ptr);
19751         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
19752         FREE(untag_ptr(_res));
19753         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
19754 }
19755
19756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19757         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
19758         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19759         if (_res_constr.datalen > 0)
19760                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
19761         else
19762                 _res_constr.data = NULL;
19763         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19764         for (size_t j = 0; j < _res_constr.datalen; j++) {
19765                 int64_t _res_conv_35 = _res_vals[j];
19766                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
19767                 CHECK_ACCESS(_res_conv_35_ptr);
19768                 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
19769                 FREE(untag_ptr(_res_conv_35));
19770                 _res_constr.data[j] = _res_conv_35_conv;
19771         }
19772         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19773         CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
19774 }
19775
19776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
19777         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
19778         o_constr.datalen = (*env)->GetArrayLength(env, o);
19779         if (o_constr.datalen > 0)
19780                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
19781         else
19782                 o_constr.data = NULL;
19783         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
19784         for (size_t j = 0; j < o_constr.datalen; j++) {
19785                 int64_t o_conv_35 = o_vals[j];
19786                 void* o_conv_35_ptr = untag_ptr(o_conv_35);
19787                 CHECK_ACCESS(o_conv_35_ptr);
19788                 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
19789                 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o_conv_35));
19790                 o_constr.data[j] = o_conv_35_conv;
19791         }
19792         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
19793         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19794         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
19795         return tag_ptr(ret_conv, true);
19796 }
19797
19798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19799         LDKIOError e_conv = LDKIOError_from_java(env, e);
19800         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19801         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
19802         return tag_ptr(ret_conv, true);
19803 }
19804
19805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19806         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(o);
19807         jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
19808         return ret_conv;
19809 }
19810
19811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19812         if (!ptr_is_owned(_res)) return;
19813         void* _res_ptr = untag_ptr(_res);
19814         CHECK_ACCESS(_res_ptr);
19815         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
19816         FREE(untag_ptr(_res));
19817         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
19818 }
19819
19820 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
19821         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19822         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
19823         return tag_ptr(ret_conv, true);
19824 }
19825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19826         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(arg);
19827         int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
19828         return ret_conv;
19829 }
19830
19831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19832         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(orig);
19833         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
19834         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
19835         return tag_ptr(ret_conv, true);
19836 }
19837
19838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
19839         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19840         *ret_copy = COption_u16Z_some(o);
19841         int64_t ret_ref = tag_ptr(ret_copy, true);
19842         return ret_ref;
19843 }
19844
19845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
19846         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19847         *ret_copy = COption_u16Z_none();
19848         int64_t ret_ref = tag_ptr(ret_copy, true);
19849         return ret_ref;
19850 }
19851
19852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
19853         if (!ptr_is_owned(_res)) return;
19854         void* _res_ptr = untag_ptr(_res);
19855         CHECK_ACCESS(_res_ptr);
19856         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
19857         FREE(untag_ptr(_res));
19858         COption_u16Z_free(_res_conv);
19859 }
19860
19861 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
19862         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19863         *ret_copy = COption_u16Z_clone(arg);
19864         int64_t ret_ref = tag_ptr(ret_copy, true);
19865         return ret_ref;
19866 }
19867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19868         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
19869         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
19870         return ret_conv;
19871 }
19872
19873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19874         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
19875         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
19876         *ret_copy = COption_u16Z_clone(orig_conv);
19877         int64_t ret_ref = tag_ptr(ret_copy, true);
19878         return ret_ref;
19879 }
19880
19881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
19882         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19883         *ret_conv = CResult_NoneAPIErrorZ_ok();
19884         return tag_ptr(ret_conv, true);
19885 }
19886
19887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19888         void* e_ptr = untag_ptr(e);
19889         CHECK_ACCESS(e_ptr);
19890         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19891         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
19892         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19893         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
19894         return tag_ptr(ret_conv, true);
19895 }
19896
19897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19898         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
19899         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
19900         return ret_conv;
19901 }
19902
19903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19904         if (!ptr_is_owned(_res)) return;
19905         void* _res_ptr = untag_ptr(_res);
19906         CHECK_ACCESS(_res_ptr);
19907         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
19908         FREE(untag_ptr(_res));
19909         CResult_NoneAPIErrorZ_free(_res_conv);
19910 }
19911
19912 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
19913         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19914         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
19915         return tag_ptr(ret_conv, true);
19916 }
19917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19918         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
19919         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
19920         return ret_conv;
19921 }
19922
19923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19924         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
19925         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19926         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
19927         return tag_ptr(ret_conv, true);
19928 }
19929
19930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19931         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
19932         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19933         if (_res_constr.datalen > 0)
19934                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19935         else
19936                 _res_constr.data = NULL;
19937         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19938         for (size_t w = 0; w < _res_constr.datalen; w++) {
19939                 int64_t _res_conv_22 = _res_vals[w];
19940                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
19941                 CHECK_ACCESS(_res_conv_22_ptr);
19942                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
19943                 FREE(untag_ptr(_res_conv_22));
19944                 _res_constr.data[w] = _res_conv_22_conv;
19945         }
19946         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19947         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
19948 }
19949
19950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19951         LDKCVec_APIErrorZ _res_constr;
19952         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19953         if (_res_constr.datalen > 0)
19954                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19955         else
19956                 _res_constr.data = NULL;
19957         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19958         for (size_t k = 0; k < _res_constr.datalen; k++) {
19959                 int64_t _res_conv_10 = _res_vals[k];
19960                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
19961                 CHECK_ACCESS(_res_conv_10_ptr);
19962                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
19963                 FREE(untag_ptr(_res_conv_10));
19964                 _res_constr.data[k] = _res_conv_10_conv;
19965         }
19966         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19967         CVec_APIErrorZ_free(_res_constr);
19968 }
19969
19970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19971         LDKThirtyTwoBytes o_ref;
19972         CHECK((*env)->GetArrayLength(env, o) == 32);
19973         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19974         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19975         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
19976         return tag_ptr(ret_conv, true);
19977 }
19978
19979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19980         void* e_ptr = untag_ptr(e);
19981         CHECK_ACCESS(e_ptr);
19982         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19983         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
19984         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
19985         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
19986         return tag_ptr(ret_conv, true);
19987 }
19988
19989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19990         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
19991         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
19992         return ret_conv;
19993 }
19994
19995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19996         if (!ptr_is_owned(_res)) return;
19997         void* _res_ptr = untag_ptr(_res);
19998         CHECK_ACCESS(_res_ptr);
19999         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
20000         FREE(untag_ptr(_res));
20001         CResult__u832APIErrorZ_free(_res_conv);
20002 }
20003
20004 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
20005         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20006         *ret_conv = CResult__u832APIErrorZ_clone(arg);
20007         return tag_ptr(ret_conv, true);
20008 }
20009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20010         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
20011         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
20012         return ret_conv;
20013 }
20014
20015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20016         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
20017         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20018         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
20019         return tag_ptr(ret_conv, true);
20020 }
20021
20022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20023         LDKThirtyTwoBytes o_ref;
20024         CHECK((*env)->GetArrayLength(env, o) == 32);
20025         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20026         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
20027         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
20028         return tag_ptr(ret_conv, true);
20029 }
20030
20031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20032         void* e_ptr = untag_ptr(e);
20033         CHECK_ACCESS(e_ptr);
20034         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20035         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20036         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
20037         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
20038         return tag_ptr(ret_conv, true);
20039 }
20040
20041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20042         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
20043         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
20044         return ret_conv;
20045 }
20046
20047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20048         if (!ptr_is_owned(_res)) return;
20049         void* _res_ptr = untag_ptr(_res);
20050         CHECK_ACCESS(_res_ptr);
20051         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
20052         FREE(untag_ptr(_res));
20053         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
20054 }
20055
20056 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
20057         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
20058         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
20059         return tag_ptr(ret_conv, true);
20060 }
20061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20062         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
20063         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
20064         return ret_conv;
20065 }
20066
20067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20068         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
20069         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
20070         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
20071         return tag_ptr(ret_conv, true);
20072 }
20073
20074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
20075         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20076         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20077         return tag_ptr(ret_conv, true);
20078 }
20079
20080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20081         void* e_ptr = untag_ptr(e);
20082         CHECK_ACCESS(e_ptr);
20083         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20084         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20085         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20086         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20087         return tag_ptr(ret_conv, true);
20088 }
20089
20090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20091         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20092         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20093         return ret_conv;
20094 }
20095
20096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_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_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20101         FREE(untag_ptr(_res));
20102         CResult_NonePaymentSendFailureZ_free(_res_conv);
20103 }
20104
20105 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20106         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20107         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20108         return tag_ptr(ret_conv, true);
20109 }
20110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20111         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20112         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20113         return ret_conv;
20114 }
20115
20116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20117         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20118         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20119         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20120         return tag_ptr(ret_conv, true);
20121 }
20122
20123 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
20124         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20125         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
20126         return tag_ptr(ret_conv, true);
20127 }
20128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20129         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
20130         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
20131         return ret_conv;
20132 }
20133
20134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20135         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
20136         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20137         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
20138         return tag_ptr(ret_conv, true);
20139 }
20140
20141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
20142         LDKThirtyTwoBytes a_ref;
20143         CHECK((*env)->GetArrayLength(env, a) == 32);
20144         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20145         LDKThirtyTwoBytes b_ref;
20146         CHECK((*env)->GetArrayLength(env, b) == 32);
20147         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
20148         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20149         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
20150         return tag_ptr(ret_conv, true);
20151 }
20152
20153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20154         if (!ptr_is_owned(_res)) return;
20155         void* _res_ptr = untag_ptr(_res);
20156         CHECK_ACCESS(_res_ptr);
20157         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
20158         FREE(untag_ptr(_res));
20159         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
20160 }
20161
20162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20163         void* o_ptr = untag_ptr(o);
20164         CHECK_ACCESS(o_ptr);
20165         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
20166         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
20167         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20168         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
20169         return tag_ptr(ret_conv, true);
20170 }
20171
20172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20173         void* e_ptr = untag_ptr(e);
20174         CHECK_ACCESS(e_ptr);
20175         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20176         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20177         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20178         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
20179         return tag_ptr(ret_conv, true);
20180 }
20181
20182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20183         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
20184         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
20185         return ret_conv;
20186 }
20187
20188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20189         if (!ptr_is_owned(_res)) return;
20190         void* _res_ptr = untag_ptr(_res);
20191         CHECK_ACCESS(_res_ptr);
20192         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
20193         FREE(untag_ptr(_res));
20194         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
20195 }
20196
20197 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
20198         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20199         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
20200         return tag_ptr(ret_conv, true);
20201 }
20202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20203         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
20204         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
20205         return ret_conv;
20206 }
20207
20208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20209         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
20210         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20211         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
20212         return tag_ptr(ret_conv, true);
20213 }
20214
20215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20216         LDKCVec_ThirtyTwoBytesZ _res_constr;
20217         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20218         if (_res_constr.datalen > 0)
20219                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
20220         else
20221                 _res_constr.data = NULL;
20222         for (size_t i = 0; i < _res_constr.datalen; i++) {
20223                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20224                 LDKThirtyTwoBytes _res_conv_8_ref;
20225                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
20226                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
20227                 _res_constr.data[i] = _res_conv_8_ref;
20228         }
20229         CVec_ThirtyTwoBytesZ_free(_res_constr);
20230 }
20231
20232 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
20233         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20234         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
20235         return tag_ptr(ret_conv, true);
20236 }
20237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20238         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
20239         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
20240         return ret_conv;
20241 }
20242
20243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20244         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
20245         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20246         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
20247         return tag_ptr(ret_conv, true);
20248 }
20249
20250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
20251         LDKThirtyTwoBytes a_ref;
20252         CHECK((*env)->GetArrayLength(env, a) == 32);
20253         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20254         LDKThirtyTwoBytes b_ref;
20255         CHECK((*env)->GetArrayLength(env, b) == 32);
20256         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
20257         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20258         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
20259         return tag_ptr(ret_conv, true);
20260 }
20261
20262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20263         if (!ptr_is_owned(_res)) return;
20264         void* _res_ptr = untag_ptr(_res);
20265         CHECK_ACCESS(_res_ptr);
20266         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
20267         FREE(untag_ptr(_res));
20268         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
20269 }
20270
20271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20272         void* o_ptr = untag_ptr(o);
20273         CHECK_ACCESS(o_ptr);
20274         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
20275         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
20276         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20277         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
20278         return tag_ptr(ret_conv, true);
20279 }
20280
20281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
20282         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20283         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
20284         return tag_ptr(ret_conv, true);
20285 }
20286
20287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20288         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
20289         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
20290         return ret_conv;
20291 }
20292
20293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20294         if (!ptr_is_owned(_res)) return;
20295         void* _res_ptr = untag_ptr(_res);
20296         CHECK_ACCESS(_res_ptr);
20297         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
20298         FREE(untag_ptr(_res));
20299         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
20300 }
20301
20302 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
20303         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20304         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
20305         return tag_ptr(ret_conv, true);
20306 }
20307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20308         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
20309         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
20310         return ret_conv;
20311 }
20312
20313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20314         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
20315         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20316         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
20317         return tag_ptr(ret_conv, true);
20318 }
20319
20320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20321         void* o_ptr = untag_ptr(o);
20322         CHECK_ACCESS(o_ptr);
20323         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
20324         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
20325         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
20326         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
20327         return tag_ptr(ret_conv, true);
20328 }
20329
20330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20331         void* e_ptr = untag_ptr(e);
20332         CHECK_ACCESS(e_ptr);
20333         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20334         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20335         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
20336         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
20337         return tag_ptr(ret_conv, true);
20338 }
20339
20340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20341         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
20342         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
20343         return ret_conv;
20344 }
20345
20346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20347         if (!ptr_is_owned(_res)) return;
20348         void* _res_ptr = untag_ptr(_res);
20349         CHECK_ACCESS(_res_ptr);
20350         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
20351         FREE(untag_ptr(_res));
20352         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
20353 }
20354
20355 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
20356         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
20357         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
20358         return tag_ptr(ret_conv, true);
20359 }
20360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20361         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
20362         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
20363         return ret_conv;
20364 }
20365
20366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20367         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
20368         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
20369         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
20370         return tag_ptr(ret_conv, true);
20371 }
20372
20373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20374         LDKThirtyTwoBytes o_ref;
20375         CHECK((*env)->GetArrayLength(env, o) == 32);
20376         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20377         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20378         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
20379         return tag_ptr(ret_conv, true);
20380 }
20381
20382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
20383         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20384         *ret_conv = CResult_PaymentSecretNoneZ_err();
20385         return tag_ptr(ret_conv, true);
20386 }
20387
20388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20389         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
20390         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
20391         return ret_conv;
20392 }
20393
20394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20395         if (!ptr_is_owned(_res)) return;
20396         void* _res_ptr = untag_ptr(_res);
20397         CHECK_ACCESS(_res_ptr);
20398         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
20399         FREE(untag_ptr(_res));
20400         CResult_PaymentSecretNoneZ_free(_res_conv);
20401 }
20402
20403 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
20404         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20405         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
20406         return tag_ptr(ret_conv, true);
20407 }
20408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20409         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
20410         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
20411         return ret_conv;
20412 }
20413
20414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20415         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
20416         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20417         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
20418         return tag_ptr(ret_conv, true);
20419 }
20420
20421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20422         LDKThirtyTwoBytes o_ref;
20423         CHECK((*env)->GetArrayLength(env, o) == 32);
20424         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20425         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20426         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
20427         return tag_ptr(ret_conv, true);
20428 }
20429
20430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20431         void* e_ptr = untag_ptr(e);
20432         CHECK_ACCESS(e_ptr);
20433         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20434         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20435         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20436         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
20437         return tag_ptr(ret_conv, true);
20438 }
20439
20440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20441         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
20442         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
20443         return ret_conv;
20444 }
20445
20446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20447         if (!ptr_is_owned(_res)) return;
20448         void* _res_ptr = untag_ptr(_res);
20449         CHECK_ACCESS(_res_ptr);
20450         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
20451         FREE(untag_ptr(_res));
20452         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
20453 }
20454
20455 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
20456         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20457         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
20458         return tag_ptr(ret_conv, true);
20459 }
20460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20461         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
20462         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
20463         return ret_conv;
20464 }
20465
20466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20467         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
20468         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
20469         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
20470         return tag_ptr(ret_conv, true);
20471 }
20472
20473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20474         LDKThirtyTwoBytes o_ref;
20475         CHECK((*env)->GetArrayLength(env, o) == 32);
20476         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20477         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20478         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
20479         return tag_ptr(ret_conv, true);
20480 }
20481
20482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20483         void* e_ptr = untag_ptr(e);
20484         CHECK_ACCESS(e_ptr);
20485         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20486         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20487         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20488         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
20489         return tag_ptr(ret_conv, true);
20490 }
20491
20492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20493         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
20494         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
20495         return ret_conv;
20496 }
20497
20498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20499         if (!ptr_is_owned(_res)) return;
20500         void* _res_ptr = untag_ptr(_res);
20501         CHECK_ACCESS(_res_ptr);
20502         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
20503         FREE(untag_ptr(_res));
20504         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
20505 }
20506
20507 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
20508         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20509         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
20510         return tag_ptr(ret_conv, true);
20511 }
20512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20513         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
20514         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
20515         return ret_conv;
20516 }
20517
20518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20519         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
20520         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
20521         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
20522         return tag_ptr(ret_conv, true);
20523 }
20524
20525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20526         LDKCounterpartyForwardingInfo o_conv;
20527         o_conv.inner = untag_ptr(o);
20528         o_conv.is_owned = ptr_is_owned(o);
20529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20530         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
20531         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20532         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
20533         return tag_ptr(ret_conv, true);
20534 }
20535
20536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20537         LDKDecodeError e_conv;
20538         e_conv.inner = untag_ptr(e);
20539         e_conv.is_owned = ptr_is_owned(e);
20540         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20541         e_conv = DecodeError_clone(&e_conv);
20542         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20543         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
20544         return tag_ptr(ret_conv, true);
20545 }
20546
20547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20548         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
20549         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
20550         return ret_conv;
20551 }
20552
20553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20554         if (!ptr_is_owned(_res)) return;
20555         void* _res_ptr = untag_ptr(_res);
20556         CHECK_ACCESS(_res_ptr);
20557         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
20558         FREE(untag_ptr(_res));
20559         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
20560 }
20561
20562 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
20563         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20564         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
20565         return tag_ptr(ret_conv, true);
20566 }
20567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20568         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
20569         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
20570         return ret_conv;
20571 }
20572
20573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20574         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
20575         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
20576         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
20577         return tag_ptr(ret_conv, true);
20578 }
20579
20580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20581         LDKChannelCounterparty o_conv;
20582         o_conv.inner = untag_ptr(o);
20583         o_conv.is_owned = ptr_is_owned(o);
20584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20585         o_conv = ChannelCounterparty_clone(&o_conv);
20586         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20587         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
20588         return tag_ptr(ret_conv, true);
20589 }
20590
20591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20592         LDKDecodeError e_conv;
20593         e_conv.inner = untag_ptr(e);
20594         e_conv.is_owned = ptr_is_owned(e);
20595         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20596         e_conv = DecodeError_clone(&e_conv);
20597         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20598         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
20599         return tag_ptr(ret_conv, true);
20600 }
20601
20602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20603         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
20604         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
20605         return ret_conv;
20606 }
20607
20608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20609         if (!ptr_is_owned(_res)) return;
20610         void* _res_ptr = untag_ptr(_res);
20611         CHECK_ACCESS(_res_ptr);
20612         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
20613         FREE(untag_ptr(_res));
20614         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
20615 }
20616
20617 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
20618         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20619         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
20620         return tag_ptr(ret_conv, true);
20621 }
20622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20623         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
20624         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
20625         return ret_conv;
20626 }
20627
20628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20629         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
20630         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
20631         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
20632         return tag_ptr(ret_conv, true);
20633 }
20634
20635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20636         LDKChannelDetails o_conv;
20637         o_conv.inner = untag_ptr(o);
20638         o_conv.is_owned = ptr_is_owned(o);
20639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20640         o_conv = ChannelDetails_clone(&o_conv);
20641         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20642         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
20643         return tag_ptr(ret_conv, true);
20644 }
20645
20646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20647         LDKDecodeError e_conv;
20648         e_conv.inner = untag_ptr(e);
20649         e_conv.is_owned = ptr_is_owned(e);
20650         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20651         e_conv = DecodeError_clone(&e_conv);
20652         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20653         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
20654         return tag_ptr(ret_conv, true);
20655 }
20656
20657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20658         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
20659         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
20660         return ret_conv;
20661 }
20662
20663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20664         if (!ptr_is_owned(_res)) return;
20665         void* _res_ptr = untag_ptr(_res);
20666         CHECK_ACCESS(_res_ptr);
20667         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
20668         FREE(untag_ptr(_res));
20669         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
20670 }
20671
20672 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
20673         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20674         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
20675         return tag_ptr(ret_conv, true);
20676 }
20677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20678         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
20679         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
20680         return ret_conv;
20681 }
20682
20683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20684         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
20685         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
20686         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
20687         return tag_ptr(ret_conv, true);
20688 }
20689
20690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20691         LDKPhantomRouteHints o_conv;
20692         o_conv.inner = untag_ptr(o);
20693         o_conv.is_owned = ptr_is_owned(o);
20694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20695         o_conv = PhantomRouteHints_clone(&o_conv);
20696         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20697         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
20698         return tag_ptr(ret_conv, true);
20699 }
20700
20701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20702         LDKDecodeError e_conv;
20703         e_conv.inner = untag_ptr(e);
20704         e_conv.is_owned = ptr_is_owned(e);
20705         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20706         e_conv = DecodeError_clone(&e_conv);
20707         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20708         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
20709         return tag_ptr(ret_conv, true);
20710 }
20711
20712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20713         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
20714         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
20715         return ret_conv;
20716 }
20717
20718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20719         if (!ptr_is_owned(_res)) return;
20720         void* _res_ptr = untag_ptr(_res);
20721         CHECK_ACCESS(_res_ptr);
20722         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
20723         FREE(untag_ptr(_res));
20724         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
20725 }
20726
20727 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
20728         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20729         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
20730         return tag_ptr(ret_conv, true);
20731 }
20732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20733         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
20734         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
20735         return ret_conv;
20736 }
20737
20738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20739         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
20740         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
20741         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
20742         return tag_ptr(ret_conv, true);
20743 }
20744
20745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20746         LDKCVec_ChannelMonitorZ _res_constr;
20747         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20748         if (_res_constr.datalen > 0)
20749                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
20750         else
20751                 _res_constr.data = NULL;
20752         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20753         for (size_t q = 0; q < _res_constr.datalen; q++) {
20754                 int64_t _res_conv_16 = _res_vals[q];
20755                 LDKChannelMonitor _res_conv_16_conv;
20756                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20757                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20758                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20759                 _res_constr.data[q] = _res_conv_16_conv;
20760         }
20761         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20762         CVec_ChannelMonitorZ_free(_res_constr);
20763 }
20764
20765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20766         LDKThirtyTwoBytes a_ref;
20767         CHECK((*env)->GetArrayLength(env, a) == 32);
20768         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20769         LDKChannelManager b_conv;
20770         b_conv.inner = untag_ptr(b);
20771         b_conv.is_owned = ptr_is_owned(b);
20772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20773         // WARNING: we need a move here but no clone is available for LDKChannelManager
20774         
20775         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
20776         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
20777         return tag_ptr(ret_conv, true);
20778 }
20779
20780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20781         if (!ptr_is_owned(_res)) return;
20782         void* _res_ptr = untag_ptr(_res);
20783         CHECK_ACCESS(_res_ptr);
20784         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
20785         FREE(untag_ptr(_res));
20786         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
20787 }
20788
20789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20790         void* o_ptr = untag_ptr(o);
20791         CHECK_ACCESS(o_ptr);
20792         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
20793         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
20794         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20795         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
20796         return tag_ptr(ret_conv, true);
20797 }
20798
20799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20800         LDKDecodeError e_conv;
20801         e_conv.inner = untag_ptr(e);
20802         e_conv.is_owned = ptr_is_owned(e);
20803         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20804         e_conv = DecodeError_clone(&e_conv);
20805         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
20806         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
20807         return tag_ptr(ret_conv, true);
20808 }
20809
20810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20811         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
20812         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
20813         return ret_conv;
20814 }
20815
20816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20817         if (!ptr_is_owned(_res)) return;
20818         void* _res_ptr = untag_ptr(_res);
20819         CHECK_ACCESS(_res_ptr);
20820         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
20821         FREE(untag_ptr(_res));
20822         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
20823 }
20824
20825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20826         LDKChannelConfig o_conv;
20827         o_conv.inner = untag_ptr(o);
20828         o_conv.is_owned = ptr_is_owned(o);
20829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20830         o_conv = ChannelConfig_clone(&o_conv);
20831         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20832         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
20833         return tag_ptr(ret_conv, true);
20834 }
20835
20836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20837         LDKDecodeError e_conv;
20838         e_conv.inner = untag_ptr(e);
20839         e_conv.is_owned = ptr_is_owned(e);
20840         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20841         e_conv = DecodeError_clone(&e_conv);
20842         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20843         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
20844         return tag_ptr(ret_conv, true);
20845 }
20846
20847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20848         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
20849         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
20850         return ret_conv;
20851 }
20852
20853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20854         if (!ptr_is_owned(_res)) return;
20855         void* _res_ptr = untag_ptr(_res);
20856         CHECK_ACCESS(_res_ptr);
20857         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
20858         FREE(untag_ptr(_res));
20859         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
20860 }
20861
20862 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
20863         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20864         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
20865         return tag_ptr(ret_conv, true);
20866 }
20867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20868         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
20869         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
20870         return ret_conv;
20871 }
20872
20873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20874         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
20875         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
20876         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
20877         return tag_ptr(ret_conv, true);
20878 }
20879
20880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20881         LDKOutPoint o_conv;
20882         o_conv.inner = untag_ptr(o);
20883         o_conv.is_owned = ptr_is_owned(o);
20884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20885         o_conv = OutPoint_clone(&o_conv);
20886         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20887         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
20888         return tag_ptr(ret_conv, true);
20889 }
20890
20891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20892         LDKDecodeError e_conv;
20893         e_conv.inner = untag_ptr(e);
20894         e_conv.is_owned = ptr_is_owned(e);
20895         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20896         e_conv = DecodeError_clone(&e_conv);
20897         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20898         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
20899         return tag_ptr(ret_conv, true);
20900 }
20901
20902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20903         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
20904         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
20905         return ret_conv;
20906 }
20907
20908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20909         if (!ptr_is_owned(_res)) return;
20910         void* _res_ptr = untag_ptr(_res);
20911         CHECK_ACCESS(_res_ptr);
20912         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
20913         FREE(untag_ptr(_res));
20914         CResult_OutPointDecodeErrorZ_free(_res_conv);
20915 }
20916
20917 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
20918         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20919         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
20920         return tag_ptr(ret_conv, true);
20921 }
20922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20923         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
20924         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
20925         return ret_conv;
20926 }
20927
20928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20929         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
20930         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
20931         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
20932         return tag_ptr(ret_conv, true);
20933 }
20934
20935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20936         void* o_ptr = untag_ptr(o);
20937         CHECK_ACCESS(o_ptr);
20938         LDKType o_conv = *(LDKType*)(o_ptr);
20939         if (o_conv.free == LDKType_JCalls_free) {
20940                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20941                 LDKType_JCalls_cloned(&o_conv);
20942         }
20943         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20944         *ret_copy = COption_TypeZ_some(o_conv);
20945         int64_t ret_ref = tag_ptr(ret_copy, true);
20946         return ret_ref;
20947 }
20948
20949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
20950         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20951         *ret_copy = COption_TypeZ_none();
20952         int64_t ret_ref = tag_ptr(ret_copy, true);
20953         return ret_ref;
20954 }
20955
20956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20957         if (!ptr_is_owned(_res)) return;
20958         void* _res_ptr = untag_ptr(_res);
20959         CHECK_ACCESS(_res_ptr);
20960         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
20961         FREE(untag_ptr(_res));
20962         COption_TypeZ_free(_res_conv);
20963 }
20964
20965 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
20966         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20967         *ret_copy = COption_TypeZ_clone(arg);
20968         int64_t ret_ref = tag_ptr(ret_copy, true);
20969         return ret_ref;
20970 }
20971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20972         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
20973         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
20974         return ret_conv;
20975 }
20976
20977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20978         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
20979         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
20980         *ret_copy = COption_TypeZ_clone(orig_conv);
20981         int64_t ret_ref = tag_ptr(ret_copy, true);
20982         return ret_ref;
20983 }
20984
20985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20986         void* o_ptr = untag_ptr(o);
20987         CHECK_ACCESS(o_ptr);
20988         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
20989         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
20990         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
20991         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
20992         return tag_ptr(ret_conv, true);
20993 }
20994
20995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20996         LDKDecodeError e_conv;
20997         e_conv.inner = untag_ptr(e);
20998         e_conv.is_owned = ptr_is_owned(e);
20999         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21000         e_conv = DecodeError_clone(&e_conv);
21001         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
21002         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
21003         return tag_ptr(ret_conv, true);
21004 }
21005
21006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21007         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
21008         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
21009         return ret_conv;
21010 }
21011
21012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21013         if (!ptr_is_owned(_res)) return;
21014         void* _res_ptr = untag_ptr(_res);
21015         CHECK_ACCESS(_res_ptr);
21016         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
21017         FREE(untag_ptr(_res));
21018         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
21019 }
21020
21021 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
21022         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
21023         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
21024         return tag_ptr(ret_conv, true);
21025 }
21026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21027         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
21028         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
21029         return ret_conv;
21030 }
21031
21032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21033         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
21034         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
21035         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
21036         return tag_ptr(ret_conv, true);
21037 }
21038
21039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
21040         LDKThirtyTwoBytes o_ref;
21041         CHECK((*env)->GetArrayLength(env, o) == 32);
21042         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
21043         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
21044         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
21045         return tag_ptr(ret_conv, true);
21046 }
21047
21048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21049         void* e_ptr = untag_ptr(e);
21050         CHECK_ACCESS(e_ptr);
21051         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
21052         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
21053         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
21054         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
21055         return tag_ptr(ret_conv, true);
21056 }
21057
21058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21059         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
21060         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
21061         return ret_conv;
21062 }
21063
21064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21065         if (!ptr_is_owned(_res)) return;
21066         void* _res_ptr = untag_ptr(_res);
21067         CHECK_ACCESS(_res_ptr);
21068         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
21069         FREE(untag_ptr(_res));
21070         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
21071 }
21072
21073 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
21074         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
21075         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
21076         return tag_ptr(ret_conv, true);
21077 }
21078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21079         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
21080         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
21081         return ret_conv;
21082 }
21083
21084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21085         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
21086         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
21087         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
21088         return tag_ptr(ret_conv, true);
21089 }
21090
21091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21092         LDKInFlightHtlcs o_conv;
21093         o_conv.inner = untag_ptr(o);
21094         o_conv.is_owned = ptr_is_owned(o);
21095         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21096         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
21097         
21098         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21099         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
21100         return tag_ptr(ret_conv, true);
21101 }
21102
21103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21104         LDKDecodeError e_conv;
21105         e_conv.inner = untag_ptr(e);
21106         e_conv.is_owned = ptr_is_owned(e);
21107         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21108         e_conv = DecodeError_clone(&e_conv);
21109         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21110         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
21111         return tag_ptr(ret_conv, true);
21112 }
21113
21114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21115         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
21116         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
21117         return ret_conv;
21118 }
21119
21120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21121         if (!ptr_is_owned(_res)) return;
21122         void* _res_ptr = untag_ptr(_res);
21123         CHECK_ACCESS(_res_ptr);
21124         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
21125         FREE(untag_ptr(_res));
21126         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
21127 }
21128
21129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
21130         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
21131         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
21132         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
21133         return tag_ptr(ret_conv, true);
21134 }
21135
21136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21137         void* e_ptr = untag_ptr(e);
21138         CHECK_ACCESS(e_ptr);
21139         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
21140         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
21141         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
21142         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
21143         return tag_ptr(ret_conv, true);
21144 }
21145
21146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21147         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
21148         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
21149         return ret_conv;
21150 }
21151
21152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21153         if (!ptr_is_owned(_res)) return;
21154         void* _res_ptr = untag_ptr(_res);
21155         CHECK_ACCESS(_res_ptr);
21156         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
21157         FREE(untag_ptr(_res));
21158         CResult_SiPrefixParseErrorZ_free(_res_conv);
21159 }
21160
21161 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
21162         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
21163         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
21164         return tag_ptr(ret_conv, true);
21165 }
21166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21167         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
21168         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
21169         return ret_conv;
21170 }
21171
21172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21173         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
21174         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
21175         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
21176         return tag_ptr(ret_conv, true);
21177 }
21178
21179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21180         LDKInvoice o_conv;
21181         o_conv.inner = untag_ptr(o);
21182         o_conv.is_owned = ptr_is_owned(o);
21183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21184         o_conv = Invoice_clone(&o_conv);
21185         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
21186         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
21187         return tag_ptr(ret_conv, true);
21188 }
21189
21190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21191         void* e_ptr = untag_ptr(e);
21192         CHECK_ACCESS(e_ptr);
21193         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
21194         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
21195         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
21196         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
21197         return tag_ptr(ret_conv, true);
21198 }
21199
21200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21201         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
21202         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
21203         return ret_conv;
21204 }
21205
21206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21207         if (!ptr_is_owned(_res)) return;
21208         void* _res_ptr = untag_ptr(_res);
21209         CHECK_ACCESS(_res_ptr);
21210         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
21211         FREE(untag_ptr(_res));
21212         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
21213 }
21214
21215 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
21216         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
21217         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
21218         return tag_ptr(ret_conv, true);
21219 }
21220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21221         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
21222         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
21223         return ret_conv;
21224 }
21225
21226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21227         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
21228         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
21229         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
21230         return tag_ptr(ret_conv, true);
21231 }
21232
21233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21234         LDKSignedRawInvoice o_conv;
21235         o_conv.inner = untag_ptr(o);
21236         o_conv.is_owned = ptr_is_owned(o);
21237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21238         o_conv = SignedRawInvoice_clone(&o_conv);
21239         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
21240         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
21241         return tag_ptr(ret_conv, true);
21242 }
21243
21244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21245         void* e_ptr = untag_ptr(e);
21246         CHECK_ACCESS(e_ptr);
21247         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
21248         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
21249         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
21250         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
21251         return tag_ptr(ret_conv, true);
21252 }
21253
21254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21255         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
21256         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
21257         return ret_conv;
21258 }
21259
21260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21261         if (!ptr_is_owned(_res)) return;
21262         void* _res_ptr = untag_ptr(_res);
21263         CHECK_ACCESS(_res_ptr);
21264         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
21265         FREE(untag_ptr(_res));
21266         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
21267 }
21268
21269 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
21270         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
21271         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
21272         return tag_ptr(ret_conv, true);
21273 }
21274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21275         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
21276         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
21277         return ret_conv;
21278 }
21279
21280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21281         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
21282         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
21283         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
21284         return tag_ptr(ret_conv, true);
21285 }
21286
21287 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
21288         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
21289         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
21290         return tag_ptr(ret_conv, true);
21291 }
21292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21293         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
21294         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
21295         return ret_conv;
21296 }
21297
21298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21299         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
21300         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
21301         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
21302         return tag_ptr(ret_conv, true);
21303 }
21304
21305 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) {
21306         LDKRawInvoice a_conv;
21307         a_conv.inner = untag_ptr(a);
21308         a_conv.is_owned = ptr_is_owned(a);
21309         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21310         a_conv = RawInvoice_clone(&a_conv);
21311         LDKThirtyTwoBytes b_ref;
21312         CHECK((*env)->GetArrayLength(env, b) == 32);
21313         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
21314         LDKInvoiceSignature c_conv;
21315         c_conv.inner = untag_ptr(c);
21316         c_conv.is_owned = ptr_is_owned(c);
21317         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
21318         c_conv = InvoiceSignature_clone(&c_conv);
21319         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
21320         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
21321         return tag_ptr(ret_conv, true);
21322 }
21323
21324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21325         if (!ptr_is_owned(_res)) return;
21326         void* _res_ptr = untag_ptr(_res);
21327         CHECK_ACCESS(_res_ptr);
21328         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
21329         FREE(untag_ptr(_res));
21330         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
21331 }
21332
21333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21334         LDKPayeePubKey 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 = PayeePubKey_clone(&o_conv);
21339         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
21340         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
21341         return tag_ptr(ret_conv, true);
21342 }
21343
21344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21345         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
21346         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
21347         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
21348         return tag_ptr(ret_conv, true);
21349 }
21350
21351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21352         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
21353         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
21354         return ret_conv;
21355 }
21356
21357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21358         if (!ptr_is_owned(_res)) return;
21359         void* _res_ptr = untag_ptr(_res);
21360         CHECK_ACCESS(_res_ptr);
21361         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
21362         FREE(untag_ptr(_res));
21363         CResult_PayeePubKeyErrorZ_free(_res_conv);
21364 }
21365
21366 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
21367         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
21368         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
21369         return tag_ptr(ret_conv, true);
21370 }
21371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21372         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
21373         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
21374         return ret_conv;
21375 }
21376
21377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21378         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
21379         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
21380         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
21381         return tag_ptr(ret_conv, true);
21382 }
21383
21384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21385         LDKCVec_PrivateRouteZ _res_constr;
21386         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21387         if (_res_constr.datalen > 0)
21388                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
21389         else
21390                 _res_constr.data = NULL;
21391         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21392         for (size_t o = 0; o < _res_constr.datalen; o++) {
21393                 int64_t _res_conv_14 = _res_vals[o];
21394                 LDKPrivateRoute _res_conv_14_conv;
21395                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21396                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21397                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21398                 _res_constr.data[o] = _res_conv_14_conv;
21399         }
21400         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21401         CVec_PrivateRouteZ_free(_res_constr);
21402 }
21403
21404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21405         LDKPositiveTimestamp o_conv;
21406         o_conv.inner = untag_ptr(o);
21407         o_conv.is_owned = ptr_is_owned(o);
21408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21409         o_conv = PositiveTimestamp_clone(&o_conv);
21410         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
21411         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
21412         return tag_ptr(ret_conv, true);
21413 }
21414
21415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21416         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
21417         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
21418         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
21419         return tag_ptr(ret_conv, true);
21420 }
21421
21422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21423         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
21424         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
21425         return ret_conv;
21426 }
21427
21428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21429         if (!ptr_is_owned(_res)) return;
21430         void* _res_ptr = untag_ptr(_res);
21431         CHECK_ACCESS(_res_ptr);
21432         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
21433         FREE(untag_ptr(_res));
21434         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
21435 }
21436
21437 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
21438         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
21439         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
21440         return tag_ptr(ret_conv, true);
21441 }
21442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21443         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
21444         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
21445         return ret_conv;
21446 }
21447
21448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21449         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
21450         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
21451         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
21452         return tag_ptr(ret_conv, true);
21453 }
21454
21455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
21456         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21457         *ret_conv = CResult_NoneSemanticErrorZ_ok();
21458         return tag_ptr(ret_conv, true);
21459 }
21460
21461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21462         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
21463         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21464         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
21465         return tag_ptr(ret_conv, true);
21466 }
21467
21468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21469         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
21470         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
21471         return ret_conv;
21472 }
21473
21474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21475         if (!ptr_is_owned(_res)) return;
21476         void* _res_ptr = untag_ptr(_res);
21477         CHECK_ACCESS(_res_ptr);
21478         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
21479         FREE(untag_ptr(_res));
21480         CResult_NoneSemanticErrorZ_free(_res_conv);
21481 }
21482
21483 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
21484         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21485         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
21486         return tag_ptr(ret_conv, true);
21487 }
21488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21489         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
21490         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
21491         return ret_conv;
21492 }
21493
21494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21495         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
21496         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
21497         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
21498         return tag_ptr(ret_conv, true);
21499 }
21500
21501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21502         LDKInvoice o_conv;
21503         o_conv.inner = untag_ptr(o);
21504         o_conv.is_owned = ptr_is_owned(o);
21505         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21506         o_conv = Invoice_clone(&o_conv);
21507         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21508         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
21509         return tag_ptr(ret_conv, true);
21510 }
21511
21512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21513         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
21514         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21515         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
21516         return tag_ptr(ret_conv, true);
21517 }
21518
21519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21520         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
21521         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
21522         return ret_conv;
21523 }
21524
21525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21526         if (!ptr_is_owned(_res)) return;
21527         void* _res_ptr = untag_ptr(_res);
21528         CHECK_ACCESS(_res_ptr);
21529         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
21530         FREE(untag_ptr(_res));
21531         CResult_InvoiceSemanticErrorZ_free(_res_conv);
21532 }
21533
21534 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
21535         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21536         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
21537         return tag_ptr(ret_conv, true);
21538 }
21539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21540         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
21541         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
21542         return ret_conv;
21543 }
21544
21545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21546         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
21547         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
21548         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
21549         return tag_ptr(ret_conv, true);
21550 }
21551
21552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21553         LDKDescription o_conv;
21554         o_conv.inner = untag_ptr(o);
21555         o_conv.is_owned = ptr_is_owned(o);
21556         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21557         o_conv = Description_clone(&o_conv);
21558         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21559         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
21560         return tag_ptr(ret_conv, true);
21561 }
21562
21563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21564         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
21565         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21566         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
21567         return tag_ptr(ret_conv, true);
21568 }
21569
21570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21571         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
21572         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
21573         return ret_conv;
21574 }
21575
21576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21577         if (!ptr_is_owned(_res)) return;
21578         void* _res_ptr = untag_ptr(_res);
21579         CHECK_ACCESS(_res_ptr);
21580         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
21581         FREE(untag_ptr(_res));
21582         CResult_DescriptionCreationErrorZ_free(_res_conv);
21583 }
21584
21585 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
21586         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21587         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
21588         return tag_ptr(ret_conv, true);
21589 }
21590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21591         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
21592         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
21593         return ret_conv;
21594 }
21595
21596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21597         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
21598         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
21599         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
21600         return tag_ptr(ret_conv, true);
21601 }
21602
21603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21604         LDKPrivateRoute o_conv;
21605         o_conv.inner = untag_ptr(o);
21606         o_conv.is_owned = ptr_is_owned(o);
21607         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21608         o_conv = PrivateRoute_clone(&o_conv);
21609         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21610         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
21611         return tag_ptr(ret_conv, true);
21612 }
21613
21614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21615         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
21616         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21617         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
21618         return tag_ptr(ret_conv, true);
21619 }
21620
21621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21622         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
21623         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
21624         return ret_conv;
21625 }
21626
21627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21628         if (!ptr_is_owned(_res)) return;
21629         void* _res_ptr = untag_ptr(_res);
21630         CHECK_ACCESS(_res_ptr);
21631         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
21632         FREE(untag_ptr(_res));
21633         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
21634 }
21635
21636 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
21637         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21638         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
21639         return tag_ptr(ret_conv, true);
21640 }
21641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21642         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
21643         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
21644         return ret_conv;
21645 }
21646
21647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21648         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
21649         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
21650         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
21651         return tag_ptr(ret_conv, true);
21652 }
21653
21654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
21655         LDKStr o_conv = java_to_owned_str(env, o);
21656         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21657         *ret_conv = CResult_StringErrorZ_ok(o_conv);
21658         return tag_ptr(ret_conv, true);
21659 }
21660
21661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
21662         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
21663         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21664         *ret_conv = CResult_StringErrorZ_err(e_conv);
21665         return tag_ptr(ret_conv, true);
21666 }
21667
21668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21669         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
21670         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
21671         return ret_conv;
21672 }
21673
21674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21675         if (!ptr_is_owned(_res)) return;
21676         void* _res_ptr = untag_ptr(_res);
21677         CHECK_ACCESS(_res_ptr);
21678         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
21679         FREE(untag_ptr(_res));
21680         CResult_StringErrorZ_free(_res_conv);
21681 }
21682
21683 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
21684         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21685         *ret_conv = CResult_StringErrorZ_clone(arg);
21686         return tag_ptr(ret_conv, true);
21687 }
21688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21689         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
21690         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
21691         return ret_conv;
21692 }
21693
21694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21695         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
21696         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21697         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
21698         return tag_ptr(ret_conv, true);
21699 }
21700
21701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21702         LDKChannelMonitorUpdate o_conv;
21703         o_conv.inner = untag_ptr(o);
21704         o_conv.is_owned = ptr_is_owned(o);
21705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21706         o_conv = ChannelMonitorUpdate_clone(&o_conv);
21707         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21708         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
21709         return tag_ptr(ret_conv, true);
21710 }
21711
21712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21713         LDKDecodeError e_conv;
21714         e_conv.inner = untag_ptr(e);
21715         e_conv.is_owned = ptr_is_owned(e);
21716         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21717         e_conv = DecodeError_clone(&e_conv);
21718         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21719         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
21720         return tag_ptr(ret_conv, true);
21721 }
21722
21723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21724         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
21725         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
21726         return ret_conv;
21727 }
21728
21729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21730         if (!ptr_is_owned(_res)) return;
21731         void* _res_ptr = untag_ptr(_res);
21732         CHECK_ACCESS(_res_ptr);
21733         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
21734         FREE(untag_ptr(_res));
21735         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
21736 }
21737
21738 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
21739         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21740         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
21741         return tag_ptr(ret_conv, true);
21742 }
21743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21744         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
21745         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
21746         return ret_conv;
21747 }
21748
21749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21750         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
21751         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
21752         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
21753         return tag_ptr(ret_conv, true);
21754 }
21755
21756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21757         void* o_ptr = untag_ptr(o);
21758         CHECK_ACCESS(o_ptr);
21759         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
21760         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
21761         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21762         *ret_copy = COption_MonitorEventZ_some(o_conv);
21763         int64_t ret_ref = tag_ptr(ret_copy, true);
21764         return ret_ref;
21765 }
21766
21767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
21768         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21769         *ret_copy = COption_MonitorEventZ_none();
21770         int64_t ret_ref = tag_ptr(ret_copy, true);
21771         return ret_ref;
21772 }
21773
21774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21775         if (!ptr_is_owned(_res)) return;
21776         void* _res_ptr = untag_ptr(_res);
21777         CHECK_ACCESS(_res_ptr);
21778         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
21779         FREE(untag_ptr(_res));
21780         COption_MonitorEventZ_free(_res_conv);
21781 }
21782
21783 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
21784         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21785         *ret_copy = COption_MonitorEventZ_clone(arg);
21786         int64_t ret_ref = tag_ptr(ret_copy, true);
21787         return ret_ref;
21788 }
21789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21790         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
21791         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
21792         return ret_conv;
21793 }
21794
21795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21796         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
21797         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
21798         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
21799         int64_t ret_ref = tag_ptr(ret_copy, true);
21800         return ret_ref;
21801 }
21802
21803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21804         void* o_ptr = untag_ptr(o);
21805         CHECK_ACCESS(o_ptr);
21806         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
21807         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
21808         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21809         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
21810         return tag_ptr(ret_conv, true);
21811 }
21812
21813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21814         LDKDecodeError e_conv;
21815         e_conv.inner = untag_ptr(e);
21816         e_conv.is_owned = ptr_is_owned(e);
21817         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21818         e_conv = DecodeError_clone(&e_conv);
21819         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21820         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
21821         return tag_ptr(ret_conv, true);
21822 }
21823
21824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21825         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
21826         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
21827         return ret_conv;
21828 }
21829
21830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21831         if (!ptr_is_owned(_res)) return;
21832         void* _res_ptr = untag_ptr(_res);
21833         CHECK_ACCESS(_res_ptr);
21834         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
21835         FREE(untag_ptr(_res));
21836         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
21837 }
21838
21839 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
21840         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21841         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
21842         return tag_ptr(ret_conv, true);
21843 }
21844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21845         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
21846         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
21847         return ret_conv;
21848 }
21849
21850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21851         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
21852         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
21853         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
21854         return tag_ptr(ret_conv, true);
21855 }
21856
21857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21858         LDKHTLCUpdate o_conv;
21859         o_conv.inner = untag_ptr(o);
21860         o_conv.is_owned = ptr_is_owned(o);
21861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21862         o_conv = HTLCUpdate_clone(&o_conv);
21863         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21864         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
21865         return tag_ptr(ret_conv, true);
21866 }
21867
21868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21869         LDKDecodeError e_conv;
21870         e_conv.inner = untag_ptr(e);
21871         e_conv.is_owned = ptr_is_owned(e);
21872         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21873         e_conv = DecodeError_clone(&e_conv);
21874         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21875         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
21876         return tag_ptr(ret_conv, true);
21877 }
21878
21879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21880         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
21881         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
21882         return ret_conv;
21883 }
21884
21885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21886         if (!ptr_is_owned(_res)) return;
21887         void* _res_ptr = untag_ptr(_res);
21888         CHECK_ACCESS(_res_ptr);
21889         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
21890         FREE(untag_ptr(_res));
21891         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
21892 }
21893
21894 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
21895         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21896         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
21897         return tag_ptr(ret_conv, true);
21898 }
21899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21900         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
21901         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
21902         return ret_conv;
21903 }
21904
21905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21906         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
21907         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
21908         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
21909         return tag_ptr(ret_conv, true);
21910 }
21911
21912 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
21913         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21914         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
21915         return tag_ptr(ret_conv, true);
21916 }
21917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21918         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
21919         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
21920         return ret_conv;
21921 }
21922
21923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21924         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
21925         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21926         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
21927         return tag_ptr(ret_conv, true);
21928 }
21929
21930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
21931         LDKOutPoint a_conv;
21932         a_conv.inner = untag_ptr(a);
21933         a_conv.is_owned = ptr_is_owned(a);
21934         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21935         a_conv = OutPoint_clone(&a_conv);
21936         LDKCVec_u8Z b_ref;
21937         b_ref.datalen = (*env)->GetArrayLength(env, b);
21938         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21939         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21940         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
21941         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
21942         return tag_ptr(ret_conv, true);
21943 }
21944
21945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21946         if (!ptr_is_owned(_res)) return;
21947         void* _res_ptr = untag_ptr(_res);
21948         CHECK_ACCESS(_res_ptr);
21949         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
21950         FREE(untag_ptr(_res));
21951         C2Tuple_OutPointScriptZ_free(_res_conv);
21952 }
21953
21954 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
21955         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21956         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
21957         return tag_ptr(ret_conv, true);
21958 }
21959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21960         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
21961         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
21962         return ret_conv;
21963 }
21964
21965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21966         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
21967         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21968         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
21969         return tag_ptr(ret_conv, true);
21970 }
21971
21972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
21973         LDKCVec_u8Z b_ref;
21974         b_ref.datalen = (*env)->GetArrayLength(env, b);
21975         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
21976         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
21977         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
21978         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
21979         return tag_ptr(ret_conv, true);
21980 }
21981
21982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21983         if (!ptr_is_owned(_res)) return;
21984         void* _res_ptr = untag_ptr(_res);
21985         CHECK_ACCESS(_res_ptr);
21986         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
21987         FREE(untag_ptr(_res));
21988         C2Tuple_u32ScriptZ_free(_res_conv);
21989 }
21990
21991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21992         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
21993         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21994         if (_res_constr.datalen > 0)
21995                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
21996         else
21997                 _res_constr.data = NULL;
21998         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21999         for (size_t v = 0; v < _res_constr.datalen; v++) {
22000                 int64_t _res_conv_21 = _res_vals[v];
22001                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
22002                 CHECK_ACCESS(_res_conv_21_ptr);
22003                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
22004                 FREE(untag_ptr(_res_conv_21));
22005                 _res_constr.data[v] = _res_conv_21_conv;
22006         }
22007         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22008         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
22009 }
22010
22011 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
22012         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22013         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
22014         return tag_ptr(ret_conv, true);
22015 }
22016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22017         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
22018         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
22019         return ret_conv;
22020 }
22021
22022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22023         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
22024         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22025         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
22026         return tag_ptr(ret_conv, true);
22027 }
22028
22029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
22030         LDKThirtyTwoBytes a_ref;
22031         CHECK((*env)->GetArrayLength(env, a) == 32);
22032         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22033         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
22034         b_constr.datalen = (*env)->GetArrayLength(env, b);
22035         if (b_constr.datalen > 0)
22036                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
22037         else
22038                 b_constr.data = NULL;
22039         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
22040         for (size_t v = 0; v < b_constr.datalen; v++) {
22041                 int64_t b_conv_21 = b_vals[v];
22042                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
22043                 CHECK_ACCESS(b_conv_21_ptr);
22044                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
22045                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
22046                 b_constr.data[v] = b_conv_21_conv;
22047         }
22048         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
22049         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22050         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
22051         return tag_ptr(ret_conv, true);
22052 }
22053
22054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22055         if (!ptr_is_owned(_res)) return;
22056         void* _res_ptr = untag_ptr(_res);
22057         CHECK_ACCESS(_res_ptr);
22058         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
22059         FREE(untag_ptr(_res));
22060         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
22061 }
22062
22063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22064         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
22065         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22066         if (_res_constr.datalen > 0)
22067                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
22068         else
22069                 _res_constr.data = NULL;
22070         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22071         for (size_t o = 0; o < _res_constr.datalen; o++) {
22072                 int64_t _res_conv_40 = _res_vals[o];
22073                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22074                 CHECK_ACCESS(_res_conv_40_ptr);
22075                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
22076                 FREE(untag_ptr(_res_conv_40));
22077                 _res_constr.data[o] = _res_conv_40_conv;
22078         }
22079         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22080         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
22081 }
22082
22083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22084         LDKCVec_EventZ _res_constr;
22085         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22086         if (_res_constr.datalen > 0)
22087                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
22088         else
22089                 _res_constr.data = NULL;
22090         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22091         for (size_t h = 0; h < _res_constr.datalen; h++) {
22092                 int64_t _res_conv_7 = _res_vals[h];
22093                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
22094                 CHECK_ACCESS(_res_conv_7_ptr);
22095                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
22096                 FREE(untag_ptr(_res_conv_7));
22097                 _res_constr.data[h] = _res_conv_7_conv;
22098         }
22099         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22100         CVec_EventZ_free(_res_constr);
22101 }
22102
22103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22104         LDKCVec_TransactionZ _res_constr;
22105         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22106         if (_res_constr.datalen > 0)
22107                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
22108         else
22109                 _res_constr.data = NULL;
22110         for (size_t i = 0; i < _res_constr.datalen; i++) {
22111                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22112                 LDKTransaction _res_conv_8_ref;
22113                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
22114                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
22115                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
22116                 _res_conv_8_ref.data_is_owned = true;
22117                 _res_constr.data[i] = _res_conv_8_ref;
22118         }
22119         CVec_TransactionZ_free(_res_constr);
22120 }
22121
22122 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
22123         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22124         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
22125         return tag_ptr(ret_conv, true);
22126 }
22127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22128         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
22129         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
22130         return ret_conv;
22131 }
22132
22133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22134         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
22135         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22136         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
22137         return tag_ptr(ret_conv, true);
22138 }
22139
22140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
22141         void* b_ptr = untag_ptr(b);
22142         CHECK_ACCESS(b_ptr);
22143         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
22144         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
22145         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22146         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
22147         return tag_ptr(ret_conv, true);
22148 }
22149
22150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22151         if (!ptr_is_owned(_res)) return;
22152         void* _res_ptr = untag_ptr(_res);
22153         CHECK_ACCESS(_res_ptr);
22154         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
22155         FREE(untag_ptr(_res));
22156         C2Tuple_u32TxOutZ_free(_res_conv);
22157 }
22158
22159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22160         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
22161         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22162         if (_res_constr.datalen > 0)
22163                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22164         else
22165                 _res_constr.data = NULL;
22166         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22167         for (size_t u = 0; u < _res_constr.datalen; u++) {
22168                 int64_t _res_conv_20 = _res_vals[u];
22169                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
22170                 CHECK_ACCESS(_res_conv_20_ptr);
22171                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
22172                 FREE(untag_ptr(_res_conv_20));
22173                 _res_constr.data[u] = _res_conv_20_conv;
22174         }
22175         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22176         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
22177 }
22178
22179 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
22180         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22181         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
22182         return tag_ptr(ret_conv, true);
22183 }
22184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22185         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
22186         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
22187         return ret_conv;
22188 }
22189
22190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22191         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
22192         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22193         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
22194         return tag_ptr(ret_conv, true);
22195 }
22196
22197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
22198         LDKThirtyTwoBytes a_ref;
22199         CHECK((*env)->GetArrayLength(env, a) == 32);
22200         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22201         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
22202         b_constr.datalen = (*env)->GetArrayLength(env, b);
22203         if (b_constr.datalen > 0)
22204                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22205         else
22206                 b_constr.data = NULL;
22207         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
22208         for (size_t u = 0; u < b_constr.datalen; u++) {
22209                 int64_t b_conv_20 = b_vals[u];
22210                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
22211                 CHECK_ACCESS(b_conv_20_ptr);
22212                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
22213                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
22214                 b_constr.data[u] = b_conv_20_conv;
22215         }
22216         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
22217         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22218         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
22219         return tag_ptr(ret_conv, true);
22220 }
22221
22222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22223         if (!ptr_is_owned(_res)) return;
22224         void* _res_ptr = untag_ptr(_res);
22225         CHECK_ACCESS(_res_ptr);
22226         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
22227         FREE(untag_ptr(_res));
22228         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
22229 }
22230
22231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22232         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
22233         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22234         if (_res_constr.datalen > 0)
22235                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
22236         else
22237                 _res_constr.data = NULL;
22238         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22239         for (size_t n = 0; n < _res_constr.datalen; n++) {
22240                 int64_t _res_conv_39 = _res_vals[n];
22241                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
22242                 CHECK_ACCESS(_res_conv_39_ptr);
22243                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
22244                 FREE(untag_ptr(_res_conv_39));
22245                 _res_constr.data[n] = _res_conv_39_conv;
22246         }
22247         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22248         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
22249 }
22250
22251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22252         LDKCVec_BalanceZ _res_constr;
22253         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22254         if (_res_constr.datalen > 0)
22255                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
22256         else
22257                 _res_constr.data = NULL;
22258         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22259         for (size_t j = 0; j < _res_constr.datalen; j++) {
22260                 int64_t _res_conv_9 = _res_vals[j];
22261                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
22262                 CHECK_ACCESS(_res_conv_9_ptr);
22263                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
22264                 FREE(untag_ptr(_res_conv_9));
22265                 _res_constr.data[j] = _res_conv_9_conv;
22266         }
22267         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22268         CVec_BalanceZ_free(_res_constr);
22269 }
22270
22271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22272         void* o_ptr = untag_ptr(o);
22273         CHECK_ACCESS(o_ptr);
22274         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
22275         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
22276         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22277         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
22278         return tag_ptr(ret_conv, true);
22279 }
22280
22281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22282         LDKDecodeError e_conv;
22283         e_conv.inner = untag_ptr(e);
22284         e_conv.is_owned = ptr_is_owned(e);
22285         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22286         e_conv = DecodeError_clone(&e_conv);
22287         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22288         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
22289         return tag_ptr(ret_conv, true);
22290 }
22291
22292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22293         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
22294         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
22295         return ret_conv;
22296 }
22297
22298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22299         if (!ptr_is_owned(_res)) return;
22300         void* _res_ptr = untag_ptr(_res);
22301         CHECK_ACCESS(_res_ptr);
22302         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
22303         FREE(untag_ptr(_res));
22304         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
22305 }
22306
22307 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
22308         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22309         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
22310         return tag_ptr(ret_conv, true);
22311 }
22312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22313         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
22314         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
22315         return ret_conv;
22316 }
22317
22318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22319         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
22320         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22321         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
22322         return tag_ptr(ret_conv, true);
22323 }
22324
22325 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
22326         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22327         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
22328         return tag_ptr(ret_conv, true);
22329 }
22330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22331         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
22332         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
22333         return ret_conv;
22334 }
22335
22336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22337         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
22338         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22339         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
22340         return tag_ptr(ret_conv, true);
22341 }
22342
22343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
22344         LDKPublicKey a_ref;
22345         CHECK((*env)->GetArrayLength(env, a) == 33);
22346         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
22347         void* b_ptr = untag_ptr(b);
22348         CHECK_ACCESS(b_ptr);
22349         LDKType b_conv = *(LDKType*)(b_ptr);
22350         if (b_conv.free == LDKType_JCalls_free) {
22351                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22352                 LDKType_JCalls_cloned(&b_conv);
22353         }
22354         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22355         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
22356         return tag_ptr(ret_conv, true);
22357 }
22358
22359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22360         if (!ptr_is_owned(_res)) return;
22361         void* _res_ptr = untag_ptr(_res);
22362         CHECK_ACCESS(_res_ptr);
22363         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
22364         FREE(untag_ptr(_res));
22365         C2Tuple_PublicKeyTypeZ_free(_res_conv);
22366 }
22367
22368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22369         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
22370         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22371         if (_res_constr.datalen > 0)
22372                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22373         else
22374                 _res_constr.data = NULL;
22375         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22376         for (size_t z = 0; z < _res_constr.datalen; z++) {
22377                 int64_t _res_conv_25 = _res_vals[z];
22378                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
22379                 CHECK_ACCESS(_res_conv_25_ptr);
22380                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
22381                 FREE(untag_ptr(_res_conv_25));
22382                 _res_constr.data[z] = _res_conv_25_conv;
22383         }
22384         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22385         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
22386 }
22387
22388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22389         void* o_ptr = untag_ptr(o);
22390         CHECK_ACCESS(o_ptr);
22391         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
22392         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
22393         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
22394         *ret_copy = COption_NetAddressZ_some(o_conv);
22395         int64_t ret_ref = tag_ptr(ret_copy, true);
22396         return ret_ref;
22397 }
22398
22399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
22400         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
22401         *ret_copy = COption_NetAddressZ_none();
22402         int64_t ret_ref = tag_ptr(ret_copy, true);
22403         return ret_ref;
22404 }
22405
22406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_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         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
22411         FREE(untag_ptr(_res));
22412         COption_NetAddressZ_free(_res_conv);
22413 }
22414
22415 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
22416         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
22417         *ret_copy = COption_NetAddressZ_clone(arg);
22418         int64_t ret_ref = tag_ptr(ret_copy, true);
22419         return ret_ref;
22420 }
22421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22422         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
22423         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
22424         return ret_conv;
22425 }
22426
22427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22428         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
22429         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
22430         *ret_copy = COption_NetAddressZ_clone(orig_conv);
22431         int64_t ret_ref = tag_ptr(ret_copy, true);
22432         return ret_ref;
22433 }
22434
22435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22436         LDKCVec_u8Z o_ref;
22437         o_ref.datalen = (*env)->GetArrayLength(env, o);
22438         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
22439         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
22440         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22441         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
22442         return tag_ptr(ret_conv, true);
22443 }
22444
22445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22446         LDKPeerHandleError e_conv;
22447         e_conv.inner = untag_ptr(e);
22448         e_conv.is_owned = ptr_is_owned(e);
22449         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22450         e_conv = PeerHandleError_clone(&e_conv);
22451         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22452         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
22453         return tag_ptr(ret_conv, true);
22454 }
22455
22456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22457         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
22458         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
22459         return ret_conv;
22460 }
22461
22462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22463         if (!ptr_is_owned(_res)) return;
22464         void* _res_ptr = untag_ptr(_res);
22465         CHECK_ACCESS(_res_ptr);
22466         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
22467         FREE(untag_ptr(_res));
22468         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
22469 }
22470
22471 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
22472         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22473         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
22474         return tag_ptr(ret_conv, true);
22475 }
22476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22477         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
22478         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
22479         return ret_conv;
22480 }
22481
22482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22483         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
22484         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22485         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
22486         return tag_ptr(ret_conv, true);
22487 }
22488
22489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
22490         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22491         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
22492         return tag_ptr(ret_conv, true);
22493 }
22494
22495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22496         LDKPeerHandleError e_conv;
22497         e_conv.inner = untag_ptr(e);
22498         e_conv.is_owned = ptr_is_owned(e);
22499         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22500         e_conv = PeerHandleError_clone(&e_conv);
22501         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22502         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
22503         return tag_ptr(ret_conv, true);
22504 }
22505
22506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22507         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
22508         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
22509         return ret_conv;
22510 }
22511
22512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22513         if (!ptr_is_owned(_res)) return;
22514         void* _res_ptr = untag_ptr(_res);
22515         CHECK_ACCESS(_res_ptr);
22516         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
22517         FREE(untag_ptr(_res));
22518         CResult_NonePeerHandleErrorZ_free(_res_conv);
22519 }
22520
22521 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
22522         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22523         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
22524         return tag_ptr(ret_conv, true);
22525 }
22526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22527         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
22528         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
22529         return ret_conv;
22530 }
22531
22532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22533         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
22534         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22535         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
22536         return tag_ptr(ret_conv, true);
22537 }
22538
22539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
22540         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22541         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
22542         return tag_ptr(ret_conv, true);
22543 }
22544
22545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22546         LDKPeerHandleError e_conv;
22547         e_conv.inner = untag_ptr(e);
22548         e_conv.is_owned = ptr_is_owned(e);
22549         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22550         e_conv = PeerHandleError_clone(&e_conv);
22551         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22552         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
22553         return tag_ptr(ret_conv, true);
22554 }
22555
22556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22557         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
22558         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
22559         return ret_conv;
22560 }
22561
22562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22563         if (!ptr_is_owned(_res)) return;
22564         void* _res_ptr = untag_ptr(_res);
22565         CHECK_ACCESS(_res_ptr);
22566         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
22567         FREE(untag_ptr(_res));
22568         CResult_boolPeerHandleErrorZ_free(_res_conv);
22569 }
22570
22571 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
22572         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22573         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
22574         return tag_ptr(ret_conv, true);
22575 }
22576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22577         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
22578         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
22579         return ret_conv;
22580 }
22581
22582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22583         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
22584         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22585         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
22586         return tag_ptr(ret_conv, true);
22587 }
22588
22589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
22590         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
22591         *ret_conv = CResult_NoneSendErrorZ_ok();
22592         return tag_ptr(ret_conv, true);
22593 }
22594
22595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22596         void* e_ptr = untag_ptr(e);
22597         CHECK_ACCESS(e_ptr);
22598         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
22599         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
22600         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
22601         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
22602         return tag_ptr(ret_conv, true);
22603 }
22604
22605 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22606         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
22607         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
22608         return ret_conv;
22609 }
22610
22611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22612         if (!ptr_is_owned(_res)) return;
22613         void* _res_ptr = untag_ptr(_res);
22614         CHECK_ACCESS(_res_ptr);
22615         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
22616         FREE(untag_ptr(_res));
22617         CResult_NoneSendErrorZ_free(_res_conv);
22618 }
22619
22620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
22621         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22622         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
22623         return tag_ptr(ret_conv, true);
22624 }
22625
22626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22627         void* e_ptr = untag_ptr(e);
22628         CHECK_ACCESS(e_ptr);
22629         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
22630         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
22631         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
22632         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
22633         return tag_ptr(ret_conv, true);
22634 }
22635
22636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22637         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
22638         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
22639         return ret_conv;
22640 }
22641
22642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22643         if (!ptr_is_owned(_res)) return;
22644         void* _res_ptr = untag_ptr(_res);
22645         CHECK_ACCESS(_res_ptr);
22646         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
22647         FREE(untag_ptr(_res));
22648         CResult_u32GraphSyncErrorZ_free(_res_conv);
22649 }
22650
22651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22652         void* o_ptr = untag_ptr(o);
22653         CHECK_ACCESS(o_ptr);
22654         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
22655         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
22656         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22657         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
22658         return tag_ptr(ret_conv, true);
22659 }
22660
22661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22662         LDKDecodeError e_conv;
22663         e_conv.inner = untag_ptr(e);
22664         e_conv.is_owned = ptr_is_owned(e);
22665         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22666         e_conv = DecodeError_clone(&e_conv);
22667         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22668         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
22669         return tag_ptr(ret_conv, true);
22670 }
22671
22672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22673         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
22674         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
22675         return ret_conv;
22676 }
22677
22678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22679         if (!ptr_is_owned(_res)) return;
22680         void* _res_ptr = untag_ptr(_res);
22681         CHECK_ACCESS(_res_ptr);
22682         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
22683         FREE(untag_ptr(_res));
22684         CResult_NetAddressDecodeErrorZ_free(_res_conv);
22685 }
22686
22687 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
22688         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22689         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
22690         return tag_ptr(ret_conv, true);
22691 }
22692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22693         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
22694         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
22695         return ret_conv;
22696 }
22697
22698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22699         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
22700         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
22701         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
22702         return tag_ptr(ret_conv, true);
22703 }
22704
22705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22706         LDKCVec_UpdateAddHTLCZ _res_constr;
22707         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22708         if (_res_constr.datalen > 0)
22709                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
22710         else
22711                 _res_constr.data = NULL;
22712         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22713         for (size_t p = 0; p < _res_constr.datalen; p++) {
22714                 int64_t _res_conv_15 = _res_vals[p];
22715                 LDKUpdateAddHTLC _res_conv_15_conv;
22716                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
22717                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
22718                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
22719                 _res_constr.data[p] = _res_conv_15_conv;
22720         }
22721         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22722         CVec_UpdateAddHTLCZ_free(_res_constr);
22723 }
22724
22725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22726         LDKCVec_UpdateFulfillHTLCZ _res_constr;
22727         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22728         if (_res_constr.datalen > 0)
22729                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
22730         else
22731                 _res_constr.data = NULL;
22732         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22733         for (size_t t = 0; t < _res_constr.datalen; t++) {
22734                 int64_t _res_conv_19 = _res_vals[t];
22735                 LDKUpdateFulfillHTLC _res_conv_19_conv;
22736                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
22737                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
22738                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22739                 _res_constr.data[t] = _res_conv_19_conv;
22740         }
22741         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22742         CVec_UpdateFulfillHTLCZ_free(_res_constr);
22743 }
22744
22745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22746         LDKCVec_UpdateFailHTLCZ _res_constr;
22747         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22748         if (_res_constr.datalen > 0)
22749                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
22750         else
22751                 _res_constr.data = NULL;
22752         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22753         for (size_t q = 0; q < _res_constr.datalen; q++) {
22754                 int64_t _res_conv_16 = _res_vals[q];
22755                 LDKUpdateFailHTLC _res_conv_16_conv;
22756                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
22757                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
22758                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
22759                 _res_constr.data[q] = _res_conv_16_conv;
22760         }
22761         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22762         CVec_UpdateFailHTLCZ_free(_res_constr);
22763 }
22764
22765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22766         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
22767         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22768         if (_res_constr.datalen > 0)
22769                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
22770         else
22771                 _res_constr.data = NULL;
22772         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22773         for (size_t z = 0; z < _res_constr.datalen; z++) {
22774                 int64_t _res_conv_25 = _res_vals[z];
22775                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
22776                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
22777                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
22778                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
22779                 _res_constr.data[z] = _res_conv_25_conv;
22780         }
22781         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22782         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
22783 }
22784
22785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22786         LDKAcceptChannel o_conv;
22787         o_conv.inner = untag_ptr(o);
22788         o_conv.is_owned = ptr_is_owned(o);
22789         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22790         o_conv = AcceptChannel_clone(&o_conv);
22791         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22792         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
22793         return tag_ptr(ret_conv, true);
22794 }
22795
22796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22797         LDKDecodeError e_conv;
22798         e_conv.inner = untag_ptr(e);
22799         e_conv.is_owned = ptr_is_owned(e);
22800         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22801         e_conv = DecodeError_clone(&e_conv);
22802         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22803         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
22804         return tag_ptr(ret_conv, true);
22805 }
22806
22807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22808         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
22809         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
22810         return ret_conv;
22811 }
22812
22813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22814         if (!ptr_is_owned(_res)) return;
22815         void* _res_ptr = untag_ptr(_res);
22816         CHECK_ACCESS(_res_ptr);
22817         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
22818         FREE(untag_ptr(_res));
22819         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
22820 }
22821
22822 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
22823         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22824         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
22825         return tag_ptr(ret_conv, true);
22826 }
22827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22828         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
22829         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
22830         return ret_conv;
22831 }
22832
22833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22834         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
22835         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
22836         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
22837         return tag_ptr(ret_conv, true);
22838 }
22839
22840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22841         LDKAnnouncementSignatures o_conv;
22842         o_conv.inner = untag_ptr(o);
22843         o_conv.is_owned = ptr_is_owned(o);
22844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22845         o_conv = AnnouncementSignatures_clone(&o_conv);
22846         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22847         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
22848         return tag_ptr(ret_conv, true);
22849 }
22850
22851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22852         LDKDecodeError e_conv;
22853         e_conv.inner = untag_ptr(e);
22854         e_conv.is_owned = ptr_is_owned(e);
22855         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22856         e_conv = DecodeError_clone(&e_conv);
22857         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22858         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
22859         return tag_ptr(ret_conv, true);
22860 }
22861
22862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22863         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
22864         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
22865         return ret_conv;
22866 }
22867
22868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22869         if (!ptr_is_owned(_res)) return;
22870         void* _res_ptr = untag_ptr(_res);
22871         CHECK_ACCESS(_res_ptr);
22872         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
22873         FREE(untag_ptr(_res));
22874         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
22875 }
22876
22877 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
22878         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22879         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
22880         return tag_ptr(ret_conv, true);
22881 }
22882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22883         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
22884         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
22885         return ret_conv;
22886 }
22887
22888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22889         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
22890         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
22891         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
22892         return tag_ptr(ret_conv, true);
22893 }
22894
22895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22896         LDKChannelReestablish o_conv;
22897         o_conv.inner = untag_ptr(o);
22898         o_conv.is_owned = ptr_is_owned(o);
22899         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22900         o_conv = ChannelReestablish_clone(&o_conv);
22901         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22902         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
22903         return tag_ptr(ret_conv, true);
22904 }
22905
22906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22907         LDKDecodeError e_conv;
22908         e_conv.inner = untag_ptr(e);
22909         e_conv.is_owned = ptr_is_owned(e);
22910         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22911         e_conv = DecodeError_clone(&e_conv);
22912         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22913         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
22914         return tag_ptr(ret_conv, true);
22915 }
22916
22917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22918         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
22919         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
22920         return ret_conv;
22921 }
22922
22923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22924         if (!ptr_is_owned(_res)) return;
22925         void* _res_ptr = untag_ptr(_res);
22926         CHECK_ACCESS(_res_ptr);
22927         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
22928         FREE(untag_ptr(_res));
22929         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
22930 }
22931
22932 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
22933         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22934         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
22935         return tag_ptr(ret_conv, true);
22936 }
22937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22938         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
22939         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
22940         return ret_conv;
22941 }
22942
22943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22944         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
22945         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
22946         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
22947         return tag_ptr(ret_conv, true);
22948 }
22949
22950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22951         LDKClosingSigned o_conv;
22952         o_conv.inner = untag_ptr(o);
22953         o_conv.is_owned = ptr_is_owned(o);
22954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22955         o_conv = ClosingSigned_clone(&o_conv);
22956         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22957         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
22958         return tag_ptr(ret_conv, true);
22959 }
22960
22961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22962         LDKDecodeError e_conv;
22963         e_conv.inner = untag_ptr(e);
22964         e_conv.is_owned = ptr_is_owned(e);
22965         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22966         e_conv = DecodeError_clone(&e_conv);
22967         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22968         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
22969         return tag_ptr(ret_conv, true);
22970 }
22971
22972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22973         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
22974         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
22975         return ret_conv;
22976 }
22977
22978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22979         if (!ptr_is_owned(_res)) return;
22980         void* _res_ptr = untag_ptr(_res);
22981         CHECK_ACCESS(_res_ptr);
22982         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
22983         FREE(untag_ptr(_res));
22984         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
22985 }
22986
22987 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
22988         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
22989         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
22990         return tag_ptr(ret_conv, true);
22991 }
22992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22993         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
22994         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
22995         return ret_conv;
22996 }
22997
22998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22999         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
23000         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23001         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
23002         return tag_ptr(ret_conv, true);
23003 }
23004
23005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23006         LDKClosingSignedFeeRange o_conv;
23007         o_conv.inner = untag_ptr(o);
23008         o_conv.is_owned = ptr_is_owned(o);
23009         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23010         o_conv = ClosingSignedFeeRange_clone(&o_conv);
23011         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23012         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
23013         return tag_ptr(ret_conv, true);
23014 }
23015
23016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23017         LDKDecodeError e_conv;
23018         e_conv.inner = untag_ptr(e);
23019         e_conv.is_owned = ptr_is_owned(e);
23020         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23021         e_conv = DecodeError_clone(&e_conv);
23022         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23023         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
23024         return tag_ptr(ret_conv, true);
23025 }
23026
23027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23028         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
23029         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
23030         return ret_conv;
23031 }
23032
23033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23034         if (!ptr_is_owned(_res)) return;
23035         void* _res_ptr = untag_ptr(_res);
23036         CHECK_ACCESS(_res_ptr);
23037         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
23038         FREE(untag_ptr(_res));
23039         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
23040 }
23041
23042 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
23043         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23044         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
23045         return tag_ptr(ret_conv, true);
23046 }
23047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23048         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
23049         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
23050         return ret_conv;
23051 }
23052
23053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23054         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
23055         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23056         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
23057         return tag_ptr(ret_conv, true);
23058 }
23059
23060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23061         LDKCommitmentSigned o_conv;
23062         o_conv.inner = untag_ptr(o);
23063         o_conv.is_owned = ptr_is_owned(o);
23064         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23065         o_conv = CommitmentSigned_clone(&o_conv);
23066         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23067         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
23068         return tag_ptr(ret_conv, true);
23069 }
23070
23071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23072         LDKDecodeError e_conv;
23073         e_conv.inner = untag_ptr(e);
23074         e_conv.is_owned = ptr_is_owned(e);
23075         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23076         e_conv = DecodeError_clone(&e_conv);
23077         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23078         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
23079         return tag_ptr(ret_conv, true);
23080 }
23081
23082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23083         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
23084         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
23085         return ret_conv;
23086 }
23087
23088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23089         if (!ptr_is_owned(_res)) return;
23090         void* _res_ptr = untag_ptr(_res);
23091         CHECK_ACCESS(_res_ptr);
23092         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
23093         FREE(untag_ptr(_res));
23094         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
23095 }
23096
23097 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
23098         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23099         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
23100         return tag_ptr(ret_conv, true);
23101 }
23102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23103         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
23104         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
23105         return ret_conv;
23106 }
23107
23108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23109         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
23110         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23111         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
23112         return tag_ptr(ret_conv, true);
23113 }
23114
23115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23116         LDKFundingCreated o_conv;
23117         o_conv.inner = untag_ptr(o);
23118         o_conv.is_owned = ptr_is_owned(o);
23119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23120         o_conv = FundingCreated_clone(&o_conv);
23121         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
23122         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
23123         return tag_ptr(ret_conv, true);
23124 }
23125
23126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23127         LDKDecodeError e_conv;
23128         e_conv.inner = untag_ptr(e);
23129         e_conv.is_owned = ptr_is_owned(e);
23130         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23131         e_conv = DecodeError_clone(&e_conv);
23132         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
23133         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
23134         return tag_ptr(ret_conv, true);
23135 }
23136
23137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23138         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
23139         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
23140         return ret_conv;
23141 }
23142
23143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23144         if (!ptr_is_owned(_res)) return;
23145         void* _res_ptr = untag_ptr(_res);
23146         CHECK_ACCESS(_res_ptr);
23147         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
23148         FREE(untag_ptr(_res));
23149         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
23150 }
23151
23152 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
23153         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
23154         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
23155         return tag_ptr(ret_conv, true);
23156 }
23157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23158         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
23159         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
23160         return ret_conv;
23161 }
23162
23163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23164         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
23165         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
23166         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
23167         return tag_ptr(ret_conv, true);
23168 }
23169
23170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23171         LDKFundingSigned o_conv;
23172         o_conv.inner = untag_ptr(o);
23173         o_conv.is_owned = ptr_is_owned(o);
23174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23175         o_conv = FundingSigned_clone(&o_conv);
23176         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
23177         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
23178         return tag_ptr(ret_conv, true);
23179 }
23180
23181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23182         LDKDecodeError e_conv;
23183         e_conv.inner = untag_ptr(e);
23184         e_conv.is_owned = ptr_is_owned(e);
23185         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23186         e_conv = DecodeError_clone(&e_conv);
23187         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
23188         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
23189         return tag_ptr(ret_conv, true);
23190 }
23191
23192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23193         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
23194         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
23195         return ret_conv;
23196 }
23197
23198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23199         if (!ptr_is_owned(_res)) return;
23200         void* _res_ptr = untag_ptr(_res);
23201         CHECK_ACCESS(_res_ptr);
23202         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
23203         FREE(untag_ptr(_res));
23204         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
23205 }
23206
23207 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
23208         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
23209         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
23210         return tag_ptr(ret_conv, true);
23211 }
23212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23213         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
23214         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
23215         return ret_conv;
23216 }
23217
23218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23219         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
23220         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
23221         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
23222         return tag_ptr(ret_conv, true);
23223 }
23224
23225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23226         LDKChannelReady o_conv;
23227         o_conv.inner = untag_ptr(o);
23228         o_conv.is_owned = ptr_is_owned(o);
23229         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23230         o_conv = ChannelReady_clone(&o_conv);
23231         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
23232         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
23233         return tag_ptr(ret_conv, true);
23234 }
23235
23236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23237         LDKDecodeError e_conv;
23238         e_conv.inner = untag_ptr(e);
23239         e_conv.is_owned = ptr_is_owned(e);
23240         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23241         e_conv = DecodeError_clone(&e_conv);
23242         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
23243         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
23244         return tag_ptr(ret_conv, true);
23245 }
23246
23247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23248         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
23249         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
23250         return ret_conv;
23251 }
23252
23253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23254         if (!ptr_is_owned(_res)) return;
23255         void* _res_ptr = untag_ptr(_res);
23256         CHECK_ACCESS(_res_ptr);
23257         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
23258         FREE(untag_ptr(_res));
23259         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
23260 }
23261
23262 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
23263         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
23264         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
23265         return tag_ptr(ret_conv, true);
23266 }
23267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23268         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
23269         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
23270         return ret_conv;
23271 }
23272
23273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23274         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
23275         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
23276         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
23277         return tag_ptr(ret_conv, true);
23278 }
23279
23280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23281         LDKInit o_conv;
23282         o_conv.inner = untag_ptr(o);
23283         o_conv.is_owned = ptr_is_owned(o);
23284         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23285         o_conv = Init_clone(&o_conv);
23286         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
23287         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
23288         return tag_ptr(ret_conv, true);
23289 }
23290
23291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23292         LDKDecodeError e_conv;
23293         e_conv.inner = untag_ptr(e);
23294         e_conv.is_owned = ptr_is_owned(e);
23295         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23296         e_conv = DecodeError_clone(&e_conv);
23297         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
23298         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
23299         return tag_ptr(ret_conv, true);
23300 }
23301
23302 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23303         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
23304         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
23305         return ret_conv;
23306 }
23307
23308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23309         if (!ptr_is_owned(_res)) return;
23310         void* _res_ptr = untag_ptr(_res);
23311         CHECK_ACCESS(_res_ptr);
23312         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
23313         FREE(untag_ptr(_res));
23314         CResult_InitDecodeErrorZ_free(_res_conv);
23315 }
23316
23317 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
23318         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
23319         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
23320         return tag_ptr(ret_conv, true);
23321 }
23322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23323         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
23324         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
23325         return ret_conv;
23326 }
23327
23328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23329         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
23330         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
23331         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
23332         return tag_ptr(ret_conv, true);
23333 }
23334
23335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23336         LDKOpenChannel o_conv;
23337         o_conv.inner = untag_ptr(o);
23338         o_conv.is_owned = ptr_is_owned(o);
23339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23340         o_conv = OpenChannel_clone(&o_conv);
23341         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
23342         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
23343         return tag_ptr(ret_conv, true);
23344 }
23345
23346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23347         LDKDecodeError e_conv;
23348         e_conv.inner = untag_ptr(e);
23349         e_conv.is_owned = ptr_is_owned(e);
23350         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23351         e_conv = DecodeError_clone(&e_conv);
23352         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
23353         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
23354         return tag_ptr(ret_conv, true);
23355 }
23356
23357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23358         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
23359         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
23360         return ret_conv;
23361 }
23362
23363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23364         if (!ptr_is_owned(_res)) return;
23365         void* _res_ptr = untag_ptr(_res);
23366         CHECK_ACCESS(_res_ptr);
23367         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
23368         FREE(untag_ptr(_res));
23369         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
23370 }
23371
23372 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
23373         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
23374         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
23375         return tag_ptr(ret_conv, true);
23376 }
23377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23378         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
23379         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
23380         return ret_conv;
23381 }
23382
23383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23384         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
23385         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
23386         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
23387         return tag_ptr(ret_conv, true);
23388 }
23389
23390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23391         LDKRevokeAndACK o_conv;
23392         o_conv.inner = untag_ptr(o);
23393         o_conv.is_owned = ptr_is_owned(o);
23394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23395         o_conv = RevokeAndACK_clone(&o_conv);
23396         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
23397         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
23398         return tag_ptr(ret_conv, true);
23399 }
23400
23401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23402         LDKDecodeError e_conv;
23403         e_conv.inner = untag_ptr(e);
23404         e_conv.is_owned = ptr_is_owned(e);
23405         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23406         e_conv = DecodeError_clone(&e_conv);
23407         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
23408         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
23409         return tag_ptr(ret_conv, true);
23410 }
23411
23412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23413         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
23414         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
23415         return ret_conv;
23416 }
23417
23418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23419         if (!ptr_is_owned(_res)) return;
23420         void* _res_ptr = untag_ptr(_res);
23421         CHECK_ACCESS(_res_ptr);
23422         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
23423         FREE(untag_ptr(_res));
23424         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
23425 }
23426
23427 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
23428         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
23429         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
23430         return tag_ptr(ret_conv, true);
23431 }
23432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23433         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
23434         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
23435         return ret_conv;
23436 }
23437
23438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23439         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
23440         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
23441         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
23442         return tag_ptr(ret_conv, true);
23443 }
23444
23445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23446         LDKShutdown o_conv;
23447         o_conv.inner = untag_ptr(o);
23448         o_conv.is_owned = ptr_is_owned(o);
23449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23450         o_conv = Shutdown_clone(&o_conv);
23451         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23452         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
23453         return tag_ptr(ret_conv, true);
23454 }
23455
23456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23457         LDKDecodeError e_conv;
23458         e_conv.inner = untag_ptr(e);
23459         e_conv.is_owned = ptr_is_owned(e);
23460         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23461         e_conv = DecodeError_clone(&e_conv);
23462         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23463         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
23464         return tag_ptr(ret_conv, true);
23465 }
23466
23467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23468         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
23469         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
23470         return ret_conv;
23471 }
23472
23473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23474         if (!ptr_is_owned(_res)) return;
23475         void* _res_ptr = untag_ptr(_res);
23476         CHECK_ACCESS(_res_ptr);
23477         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
23478         FREE(untag_ptr(_res));
23479         CResult_ShutdownDecodeErrorZ_free(_res_conv);
23480 }
23481
23482 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
23483         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23484         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
23485         return tag_ptr(ret_conv, true);
23486 }
23487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23488         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
23489         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
23490         return ret_conv;
23491 }
23492
23493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23494         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
23495         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23496         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
23497         return tag_ptr(ret_conv, true);
23498 }
23499
23500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23501         LDKUpdateFailHTLC o_conv;
23502         o_conv.inner = untag_ptr(o);
23503         o_conv.is_owned = ptr_is_owned(o);
23504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23505         o_conv = UpdateFailHTLC_clone(&o_conv);
23506         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23507         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
23508         return tag_ptr(ret_conv, true);
23509 }
23510
23511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23512         LDKDecodeError e_conv;
23513         e_conv.inner = untag_ptr(e);
23514         e_conv.is_owned = ptr_is_owned(e);
23515         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23516         e_conv = DecodeError_clone(&e_conv);
23517         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23518         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
23519         return tag_ptr(ret_conv, true);
23520 }
23521
23522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23523         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
23524         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
23525         return ret_conv;
23526 }
23527
23528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23529         if (!ptr_is_owned(_res)) return;
23530         void* _res_ptr = untag_ptr(_res);
23531         CHECK_ACCESS(_res_ptr);
23532         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
23533         FREE(untag_ptr(_res));
23534         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
23535 }
23536
23537 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
23538         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23539         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
23540         return tag_ptr(ret_conv, true);
23541 }
23542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23543         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
23544         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
23545         return ret_conv;
23546 }
23547
23548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23549         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
23550         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23551         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
23552         return tag_ptr(ret_conv, true);
23553 }
23554
23555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23556         LDKUpdateFailMalformedHTLC o_conv;
23557         o_conv.inner = untag_ptr(o);
23558         o_conv.is_owned = ptr_is_owned(o);
23559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23560         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
23561         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23562         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
23563         return tag_ptr(ret_conv, true);
23564 }
23565
23566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23567         LDKDecodeError e_conv;
23568         e_conv.inner = untag_ptr(e);
23569         e_conv.is_owned = ptr_is_owned(e);
23570         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23571         e_conv = DecodeError_clone(&e_conv);
23572         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23573         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
23574         return tag_ptr(ret_conv, true);
23575 }
23576
23577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23578         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
23579         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
23580         return ret_conv;
23581 }
23582
23583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23584         if (!ptr_is_owned(_res)) return;
23585         void* _res_ptr = untag_ptr(_res);
23586         CHECK_ACCESS(_res_ptr);
23587         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
23588         FREE(untag_ptr(_res));
23589         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
23590 }
23591
23592 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
23593         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23594         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
23595         return tag_ptr(ret_conv, true);
23596 }
23597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23598         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
23599         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
23600         return ret_conv;
23601 }
23602
23603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23604         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
23605         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23606         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
23607         return tag_ptr(ret_conv, true);
23608 }
23609
23610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23611         LDKUpdateFee o_conv;
23612         o_conv.inner = untag_ptr(o);
23613         o_conv.is_owned = ptr_is_owned(o);
23614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23615         o_conv = UpdateFee_clone(&o_conv);
23616         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23617         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
23618         return tag_ptr(ret_conv, true);
23619 }
23620
23621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23622         LDKDecodeError e_conv;
23623         e_conv.inner = untag_ptr(e);
23624         e_conv.is_owned = ptr_is_owned(e);
23625         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23626         e_conv = DecodeError_clone(&e_conv);
23627         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23628         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
23629         return tag_ptr(ret_conv, true);
23630 }
23631
23632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23633         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
23634         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
23635         return ret_conv;
23636 }
23637
23638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23639         if (!ptr_is_owned(_res)) return;
23640         void* _res_ptr = untag_ptr(_res);
23641         CHECK_ACCESS(_res_ptr);
23642         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
23643         FREE(untag_ptr(_res));
23644         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
23645 }
23646
23647 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
23648         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23649         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
23650         return tag_ptr(ret_conv, true);
23651 }
23652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23653         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
23654         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
23655         return ret_conv;
23656 }
23657
23658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23659         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
23660         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23661         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
23662         return tag_ptr(ret_conv, true);
23663 }
23664
23665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23666         LDKUpdateFulfillHTLC o_conv;
23667         o_conv.inner = untag_ptr(o);
23668         o_conv.is_owned = ptr_is_owned(o);
23669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23670         o_conv = UpdateFulfillHTLC_clone(&o_conv);
23671         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23672         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
23673         return tag_ptr(ret_conv, true);
23674 }
23675
23676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23677         LDKDecodeError e_conv;
23678         e_conv.inner = untag_ptr(e);
23679         e_conv.is_owned = ptr_is_owned(e);
23680         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23681         e_conv = DecodeError_clone(&e_conv);
23682         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23683         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
23684         return tag_ptr(ret_conv, true);
23685 }
23686
23687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23688         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
23689         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
23690         return ret_conv;
23691 }
23692
23693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23694         if (!ptr_is_owned(_res)) return;
23695         void* _res_ptr = untag_ptr(_res);
23696         CHECK_ACCESS(_res_ptr);
23697         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
23698         FREE(untag_ptr(_res));
23699         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
23700 }
23701
23702 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
23703         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23704         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
23705         return tag_ptr(ret_conv, true);
23706 }
23707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23708         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
23709         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
23710         return ret_conv;
23711 }
23712
23713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23714         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
23715         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23716         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
23717         return tag_ptr(ret_conv, true);
23718 }
23719
23720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23721         LDKUpdateAddHTLC o_conv;
23722         o_conv.inner = untag_ptr(o);
23723         o_conv.is_owned = ptr_is_owned(o);
23724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23725         o_conv = UpdateAddHTLC_clone(&o_conv);
23726         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23727         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
23728         return tag_ptr(ret_conv, true);
23729 }
23730
23731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23732         LDKDecodeError e_conv;
23733         e_conv.inner = untag_ptr(e);
23734         e_conv.is_owned = ptr_is_owned(e);
23735         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23736         e_conv = DecodeError_clone(&e_conv);
23737         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23738         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
23739         return tag_ptr(ret_conv, true);
23740 }
23741
23742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23743         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
23744         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
23745         return ret_conv;
23746 }
23747
23748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23749         if (!ptr_is_owned(_res)) return;
23750         void* _res_ptr = untag_ptr(_res);
23751         CHECK_ACCESS(_res_ptr);
23752         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
23753         FREE(untag_ptr(_res));
23754         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
23755 }
23756
23757 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
23758         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23759         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
23760         return tag_ptr(ret_conv, true);
23761 }
23762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23763         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
23764         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
23765         return ret_conv;
23766 }
23767
23768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23769         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
23770         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23771         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
23772         return tag_ptr(ret_conv, true);
23773 }
23774
23775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23776         LDKOnionMessage o_conv;
23777         o_conv.inner = untag_ptr(o);
23778         o_conv.is_owned = ptr_is_owned(o);
23779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23780         o_conv = OnionMessage_clone(&o_conv);
23781         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
23782         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
23783         return tag_ptr(ret_conv, true);
23784 }
23785
23786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23787         LDKDecodeError e_conv;
23788         e_conv.inner = untag_ptr(e);
23789         e_conv.is_owned = ptr_is_owned(e);
23790         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23791         e_conv = DecodeError_clone(&e_conv);
23792         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
23793         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
23794         return tag_ptr(ret_conv, true);
23795 }
23796
23797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23798         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
23799         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
23800         return ret_conv;
23801 }
23802
23803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23804         if (!ptr_is_owned(_res)) return;
23805         void* _res_ptr = untag_ptr(_res);
23806         CHECK_ACCESS(_res_ptr);
23807         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
23808         FREE(untag_ptr(_res));
23809         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
23810 }
23811
23812 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
23813         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
23814         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
23815         return tag_ptr(ret_conv, true);
23816 }
23817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23818         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
23819         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
23820         return ret_conv;
23821 }
23822
23823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23824         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
23825         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
23826         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
23827         return tag_ptr(ret_conv, true);
23828 }
23829
23830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23831         LDKPing o_conv;
23832         o_conv.inner = untag_ptr(o);
23833         o_conv.is_owned = ptr_is_owned(o);
23834         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23835         o_conv = Ping_clone(&o_conv);
23836         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23837         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
23838         return tag_ptr(ret_conv, true);
23839 }
23840
23841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23842         LDKDecodeError e_conv;
23843         e_conv.inner = untag_ptr(e);
23844         e_conv.is_owned = ptr_is_owned(e);
23845         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23846         e_conv = DecodeError_clone(&e_conv);
23847         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23848         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
23849         return tag_ptr(ret_conv, true);
23850 }
23851
23852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23853         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
23854         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
23855         return ret_conv;
23856 }
23857
23858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23859         if (!ptr_is_owned(_res)) return;
23860         void* _res_ptr = untag_ptr(_res);
23861         CHECK_ACCESS(_res_ptr);
23862         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
23863         FREE(untag_ptr(_res));
23864         CResult_PingDecodeErrorZ_free(_res_conv);
23865 }
23866
23867 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
23868         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23869         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
23870         return tag_ptr(ret_conv, true);
23871 }
23872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23873         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
23874         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
23875         return ret_conv;
23876 }
23877
23878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23879         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
23880         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23881         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
23882         return tag_ptr(ret_conv, true);
23883 }
23884
23885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23886         LDKPong o_conv;
23887         o_conv.inner = untag_ptr(o);
23888         o_conv.is_owned = ptr_is_owned(o);
23889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23890         o_conv = Pong_clone(&o_conv);
23891         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23892         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
23893         return tag_ptr(ret_conv, true);
23894 }
23895
23896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23897         LDKDecodeError e_conv;
23898         e_conv.inner = untag_ptr(e);
23899         e_conv.is_owned = ptr_is_owned(e);
23900         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23901         e_conv = DecodeError_clone(&e_conv);
23902         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23903         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
23904         return tag_ptr(ret_conv, true);
23905 }
23906
23907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23908         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
23909         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
23910         return ret_conv;
23911 }
23912
23913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23914         if (!ptr_is_owned(_res)) return;
23915         void* _res_ptr = untag_ptr(_res);
23916         CHECK_ACCESS(_res_ptr);
23917         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
23918         FREE(untag_ptr(_res));
23919         CResult_PongDecodeErrorZ_free(_res_conv);
23920 }
23921
23922 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
23923         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23924         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
23925         return tag_ptr(ret_conv, true);
23926 }
23927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23928         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
23929         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
23930         return ret_conv;
23931 }
23932
23933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23934         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
23935         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23936         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
23937         return tag_ptr(ret_conv, true);
23938 }
23939
23940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23941         LDKUnsignedChannelAnnouncement o_conv;
23942         o_conv.inner = untag_ptr(o);
23943         o_conv.is_owned = ptr_is_owned(o);
23944         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23945         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
23946         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23947         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
23948         return tag_ptr(ret_conv, true);
23949 }
23950
23951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23952         LDKDecodeError e_conv;
23953         e_conv.inner = untag_ptr(e);
23954         e_conv.is_owned = ptr_is_owned(e);
23955         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23956         e_conv = DecodeError_clone(&e_conv);
23957         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23958         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
23959         return tag_ptr(ret_conv, true);
23960 }
23961
23962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23963         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
23964         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
23965         return ret_conv;
23966 }
23967
23968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23969         if (!ptr_is_owned(_res)) return;
23970         void* _res_ptr = untag_ptr(_res);
23971         CHECK_ACCESS(_res_ptr);
23972         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
23973         FREE(untag_ptr(_res));
23974         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
23975 }
23976
23977 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
23978         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23979         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
23980         return tag_ptr(ret_conv, true);
23981 }
23982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23983         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
23984         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
23985         return ret_conv;
23986 }
23987
23988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23989         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
23990         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23991         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
23992         return tag_ptr(ret_conv, true);
23993 }
23994
23995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23996         LDKChannelAnnouncement o_conv;
23997         o_conv.inner = untag_ptr(o);
23998         o_conv.is_owned = ptr_is_owned(o);
23999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24000         o_conv = ChannelAnnouncement_clone(&o_conv);
24001         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24002         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
24003         return tag_ptr(ret_conv, true);
24004 }
24005
24006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24007         LDKDecodeError e_conv;
24008         e_conv.inner = untag_ptr(e);
24009         e_conv.is_owned = ptr_is_owned(e);
24010         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24011         e_conv = DecodeError_clone(&e_conv);
24012         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24013         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
24014         return tag_ptr(ret_conv, true);
24015 }
24016
24017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24018         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
24019         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
24020         return ret_conv;
24021 }
24022
24023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24024         if (!ptr_is_owned(_res)) return;
24025         void* _res_ptr = untag_ptr(_res);
24026         CHECK_ACCESS(_res_ptr);
24027         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
24028         FREE(untag_ptr(_res));
24029         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
24030 }
24031
24032 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
24033         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24034         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
24035         return tag_ptr(ret_conv, true);
24036 }
24037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24038         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
24039         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
24040         return ret_conv;
24041 }
24042
24043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24044         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
24045         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
24046         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
24047         return tag_ptr(ret_conv, true);
24048 }
24049
24050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24051         LDKUnsignedChannelUpdate o_conv;
24052         o_conv.inner = untag_ptr(o);
24053         o_conv.is_owned = ptr_is_owned(o);
24054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24055         o_conv = UnsignedChannelUpdate_clone(&o_conv);
24056         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
24057         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
24058         return tag_ptr(ret_conv, true);
24059 }
24060
24061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24062         LDKDecodeError e_conv;
24063         e_conv.inner = untag_ptr(e);
24064         e_conv.is_owned = ptr_is_owned(e);
24065         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24066         e_conv = DecodeError_clone(&e_conv);
24067         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
24068         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
24069         return tag_ptr(ret_conv, true);
24070 }
24071
24072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24073         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
24074         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
24075         return ret_conv;
24076 }
24077
24078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24079         if (!ptr_is_owned(_res)) return;
24080         void* _res_ptr = untag_ptr(_res);
24081         CHECK_ACCESS(_res_ptr);
24082         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
24083         FREE(untag_ptr(_res));
24084         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
24085 }
24086
24087 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
24088         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
24089         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
24090         return tag_ptr(ret_conv, true);
24091 }
24092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24093         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
24094         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
24095         return ret_conv;
24096 }
24097
24098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24099         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
24100         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
24101         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
24102         return tag_ptr(ret_conv, true);
24103 }
24104
24105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24106         LDKChannelUpdate o_conv;
24107         o_conv.inner = untag_ptr(o);
24108         o_conv.is_owned = ptr_is_owned(o);
24109         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24110         o_conv = ChannelUpdate_clone(&o_conv);
24111         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
24112         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
24113         return tag_ptr(ret_conv, true);
24114 }
24115
24116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24117         LDKDecodeError e_conv;
24118         e_conv.inner = untag_ptr(e);
24119         e_conv.is_owned = ptr_is_owned(e);
24120         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24121         e_conv = DecodeError_clone(&e_conv);
24122         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
24123         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
24124         return tag_ptr(ret_conv, true);
24125 }
24126
24127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24128         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
24129         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
24130         return ret_conv;
24131 }
24132
24133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24134         if (!ptr_is_owned(_res)) return;
24135         void* _res_ptr = untag_ptr(_res);
24136         CHECK_ACCESS(_res_ptr);
24137         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
24138         FREE(untag_ptr(_res));
24139         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
24140 }
24141
24142 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
24143         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
24144         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
24145         return tag_ptr(ret_conv, true);
24146 }
24147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24148         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
24149         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
24150         return ret_conv;
24151 }
24152
24153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24154         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
24155         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
24156         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
24157         return tag_ptr(ret_conv, true);
24158 }
24159
24160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24161         LDKErrorMessage o_conv;
24162         o_conv.inner = untag_ptr(o);
24163         o_conv.is_owned = ptr_is_owned(o);
24164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24165         o_conv = ErrorMessage_clone(&o_conv);
24166         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
24167         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
24168         return tag_ptr(ret_conv, true);
24169 }
24170
24171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24172         LDKDecodeError e_conv;
24173         e_conv.inner = untag_ptr(e);
24174         e_conv.is_owned = ptr_is_owned(e);
24175         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24176         e_conv = DecodeError_clone(&e_conv);
24177         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
24178         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
24179         return tag_ptr(ret_conv, true);
24180 }
24181
24182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24183         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
24184         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
24185         return ret_conv;
24186 }
24187
24188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24189         if (!ptr_is_owned(_res)) return;
24190         void* _res_ptr = untag_ptr(_res);
24191         CHECK_ACCESS(_res_ptr);
24192         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
24193         FREE(untag_ptr(_res));
24194         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
24195 }
24196
24197 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
24198         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
24199         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
24200         return tag_ptr(ret_conv, true);
24201 }
24202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24203         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
24204         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
24205         return ret_conv;
24206 }
24207
24208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24209         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
24210         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
24211         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
24212         return tag_ptr(ret_conv, true);
24213 }
24214
24215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24216         LDKWarningMessage o_conv;
24217         o_conv.inner = untag_ptr(o);
24218         o_conv.is_owned = ptr_is_owned(o);
24219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24220         o_conv = WarningMessage_clone(&o_conv);
24221         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
24222         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
24223         return tag_ptr(ret_conv, true);
24224 }
24225
24226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24227         LDKDecodeError e_conv;
24228         e_conv.inner = untag_ptr(e);
24229         e_conv.is_owned = ptr_is_owned(e);
24230         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24231         e_conv = DecodeError_clone(&e_conv);
24232         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
24233         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
24234         return tag_ptr(ret_conv, true);
24235 }
24236
24237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24238         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
24239         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
24240         return ret_conv;
24241 }
24242
24243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24244         if (!ptr_is_owned(_res)) return;
24245         void* _res_ptr = untag_ptr(_res);
24246         CHECK_ACCESS(_res_ptr);
24247         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
24248         FREE(untag_ptr(_res));
24249         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
24250 }
24251
24252 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
24253         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
24254         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
24255         return tag_ptr(ret_conv, true);
24256 }
24257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24258         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
24259         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
24260         return ret_conv;
24261 }
24262
24263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24264         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
24265         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
24266         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
24267         return tag_ptr(ret_conv, true);
24268 }
24269
24270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24271         LDKUnsignedNodeAnnouncement o_conv;
24272         o_conv.inner = untag_ptr(o);
24273         o_conv.is_owned = ptr_is_owned(o);
24274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24275         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
24276         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
24277         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
24278         return tag_ptr(ret_conv, true);
24279 }
24280
24281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24282         LDKDecodeError e_conv;
24283         e_conv.inner = untag_ptr(e);
24284         e_conv.is_owned = ptr_is_owned(e);
24285         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24286         e_conv = DecodeError_clone(&e_conv);
24287         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
24288         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
24289         return tag_ptr(ret_conv, true);
24290 }
24291
24292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24293         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
24294         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
24295         return ret_conv;
24296 }
24297
24298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24299         if (!ptr_is_owned(_res)) return;
24300         void* _res_ptr = untag_ptr(_res);
24301         CHECK_ACCESS(_res_ptr);
24302         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
24303         FREE(untag_ptr(_res));
24304         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
24305 }
24306
24307 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
24308         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
24309         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
24310         return tag_ptr(ret_conv, true);
24311 }
24312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24313         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
24314         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
24315         return ret_conv;
24316 }
24317
24318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24319         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
24320         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
24321         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
24322         return tag_ptr(ret_conv, true);
24323 }
24324
24325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24326         LDKNodeAnnouncement o_conv;
24327         o_conv.inner = untag_ptr(o);
24328         o_conv.is_owned = ptr_is_owned(o);
24329         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24330         o_conv = NodeAnnouncement_clone(&o_conv);
24331         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
24332         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
24333         return tag_ptr(ret_conv, true);
24334 }
24335
24336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24337         LDKDecodeError e_conv;
24338         e_conv.inner = untag_ptr(e);
24339         e_conv.is_owned = ptr_is_owned(e);
24340         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24341         e_conv = DecodeError_clone(&e_conv);
24342         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
24343         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
24344         return tag_ptr(ret_conv, true);
24345 }
24346
24347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24348         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
24349         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
24350         return ret_conv;
24351 }
24352
24353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24354         if (!ptr_is_owned(_res)) return;
24355         void* _res_ptr = untag_ptr(_res);
24356         CHECK_ACCESS(_res_ptr);
24357         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
24358         FREE(untag_ptr(_res));
24359         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
24360 }
24361
24362 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
24363         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
24364         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
24365         return tag_ptr(ret_conv, true);
24366 }
24367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24368         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
24369         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
24370         return ret_conv;
24371 }
24372
24373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24374         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
24375         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
24376         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
24377         return tag_ptr(ret_conv, true);
24378 }
24379
24380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24381         LDKQueryShortChannelIds o_conv;
24382         o_conv.inner = untag_ptr(o);
24383         o_conv.is_owned = ptr_is_owned(o);
24384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24385         o_conv = QueryShortChannelIds_clone(&o_conv);
24386         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
24387         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
24388         return tag_ptr(ret_conv, true);
24389 }
24390
24391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24392         LDKDecodeError e_conv;
24393         e_conv.inner = untag_ptr(e);
24394         e_conv.is_owned = ptr_is_owned(e);
24395         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24396         e_conv = DecodeError_clone(&e_conv);
24397         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
24398         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
24399         return tag_ptr(ret_conv, true);
24400 }
24401
24402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24403         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
24404         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
24405         return ret_conv;
24406 }
24407
24408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24409         if (!ptr_is_owned(_res)) return;
24410         void* _res_ptr = untag_ptr(_res);
24411         CHECK_ACCESS(_res_ptr);
24412         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
24413         FREE(untag_ptr(_res));
24414         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
24415 }
24416
24417 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
24418         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
24419         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
24420         return tag_ptr(ret_conv, true);
24421 }
24422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24423         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
24424         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
24425         return ret_conv;
24426 }
24427
24428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24429         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
24430         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
24431         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
24432         return tag_ptr(ret_conv, true);
24433 }
24434
24435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24436         LDKReplyShortChannelIdsEnd o_conv;
24437         o_conv.inner = untag_ptr(o);
24438         o_conv.is_owned = ptr_is_owned(o);
24439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24440         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
24441         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
24442         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
24443         return tag_ptr(ret_conv, true);
24444 }
24445
24446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24447         LDKDecodeError e_conv;
24448         e_conv.inner = untag_ptr(e);
24449         e_conv.is_owned = ptr_is_owned(e);
24450         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24451         e_conv = DecodeError_clone(&e_conv);
24452         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
24453         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
24454         return tag_ptr(ret_conv, true);
24455 }
24456
24457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24458         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
24459         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
24460         return ret_conv;
24461 }
24462
24463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24464         if (!ptr_is_owned(_res)) return;
24465         void* _res_ptr = untag_ptr(_res);
24466         CHECK_ACCESS(_res_ptr);
24467         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
24468         FREE(untag_ptr(_res));
24469         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
24470 }
24471
24472 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
24473         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
24474         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
24475         return tag_ptr(ret_conv, true);
24476 }
24477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24478         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
24479         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
24480         return ret_conv;
24481 }
24482
24483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24484         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
24485         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
24486         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
24487         return tag_ptr(ret_conv, true);
24488 }
24489
24490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24491         LDKQueryChannelRange o_conv;
24492         o_conv.inner = untag_ptr(o);
24493         o_conv.is_owned = ptr_is_owned(o);
24494         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24495         o_conv = QueryChannelRange_clone(&o_conv);
24496         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24497         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
24498         return tag_ptr(ret_conv, true);
24499 }
24500
24501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24502         LDKDecodeError e_conv;
24503         e_conv.inner = untag_ptr(e);
24504         e_conv.is_owned = ptr_is_owned(e);
24505         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24506         e_conv = DecodeError_clone(&e_conv);
24507         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24508         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
24509         return tag_ptr(ret_conv, true);
24510 }
24511
24512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24513         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
24514         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
24515         return ret_conv;
24516 }
24517
24518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24519         if (!ptr_is_owned(_res)) return;
24520         void* _res_ptr = untag_ptr(_res);
24521         CHECK_ACCESS(_res_ptr);
24522         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
24523         FREE(untag_ptr(_res));
24524         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
24525 }
24526
24527 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
24528         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24529         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
24530         return tag_ptr(ret_conv, true);
24531 }
24532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24533         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
24534         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
24535         return ret_conv;
24536 }
24537
24538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24539         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
24540         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
24541         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
24542         return tag_ptr(ret_conv, true);
24543 }
24544
24545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24546         LDKReplyChannelRange o_conv;
24547         o_conv.inner = untag_ptr(o);
24548         o_conv.is_owned = ptr_is_owned(o);
24549         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24550         o_conv = ReplyChannelRange_clone(&o_conv);
24551         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24552         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
24553         return tag_ptr(ret_conv, true);
24554 }
24555
24556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24557         LDKDecodeError e_conv;
24558         e_conv.inner = untag_ptr(e);
24559         e_conv.is_owned = ptr_is_owned(e);
24560         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24561         e_conv = DecodeError_clone(&e_conv);
24562         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24563         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
24564         return tag_ptr(ret_conv, true);
24565 }
24566
24567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24568         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
24569         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
24570         return ret_conv;
24571 }
24572
24573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24574         if (!ptr_is_owned(_res)) return;
24575         void* _res_ptr = untag_ptr(_res);
24576         CHECK_ACCESS(_res_ptr);
24577         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
24578         FREE(untag_ptr(_res));
24579         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
24580 }
24581
24582 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
24583         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24584         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
24585         return tag_ptr(ret_conv, true);
24586 }
24587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24588         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
24589         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
24590         return ret_conv;
24591 }
24592
24593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24594         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
24595         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
24596         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
24597         return tag_ptr(ret_conv, true);
24598 }
24599
24600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24601         LDKGossipTimestampFilter o_conv;
24602         o_conv.inner = untag_ptr(o);
24603         o_conv.is_owned = ptr_is_owned(o);
24604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24605         o_conv = GossipTimestampFilter_clone(&o_conv);
24606         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24607         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
24608         return tag_ptr(ret_conv, true);
24609 }
24610
24611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24612         LDKDecodeError e_conv;
24613         e_conv.inner = untag_ptr(e);
24614         e_conv.is_owned = ptr_is_owned(e);
24615         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24616         e_conv = DecodeError_clone(&e_conv);
24617         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24618         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
24619         return tag_ptr(ret_conv, true);
24620 }
24621
24622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24623         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
24624         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
24625         return ret_conv;
24626 }
24627
24628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24629         if (!ptr_is_owned(_res)) return;
24630         void* _res_ptr = untag_ptr(_res);
24631         CHECK_ACCESS(_res_ptr);
24632         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
24633         FREE(untag_ptr(_res));
24634         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
24635 }
24636
24637 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
24638         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24639         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
24640         return tag_ptr(ret_conv, true);
24641 }
24642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24643         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
24644         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
24645         return ret_conv;
24646 }
24647
24648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24649         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
24650         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24651         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
24652         return tag_ptr(ret_conv, true);
24653 }
24654
24655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24656         LDKCVec_PhantomRouteHintsZ _res_constr;
24657         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24658         if (_res_constr.datalen > 0)
24659                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
24660         else
24661                 _res_constr.data = NULL;
24662         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24663         for (size_t t = 0; t < _res_constr.datalen; t++) {
24664                 int64_t _res_conv_19 = _res_vals[t];
24665                 LDKPhantomRouteHints _res_conv_19_conv;
24666                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
24667                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
24668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
24669                 _res_constr.data[t] = _res_conv_19_conv;
24670         }
24671         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24672         CVec_PhantomRouteHintsZ_free(_res_constr);
24673 }
24674
24675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24676         LDKInvoice o_conv;
24677         o_conv.inner = untag_ptr(o);
24678         o_conv.is_owned = ptr_is_owned(o);
24679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24680         o_conv = Invoice_clone(&o_conv);
24681         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24682         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
24683         return tag_ptr(ret_conv, true);
24684 }
24685
24686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24687         void* e_ptr = untag_ptr(e);
24688         CHECK_ACCESS(e_ptr);
24689         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
24690         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
24691         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24692         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
24693         return tag_ptr(ret_conv, true);
24694 }
24695
24696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24697         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
24698         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
24699         return ret_conv;
24700 }
24701
24702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24703         if (!ptr_is_owned(_res)) return;
24704         void* _res_ptr = untag_ptr(_res);
24705         CHECK_ACCESS(_res_ptr);
24706         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
24707         FREE(untag_ptr(_res));
24708         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
24709 }
24710
24711 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
24712         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24713         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
24714         return tag_ptr(ret_conv, true);
24715 }
24716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24717         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
24718         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
24719         return ret_conv;
24720 }
24721
24722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24723         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
24724         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
24725         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
24726         return tag_ptr(ret_conv, true);
24727 }
24728
24729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24730         void* o_ptr = untag_ptr(o);
24731         CHECK_ACCESS(o_ptr);
24732         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
24733         if (o_conv.free == LDKFilter_JCalls_free) {
24734                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24735                 LDKFilter_JCalls_cloned(&o_conv);
24736         }
24737         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
24738         *ret_copy = COption_FilterZ_some(o_conv);
24739         int64_t ret_ref = tag_ptr(ret_copy, true);
24740         return ret_ref;
24741 }
24742
24743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
24744         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
24745         *ret_copy = COption_FilterZ_none();
24746         int64_t ret_ref = tag_ptr(ret_copy, true);
24747         return ret_ref;
24748 }
24749
24750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24751         if (!ptr_is_owned(_res)) return;
24752         void* _res_ptr = untag_ptr(_res);
24753         CHECK_ACCESS(_res_ptr);
24754         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
24755         FREE(untag_ptr(_res));
24756         COption_FilterZ_free(_res_conv);
24757 }
24758
24759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24760         LDKLockedChannelMonitor o_conv;
24761         o_conv.inner = untag_ptr(o);
24762         o_conv.is_owned = ptr_is_owned(o);
24763         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24764         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
24765         
24766         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24767         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
24768         return tag_ptr(ret_conv, true);
24769 }
24770
24771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
24772         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24773         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
24774         return tag_ptr(ret_conv, true);
24775 }
24776
24777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24778         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
24779         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
24780         return ret_conv;
24781 }
24782
24783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24784         if (!ptr_is_owned(_res)) return;
24785         void* _res_ptr = untag_ptr(_res);
24786         CHECK_ACCESS(_res_ptr);
24787         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
24788         FREE(untag_ptr(_res));
24789         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
24790 }
24791
24792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24793         LDKCVec_OutPointZ _res_constr;
24794         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24795         if (_res_constr.datalen > 0)
24796                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
24797         else
24798                 _res_constr.data = NULL;
24799         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24800         for (size_t k = 0; k < _res_constr.datalen; k++) {
24801                 int64_t _res_conv_10 = _res_vals[k];
24802                 LDKOutPoint _res_conv_10_conv;
24803                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
24804                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
24805                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
24806                 _res_constr.data[k] = _res_conv_10_conv;
24807         }
24808         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24809         CVec_OutPointZ_free(_res_constr);
24810 }
24811
24812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24813         if (!ptr_is_owned(this_ptr)) return;
24814         void* this_ptr_ptr = untag_ptr(this_ptr);
24815         CHECK_ACCESS(this_ptr_ptr);
24816         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
24817         FREE(untag_ptr(this_ptr));
24818         PaymentPurpose_free(this_ptr_conv);
24819 }
24820
24821 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
24822         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24823         *ret_copy = PaymentPurpose_clone(arg);
24824         int64_t ret_ref = tag_ptr(ret_copy, true);
24825         return ret_ref;
24826 }
24827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24828         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
24829         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
24830         return ret_conv;
24831 }
24832
24833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24834         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
24835         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24836         *ret_copy = PaymentPurpose_clone(orig_conv);
24837         int64_t ret_ref = tag_ptr(ret_copy, true);
24838         return ret_ref;
24839 }
24840
24841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
24842         LDKThirtyTwoBytes payment_preimage_ref;
24843         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
24844         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
24845         LDKThirtyTwoBytes payment_secret_ref;
24846         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
24847         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
24848         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24849         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
24850         int64_t ret_ref = tag_ptr(ret_copy, true);
24851         return ret_ref;
24852 }
24853
24854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
24855         LDKThirtyTwoBytes a_ref;
24856         CHECK((*env)->GetArrayLength(env, a) == 32);
24857         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
24858         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
24859         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
24860         int64_t ret_ref = tag_ptr(ret_copy, true);
24861         return ret_ref;
24862 }
24863
24864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
24865         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
24866         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
24867         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24868         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24869         CVec_u8Z_free(ret_var);
24870         return ret_arr;
24871 }
24872
24873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24874         LDKu8slice ser_ref;
24875         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24876         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24877         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
24878         *ret_conv = PaymentPurpose_read(ser_ref);
24879         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24880         return tag_ptr(ret_conv, true);
24881 }
24882
24883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24884         if (!ptr_is_owned(this_ptr)) return;
24885         void* this_ptr_ptr = untag_ptr(this_ptr);
24886         CHECK_ACCESS(this_ptr_ptr);
24887         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
24888         FREE(untag_ptr(this_ptr));
24889         ClosureReason_free(this_ptr_conv);
24890 }
24891
24892 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
24893         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24894         *ret_copy = ClosureReason_clone(arg);
24895         int64_t ret_ref = tag_ptr(ret_copy, true);
24896         return ret_ref;
24897 }
24898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24899         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
24900         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
24901         return ret_conv;
24902 }
24903
24904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24905         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
24906         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24907         *ret_copy = ClosureReason_clone(orig_conv);
24908         int64_t ret_ref = tag_ptr(ret_copy, true);
24909         return ret_ref;
24910 }
24911
24912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
24913         LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
24914         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24915         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
24916         int64_t ret_ref = tag_ptr(ret_copy, true);
24917         return ret_ref;
24918 }
24919
24920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
24921         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24922         *ret_copy = ClosureReason_holder_force_closed();
24923         int64_t ret_ref = tag_ptr(ret_copy, true);
24924         return ret_ref;
24925 }
24926
24927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
24928         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24929         *ret_copy = ClosureReason_cooperative_closure();
24930         int64_t ret_ref = tag_ptr(ret_copy, true);
24931         return ret_ref;
24932 }
24933
24934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
24935         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24936         *ret_copy = ClosureReason_commitment_tx_confirmed();
24937         int64_t ret_ref = tag_ptr(ret_copy, true);
24938         return ret_ref;
24939 }
24940
24941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
24942         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24943         *ret_copy = ClosureReason_funding_timed_out();
24944         int64_t ret_ref = tag_ptr(ret_copy, true);
24945         return ret_ref;
24946 }
24947
24948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
24949         LDKStr err_conv = java_to_owned_str(env, err);
24950         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24951         *ret_copy = ClosureReason_processing_error(err_conv);
24952         int64_t ret_ref = tag_ptr(ret_copy, true);
24953         return ret_ref;
24954 }
24955
24956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
24957         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24958         *ret_copy = ClosureReason_disconnected_peer();
24959         int64_t ret_ref = tag_ptr(ret_copy, true);
24960         return ret_ref;
24961 }
24962
24963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
24964         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
24965         *ret_copy = ClosureReason_outdated_channel_manager();
24966         int64_t ret_ref = tag_ptr(ret_copy, true);
24967         return ret_ref;
24968 }
24969
24970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
24971         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
24972         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
24973         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24974         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24975         CVec_u8Z_free(ret_var);
24976         return ret_arr;
24977 }
24978
24979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24980         LDKu8slice ser_ref;
24981         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24982         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24983         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
24984         *ret_conv = ClosureReason_read(ser_ref);
24985         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24986         return tag_ptr(ret_conv, true);
24987 }
24988
24989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24990         if (!ptr_is_owned(this_ptr)) return;
24991         void* this_ptr_ptr = untag_ptr(this_ptr);
24992         CHECK_ACCESS(this_ptr_ptr);
24993         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
24994         FREE(untag_ptr(this_ptr));
24995         HTLCDestination_free(this_ptr_conv);
24996 }
24997
24998 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
24999         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
25000         *ret_copy = HTLCDestination_clone(arg);
25001         int64_t ret_ref = tag_ptr(ret_copy, true);
25002         return ret_ref;
25003 }
25004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25005         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
25006         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
25007         return ret_conv;
25008 }
25009
25010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25011         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
25012         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
25013         *ret_copy = HTLCDestination_clone(orig_conv);
25014         int64_t ret_ref = tag_ptr(ret_copy, true);
25015         return ret_ref;
25016 }
25017
25018 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) {
25019         LDKPublicKey node_id_ref;
25020         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25021         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25022         LDKThirtyTwoBytes channel_id_ref;
25023         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
25024         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
25025         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
25026         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
25027         int64_t ret_ref = tag_ptr(ret_copy, true);
25028         return ret_ref;
25029 }
25030
25031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
25032         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
25033         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
25034         int64_t ret_ref = tag_ptr(ret_copy, true);
25035         return ret_ref;
25036 }
25037
25038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
25039         LDKThirtyTwoBytes payment_hash_ref;
25040         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25041         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25042         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
25043         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
25044         int64_t ret_ref = tag_ptr(ret_copy, true);
25045         return ret_ref;
25046 }
25047
25048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
25049         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
25050         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
25051         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25052         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25053         CVec_u8Z_free(ret_var);
25054         return ret_arr;
25055 }
25056
25057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25058         LDKu8slice ser_ref;
25059         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25060         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25061         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
25062         *ret_conv = HTLCDestination_read(ser_ref);
25063         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25064         return tag_ptr(ret_conv, true);
25065 }
25066
25067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25068         if (!ptr_is_owned(this_ptr)) return;
25069         void* this_ptr_ptr = untag_ptr(this_ptr);
25070         CHECK_ACCESS(this_ptr_ptr);
25071         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
25072         FREE(untag_ptr(this_ptr));
25073         Event_free(this_ptr_conv);
25074 }
25075
25076 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
25077         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25078         *ret_copy = Event_clone(arg);
25079         int64_t ret_ref = tag_ptr(ret_copy, true);
25080         return ret_ref;
25081 }
25082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25083         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
25084         int64_t ret_conv = Event_clone_ptr(arg_conv);
25085         return ret_conv;
25086 }
25087
25088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25089         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
25090         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25091         *ret_copy = Event_clone(orig_conv);
25092         int64_t ret_ref = tag_ptr(ret_copy, true);
25093         return ret_ref;
25094 }
25095
25096 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) {
25097         LDKThirtyTwoBytes temporary_channel_id_ref;
25098         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
25099         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
25100         LDKPublicKey counterparty_node_id_ref;
25101         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
25102         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
25103         LDKCVec_u8Z output_script_ref;
25104         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
25105         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
25106         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
25107         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25108         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
25109         int64_t ret_ref = tag_ptr(ret_copy, true);
25110         return ret_ref;
25111 }
25112
25113 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) {
25114         LDKThirtyTwoBytes payment_hash_ref;
25115         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25116         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25117         void* purpose_ptr = untag_ptr(purpose);
25118         CHECK_ACCESS(purpose_ptr);
25119         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
25120         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
25121         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25122         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
25123         int64_t ret_ref = tag_ptr(ret_copy, true);
25124         return ret_ref;
25125 }
25126
25127 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) {
25128         LDKThirtyTwoBytes payment_hash_ref;
25129         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25130         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25131         void* purpose_ptr = untag_ptr(purpose);
25132         CHECK_ACCESS(purpose_ptr);
25133         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
25134         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
25135         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25136         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
25137         int64_t ret_ref = tag_ptr(ret_copy, true);
25138         return ret_ref;
25139 }
25140
25141 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) {
25142         LDKThirtyTwoBytes payment_id_ref;
25143         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25144         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25145         LDKThirtyTwoBytes payment_preimage_ref;
25146         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
25147         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
25148         LDKThirtyTwoBytes payment_hash_ref;
25149         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25150         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25151         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
25152         CHECK_ACCESS(fee_paid_msat_ptr);
25153         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
25154         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
25155         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25156         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
25157         int64_t ret_ref = tag_ptr(ret_copy, true);
25158         return ret_ref;
25159 }
25160
25161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
25162         LDKThirtyTwoBytes payment_id_ref;
25163         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25164         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25165         LDKThirtyTwoBytes payment_hash_ref;
25166         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25167         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25168         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25169         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
25170         int64_t ret_ref = tag_ptr(ret_copy, true);
25171         return ret_ref;
25172 }
25173
25174 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) {
25175         LDKThirtyTwoBytes payment_id_ref;
25176         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25177         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25178         LDKThirtyTwoBytes payment_hash_ref;
25179         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25180         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25181         LDKCVec_RouteHopZ path_constr;
25182         path_constr.datalen = (*env)->GetArrayLength(env, path);
25183         if (path_constr.datalen > 0)
25184                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
25185         else
25186                 path_constr.data = NULL;
25187         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
25188         for (size_t k = 0; k < path_constr.datalen; k++) {
25189                 int64_t path_conv_10 = path_vals[k];
25190                 LDKRouteHop path_conv_10_conv;
25191                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
25192                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
25193                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
25194                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
25195                 path_constr.data[k] = path_conv_10_conv;
25196         }
25197         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
25198         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25199         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
25200         int64_t ret_ref = tag_ptr(ret_copy, true);
25201         return ret_ref;
25202 }
25203
25204 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 payment_failed_permanently, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) {
25205         LDKThirtyTwoBytes payment_id_ref;
25206         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25207         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25208         LDKThirtyTwoBytes payment_hash_ref;
25209         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25210         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25211         void* network_update_ptr = untag_ptr(network_update);
25212         CHECK_ACCESS(network_update_ptr);
25213         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
25214         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
25215         LDKCVec_RouteHopZ path_constr;
25216         path_constr.datalen = (*env)->GetArrayLength(env, path);
25217         if (path_constr.datalen > 0)
25218                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
25219         else
25220                 path_constr.data = NULL;
25221         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
25222         for (size_t k = 0; k < path_constr.datalen; k++) {
25223                 int64_t path_conv_10 = path_vals[k];
25224                 LDKRouteHop path_conv_10_conv;
25225                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
25226                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
25227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
25228                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
25229                 path_constr.data[k] = path_conv_10_conv;
25230         }
25231         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
25232         void* short_channel_id_ptr = untag_ptr(short_channel_id);
25233         CHECK_ACCESS(short_channel_id_ptr);
25234         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
25235         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
25236         LDKRouteParameters retry_conv;
25237         retry_conv.inner = untag_ptr(retry);
25238         retry_conv.is_owned = ptr_is_owned(retry);
25239         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
25240         retry_conv = RouteParameters_clone(&retry_conv);
25241         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25242         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
25243         int64_t ret_ref = tag_ptr(ret_copy, true);
25244         return ret_ref;
25245 }
25246
25247 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) {
25248         LDKThirtyTwoBytes payment_id_ref;
25249         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25250         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25251         LDKThirtyTwoBytes payment_hash_ref;
25252         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25253         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25254         LDKCVec_RouteHopZ path_constr;
25255         path_constr.datalen = (*env)->GetArrayLength(env, path);
25256         if (path_constr.datalen > 0)
25257                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
25258         else
25259                 path_constr.data = NULL;
25260         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
25261         for (size_t k = 0; k < path_constr.datalen; k++) {
25262                 int64_t path_conv_10 = path_vals[k];
25263                 LDKRouteHop path_conv_10_conv;
25264                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
25265                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
25266                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
25267                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
25268                 path_constr.data[k] = path_conv_10_conv;
25269         }
25270         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
25271         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25272         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
25273         int64_t ret_ref = tag_ptr(ret_copy, true);
25274         return ret_ref;
25275 }
25276
25277 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) {
25278         LDKThirtyTwoBytes payment_id_ref;
25279         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
25280         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
25281         LDKThirtyTwoBytes payment_hash_ref;
25282         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
25283         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
25284         LDKCVec_RouteHopZ path_constr;
25285         path_constr.datalen = (*env)->GetArrayLength(env, path);
25286         if (path_constr.datalen > 0)
25287                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
25288         else
25289                 path_constr.data = NULL;
25290         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
25291         for (size_t k = 0; k < path_constr.datalen; k++) {
25292                 int64_t path_conv_10 = path_vals[k];
25293                 LDKRouteHop path_conv_10_conv;
25294                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
25295                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
25296                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
25297                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
25298                 path_constr.data[k] = path_conv_10_conv;
25299         }
25300         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
25301         void* short_channel_id_ptr = untag_ptr(short_channel_id);
25302         CHECK_ACCESS(short_channel_id_ptr);
25303         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
25304         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
25305         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25306         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
25307         int64_t ret_ref = tag_ptr(ret_copy, true);
25308         return ret_ref;
25309 }
25310
25311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
25312         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25313         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
25314         int64_t ret_ref = tag_ptr(ret_copy, true);
25315         return ret_ref;
25316 }
25317
25318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
25319         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
25320         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
25321         if (outputs_constr.datalen > 0)
25322                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25323         else
25324                 outputs_constr.data = NULL;
25325         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
25326         for (size_t b = 0; b < outputs_constr.datalen; b++) {
25327                 int64_t outputs_conv_27 = outputs_vals[b];
25328                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
25329                 CHECK_ACCESS(outputs_conv_27_ptr);
25330                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
25331                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
25332                 outputs_constr.data[b] = outputs_conv_27_conv;
25333         }
25334         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
25335         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25336         *ret_copy = Event_spendable_outputs(outputs_constr);
25337         int64_t ret_ref = tag_ptr(ret_copy, true);
25338         return ret_ref;
25339 }
25340
25341 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) {
25342         LDKThirtyTwoBytes prev_channel_id_ref;
25343         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
25344         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
25345         LDKThirtyTwoBytes next_channel_id_ref;
25346         CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
25347         (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
25348         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
25349         CHECK_ACCESS(fee_earned_msat_ptr);
25350         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
25351         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
25352         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25353         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
25354         int64_t ret_ref = tag_ptr(ret_copy, true);
25355         return ret_ref;
25356 }
25357
25358 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) {
25359         LDKThirtyTwoBytes channel_id_ref;
25360         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
25361         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
25362         void* reason_ptr = untag_ptr(reason);
25363         CHECK_ACCESS(reason_ptr);
25364         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
25365         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
25366         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25367         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
25368         int64_t ret_ref = tag_ptr(ret_copy, true);
25369         return ret_ref;
25370 }
25371
25372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
25373         LDKThirtyTwoBytes channel_id_ref;
25374         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
25375         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
25376         LDKTransaction transaction_ref;
25377         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
25378         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
25379         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
25380         transaction_ref.data_is_owned = true;
25381         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25382         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
25383         int64_t ret_ref = tag_ptr(ret_copy, true);
25384         return ret_ref;
25385 }
25386
25387 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) {
25388         LDKThirtyTwoBytes temporary_channel_id_ref;
25389         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
25390         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
25391         LDKPublicKey counterparty_node_id_ref;
25392         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
25393         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
25394         LDKChannelTypeFeatures channel_type_conv;
25395         channel_type_conv.inner = untag_ptr(channel_type);
25396         channel_type_conv.is_owned = ptr_is_owned(channel_type);
25397         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
25398         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
25399         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25400         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
25401         int64_t ret_ref = tag_ptr(ret_copy, true);
25402         return ret_ref;
25403 }
25404
25405 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) {
25406         LDKThirtyTwoBytes prev_channel_id_ref;
25407         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
25408         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
25409         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
25410         CHECK_ACCESS(failed_next_destination_ptr);
25411         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
25412         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
25413         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25414         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
25415         int64_t ret_ref = tag_ptr(ret_copy, true);
25416         return ret_ref;
25417 }
25418
25419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
25420         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
25421         LDKCVec_u8Z ret_var = Event_write(obj_conv);
25422         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25423         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25424         CVec_u8Z_free(ret_var);
25425         return ret_arr;
25426 }
25427
25428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25429         LDKu8slice ser_ref;
25430         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25431         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25432         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
25433         *ret_conv = Event_read(ser_ref);
25434         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25435         return tag_ptr(ret_conv, true);
25436 }
25437
25438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25439         if (!ptr_is_owned(this_ptr)) return;
25440         void* this_ptr_ptr = untag_ptr(this_ptr);
25441         CHECK_ACCESS(this_ptr_ptr);
25442         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
25443         FREE(untag_ptr(this_ptr));
25444         MessageSendEvent_free(this_ptr_conv);
25445 }
25446
25447 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
25448         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25449         *ret_copy = MessageSendEvent_clone(arg);
25450         int64_t ret_ref = tag_ptr(ret_copy, true);
25451         return ret_ref;
25452 }
25453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25454         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
25455         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
25456         return ret_conv;
25457 }
25458
25459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25460         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
25461         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25462         *ret_copy = MessageSendEvent_clone(orig_conv);
25463         int64_t ret_ref = tag_ptr(ret_copy, true);
25464         return ret_ref;
25465 }
25466
25467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25468         LDKPublicKey node_id_ref;
25469         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25470         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25471         LDKAcceptChannel msg_conv;
25472         msg_conv.inner = untag_ptr(msg);
25473         msg_conv.is_owned = ptr_is_owned(msg);
25474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25475         msg_conv = AcceptChannel_clone(&msg_conv);
25476         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25477         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
25478         int64_t ret_ref = tag_ptr(ret_copy, true);
25479         return ret_ref;
25480 }
25481
25482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25483         LDKPublicKey node_id_ref;
25484         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25485         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25486         LDKOpenChannel msg_conv;
25487         msg_conv.inner = untag_ptr(msg);
25488         msg_conv.is_owned = ptr_is_owned(msg);
25489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25490         msg_conv = OpenChannel_clone(&msg_conv);
25491         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25492         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
25493         int64_t ret_ref = tag_ptr(ret_copy, true);
25494         return ret_ref;
25495 }
25496
25497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25498         LDKPublicKey node_id_ref;
25499         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25500         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25501         LDKFundingCreated msg_conv;
25502         msg_conv.inner = untag_ptr(msg);
25503         msg_conv.is_owned = ptr_is_owned(msg);
25504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25505         msg_conv = FundingCreated_clone(&msg_conv);
25506         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25507         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
25508         int64_t ret_ref = tag_ptr(ret_copy, true);
25509         return ret_ref;
25510 }
25511
25512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25513         LDKPublicKey node_id_ref;
25514         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25515         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25516         LDKFundingSigned msg_conv;
25517         msg_conv.inner = untag_ptr(msg);
25518         msg_conv.is_owned = ptr_is_owned(msg);
25519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25520         msg_conv = FundingSigned_clone(&msg_conv);
25521         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25522         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
25523         int64_t ret_ref = tag_ptr(ret_copy, true);
25524         return ret_ref;
25525 }
25526
25527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25528         LDKPublicKey node_id_ref;
25529         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25530         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25531         LDKChannelReady msg_conv;
25532         msg_conv.inner = untag_ptr(msg);
25533         msg_conv.is_owned = ptr_is_owned(msg);
25534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25535         msg_conv = ChannelReady_clone(&msg_conv);
25536         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25537         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
25538         int64_t ret_ref = tag_ptr(ret_copy, true);
25539         return ret_ref;
25540 }
25541
25542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25543         LDKPublicKey node_id_ref;
25544         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25545         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25546         LDKAnnouncementSignatures msg_conv;
25547         msg_conv.inner = untag_ptr(msg);
25548         msg_conv.is_owned = ptr_is_owned(msg);
25549         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25550         msg_conv = AnnouncementSignatures_clone(&msg_conv);
25551         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25552         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
25553         int64_t ret_ref = tag_ptr(ret_copy, true);
25554         return ret_ref;
25555 }
25556
25557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
25558         LDKPublicKey node_id_ref;
25559         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25560         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25561         LDKCommitmentUpdate updates_conv;
25562         updates_conv.inner = untag_ptr(updates);
25563         updates_conv.is_owned = ptr_is_owned(updates);
25564         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25565         updates_conv = CommitmentUpdate_clone(&updates_conv);
25566         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25567         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
25568         int64_t ret_ref = tag_ptr(ret_copy, true);
25569         return ret_ref;
25570 }
25571
25572 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) {
25573         LDKPublicKey node_id_ref;
25574         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25575         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25576         LDKRevokeAndACK msg_conv;
25577         msg_conv.inner = untag_ptr(msg);
25578         msg_conv.is_owned = ptr_is_owned(msg);
25579         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25580         msg_conv = RevokeAndACK_clone(&msg_conv);
25581         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25582         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
25583         int64_t ret_ref = tag_ptr(ret_copy, true);
25584         return ret_ref;
25585 }
25586
25587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25588         LDKPublicKey node_id_ref;
25589         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25590         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25591         LDKClosingSigned msg_conv;
25592         msg_conv.inner = untag_ptr(msg);
25593         msg_conv.is_owned = ptr_is_owned(msg);
25594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25595         msg_conv = ClosingSigned_clone(&msg_conv);
25596         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25597         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
25598         int64_t ret_ref = tag_ptr(ret_copy, true);
25599         return ret_ref;
25600 }
25601
25602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25603         LDKPublicKey node_id_ref;
25604         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25605         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25606         LDKShutdown msg_conv;
25607         msg_conv.inner = untag_ptr(msg);
25608         msg_conv.is_owned = ptr_is_owned(msg);
25609         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25610         msg_conv = Shutdown_clone(&msg_conv);
25611         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25612         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
25613         int64_t ret_ref = tag_ptr(ret_copy, true);
25614         return ret_ref;
25615 }
25616
25617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25618         LDKPublicKey node_id_ref;
25619         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25620         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25621         LDKChannelReestablish msg_conv;
25622         msg_conv.inner = untag_ptr(msg);
25623         msg_conv.is_owned = ptr_is_owned(msg);
25624         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25625         msg_conv = ChannelReestablish_clone(&msg_conv);
25626         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25627         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
25628         int64_t ret_ref = tag_ptr(ret_copy, true);
25629         return ret_ref;
25630 }
25631
25632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1announcement(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg, int64_t update_msg) {
25633         LDKPublicKey node_id_ref;
25634         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25635         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25636         LDKChannelAnnouncement msg_conv;
25637         msg_conv.inner = untag_ptr(msg);
25638         msg_conv.is_owned = ptr_is_owned(msg);
25639         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25640         msg_conv = ChannelAnnouncement_clone(&msg_conv);
25641         LDKChannelUpdate update_msg_conv;
25642         update_msg_conv.inner = untag_ptr(update_msg);
25643         update_msg_conv.is_owned = ptr_is_owned(update_msg);
25644         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
25645         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
25646         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25647         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
25648         int64_t ret_ref = tag_ptr(ret_copy, true);
25649         return ret_ref;
25650 }
25651
25652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
25653         LDKChannelAnnouncement msg_conv;
25654         msg_conv.inner = untag_ptr(msg);
25655         msg_conv.is_owned = ptr_is_owned(msg);
25656         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25657         msg_conv = ChannelAnnouncement_clone(&msg_conv);
25658         LDKChannelUpdate update_msg_conv;
25659         update_msg_conv.inner = untag_ptr(update_msg);
25660         update_msg_conv.is_owned = ptr_is_owned(update_msg);
25661         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
25662         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
25663         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25664         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
25665         int64_t ret_ref = tag_ptr(ret_copy, true);
25666         return ret_ref;
25667 }
25668
25669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
25670         LDKChannelUpdate msg_conv;
25671         msg_conv.inner = untag_ptr(msg);
25672         msg_conv.is_owned = ptr_is_owned(msg);
25673         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25674         msg_conv = ChannelUpdate_clone(&msg_conv);
25675         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25676         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
25677         int64_t ret_ref = tag_ptr(ret_copy, true);
25678         return ret_ref;
25679 }
25680
25681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
25682         LDKPublicKey node_id_ref;
25683         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25684         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25685         LDKChannelUpdate msg_conv;
25686         msg_conv.inner = untag_ptr(msg);
25687         msg_conv.is_owned = ptr_is_owned(msg);
25688         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25689         msg_conv = ChannelUpdate_clone(&msg_conv);
25690         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25691         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
25692         int64_t ret_ref = tag_ptr(ret_copy, true);
25693         return ret_ref;
25694 }
25695
25696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
25697         LDKPublicKey node_id_ref;
25698         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25699         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25700         void* action_ptr = untag_ptr(action);
25701         CHECK_ACCESS(action_ptr);
25702         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
25703         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
25704         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25705         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
25706         int64_t ret_ref = tag_ptr(ret_copy, true);
25707         return ret_ref;
25708 }
25709
25710 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) {
25711         LDKPublicKey node_id_ref;
25712         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25713         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25714         LDKQueryChannelRange msg_conv;
25715         msg_conv.inner = untag_ptr(msg);
25716         msg_conv.is_owned = ptr_is_owned(msg);
25717         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25718         msg_conv = QueryChannelRange_clone(&msg_conv);
25719         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25720         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
25721         int64_t ret_ref = tag_ptr(ret_copy, true);
25722         return ret_ref;
25723 }
25724
25725 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) {
25726         LDKPublicKey node_id_ref;
25727         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25728         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25729         LDKQueryShortChannelIds msg_conv;
25730         msg_conv.inner = untag_ptr(msg);
25731         msg_conv.is_owned = ptr_is_owned(msg);
25732         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25733         msg_conv = QueryShortChannelIds_clone(&msg_conv);
25734         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25735         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
25736         int64_t ret_ref = tag_ptr(ret_copy, true);
25737         return ret_ref;
25738 }
25739
25740 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) {
25741         LDKPublicKey node_id_ref;
25742         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25743         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25744         LDKReplyChannelRange msg_conv;
25745         msg_conv.inner = untag_ptr(msg);
25746         msg_conv.is_owned = ptr_is_owned(msg);
25747         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25748         msg_conv = ReplyChannelRange_clone(&msg_conv);
25749         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25750         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
25751         int64_t ret_ref = tag_ptr(ret_copy, true);
25752         return ret_ref;
25753 }
25754
25755 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) {
25756         LDKPublicKey node_id_ref;
25757         CHECK((*env)->GetArrayLength(env, node_id) == 33);
25758         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
25759         LDKGossipTimestampFilter msg_conv;
25760         msg_conv.inner = untag_ptr(msg);
25761         msg_conv.is_owned = ptr_is_owned(msg);
25762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
25763         msg_conv = GossipTimestampFilter_clone(&msg_conv);
25764         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
25765         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
25766         int64_t ret_ref = tag_ptr(ret_copy, true);
25767         return ret_ref;
25768 }
25769
25770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25771         if (!ptr_is_owned(this_ptr)) return;
25772         void* this_ptr_ptr = untag_ptr(this_ptr);
25773         CHECK_ACCESS(this_ptr_ptr);
25774         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
25775         FREE(untag_ptr(this_ptr));
25776         MessageSendEventsProvider_free(this_ptr_conv);
25777 }
25778
25779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25780         if (!ptr_is_owned(this_ptr)) return;
25781         void* this_ptr_ptr = untag_ptr(this_ptr);
25782         CHECK_ACCESS(this_ptr_ptr);
25783         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
25784         FREE(untag_ptr(this_ptr));
25785         OnionMessageProvider_free(this_ptr_conv);
25786 }
25787
25788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25789         if (!ptr_is_owned(this_ptr)) return;
25790         void* this_ptr_ptr = untag_ptr(this_ptr);
25791         CHECK_ACCESS(this_ptr_ptr);
25792         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
25793         FREE(untag_ptr(this_ptr));
25794         EventsProvider_free(this_ptr_conv);
25795 }
25796
25797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25798         if (!ptr_is_owned(this_ptr)) return;
25799         void* this_ptr_ptr = untag_ptr(this_ptr);
25800         CHECK_ACCESS(this_ptr_ptr);
25801         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
25802         FREE(untag_ptr(this_ptr));
25803         EventHandler_free(this_ptr_conv);
25804 }
25805
25806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25807         if (!ptr_is_owned(this_ptr)) return;
25808         void* this_ptr_ptr = untag_ptr(this_ptr);
25809         CHECK_ACCESS(this_ptr_ptr);
25810         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
25811         FREE(untag_ptr(this_ptr));
25812         APIError_free(this_ptr_conv);
25813 }
25814
25815 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
25816         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25817         *ret_copy = APIError_clone(arg);
25818         int64_t ret_ref = tag_ptr(ret_copy, true);
25819         return ret_ref;
25820 }
25821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25822         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
25823         int64_t ret_conv = APIError_clone_ptr(arg_conv);
25824         return ret_conv;
25825 }
25826
25827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25828         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
25829         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25830         *ret_copy = APIError_clone(orig_conv);
25831         int64_t ret_ref = tag_ptr(ret_copy, true);
25832         return ret_ref;
25833 }
25834
25835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
25836         LDKStr err_conv = java_to_owned_str(env, err);
25837         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25838         *ret_copy = APIError_apimisuse_error(err_conv);
25839         int64_t ret_ref = tag_ptr(ret_copy, true);
25840         return ret_ref;
25841 }
25842
25843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
25844         LDKStr err_conv = java_to_owned_str(env, err);
25845         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25846         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
25847         int64_t ret_ref = tag_ptr(ret_copy, true);
25848         return ret_ref;
25849 }
25850
25851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
25852         LDKStr err_conv = java_to_owned_str(env, err);
25853         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25854         *ret_copy = APIError_route_error(err_conv);
25855         int64_t ret_ref = tag_ptr(ret_copy, true);
25856         return ret_ref;
25857 }
25858
25859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
25860         LDKStr err_conv = java_to_owned_str(env, err);
25861         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25862         *ret_copy = APIError_channel_unavailable(err_conv);
25863         int64_t ret_ref = tag_ptr(ret_copy, true);
25864         return ret_ref;
25865 }
25866
25867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
25868         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25869         *ret_copy = APIError_monitor_update_failed();
25870         int64_t ret_ref = tag_ptr(ret_copy, true);
25871         return ret_ref;
25872 }
25873
25874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
25875         LDKShutdownScript script_conv;
25876         script_conv.inner = untag_ptr(script);
25877         script_conv.is_owned = ptr_is_owned(script);
25878         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
25879         script_conv = ShutdownScript_clone(&script_conv);
25880         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
25881         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
25882         int64_t ret_ref = tag_ptr(ret_copy, true);
25883         return ret_ref;
25884 }
25885
25886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25887         LDKBigSize this_obj_conv;
25888         this_obj_conv.inner = untag_ptr(this_obj);
25889         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25891         BigSize_free(this_obj_conv);
25892 }
25893
25894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
25895         LDKBigSize this_ptr_conv;
25896         this_ptr_conv.inner = untag_ptr(this_ptr);
25897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25899         this_ptr_conv.is_owned = false;
25900         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
25901         return ret_conv;
25902 }
25903
25904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25905         LDKBigSize this_ptr_conv;
25906         this_ptr_conv.inner = untag_ptr(this_ptr);
25907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25909         this_ptr_conv.is_owned = false;
25910         BigSize_set_a(&this_ptr_conv, val);
25911 }
25912
25913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
25914         LDKBigSize ret_var = BigSize_new(a_arg);
25915         int64_t ret_ref = 0;
25916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25918         return ret_ref;
25919 }
25920
25921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25922         LDKHostname this_obj_conv;
25923         this_obj_conv.inner = untag_ptr(this_obj);
25924         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25926         Hostname_free(this_obj_conv);
25927 }
25928
25929 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
25930         LDKHostname ret_var = Hostname_clone(arg);
25931         int64_t ret_ref = 0;
25932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25934         return ret_ref;
25935 }
25936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25937         LDKHostname arg_conv;
25938         arg_conv.inner = untag_ptr(arg);
25939         arg_conv.is_owned = ptr_is_owned(arg);
25940         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25941         arg_conv.is_owned = false;
25942         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
25943         return ret_conv;
25944 }
25945
25946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25947         LDKHostname orig_conv;
25948         orig_conv.inner = untag_ptr(orig);
25949         orig_conv.is_owned = ptr_is_owned(orig);
25950         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25951         orig_conv.is_owned = false;
25952         LDKHostname ret_var = Hostname_clone(&orig_conv);
25953         int64_t ret_ref = 0;
25954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25956         return ret_ref;
25957 }
25958
25959 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
25960         LDKHostname this_arg_conv;
25961         this_arg_conv.inner = untag_ptr(this_arg);
25962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25964         this_arg_conv.is_owned = false;
25965         int8_t ret_conv = Hostname_len(&this_arg_conv);
25966         return ret_conv;
25967 }
25968
25969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
25970         LDKu8slice msg_ref;
25971         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25972         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25973         unsigned char sk_arr[32];
25974         CHECK((*env)->GetArrayLength(env, sk) == 32);
25975         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
25976         unsigned char (*sk_ref)[32] = &sk_arr;
25977         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
25978         *ret_conv = sign(msg_ref, sk_ref);
25979         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25980         return tag_ptr(ret_conv, true);
25981 }
25982
25983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
25984         LDKu8slice msg_ref;
25985         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25986         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25987         LDKStr sig_conv = java_to_owned_str(env, sig);
25988         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
25989         *ret_conv = recover_pk(msg_ref, sig_conv);
25990         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
25991         return tag_ptr(ret_conv, true);
25992 }
25993
25994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
25995         LDKu8slice msg_ref;
25996         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
25997         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
25998         LDKStr sig_conv = java_to_owned_str(env, sig);
25999         LDKPublicKey pk_ref;
26000         CHECK((*env)->GetArrayLength(env, pk) == 33);
26001         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
26002         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
26003         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
26004         return ret_conv;
26005 }
26006
26007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
26008         LDKu8slice hrp_bytes_ref;
26009         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
26010         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
26011         LDKCVec_u5Z data_without_signature_constr;
26012         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
26013         if (data_without_signature_constr.datalen > 0)
26014                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
26015         else
26016                 data_without_signature_constr.data = NULL;
26017         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
26018         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
26019                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
26020                 
26021                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
26022         }
26023         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
26024         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
26025         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26026         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26027         CVec_u8Z_free(ret_var);
26028         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
26029         return ret_arr;
26030 }
26031
26032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26033         if (!ptr_is_owned(this_ptr)) return;
26034         void* this_ptr_ptr = untag_ptr(this_ptr);
26035         CHECK_ACCESS(this_ptr_ptr);
26036         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
26037         FREE(untag_ptr(this_ptr));
26038         Persister_free(this_ptr_conv);
26039 }
26040
26041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26042         if (!ptr_is_owned(this_ptr)) return;
26043         void* this_ptr_ptr = untag_ptr(this_ptr);
26044         CHECK_ACCESS(this_ptr_ptr);
26045         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
26046         FREE(untag_ptr(this_ptr));
26047         FutureCallback_free(this_ptr_conv);
26048 }
26049
26050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26051         LDKFuture this_obj_conv;
26052         this_obj_conv.inner = untag_ptr(this_obj);
26053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26055         Future_free(this_obj_conv);
26056 }
26057
26058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
26059         LDKFuture this_arg_conv;
26060         this_arg_conv.inner = untag_ptr(this_arg);
26061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26063         this_arg_conv.is_owned = false;
26064         void* callback_ptr = untag_ptr(callback);
26065         CHECK_ACCESS(callback_ptr);
26066         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
26067         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
26068                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26069                 LDKFutureCallback_JCalls_cloned(&callback_conv);
26070         }
26071         Future_register_callback_fn(&this_arg_conv, callback_conv);
26072 }
26073
26074 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26075         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
26076         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
26077         return ret_conv;
26078 }
26079
26080 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
26081         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
26082         return ret_conv;
26083 }
26084
26085 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
26086         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
26087         return ret_conv;
26088 }
26089
26090 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
26091         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
26092         return ret_conv;
26093 }
26094
26095 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
26096         jclass ret_conv = LDKLevel_to_java(env, Level_info());
26097         return ret_conv;
26098 }
26099
26100 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
26101         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
26102         return ret_conv;
26103 }
26104
26105 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
26106         jclass ret_conv = LDKLevel_to_java(env, Level_error());
26107         return ret_conv;
26108 }
26109
26110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26111         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
26112         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
26113         jboolean ret_conv = Level_eq(a_conv, b_conv);
26114         return ret_conv;
26115 }
26116
26117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
26118         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
26119         int64_t ret_conv = Level_hash(o_conv);
26120         return ret_conv;
26121 }
26122
26123 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
26124         jclass ret_conv = LDKLevel_to_java(env, Level_max());
26125         return ret_conv;
26126 }
26127
26128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26129         LDKRecord this_obj_conv;
26130         this_obj_conv.inner = untag_ptr(this_obj);
26131         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26133         Record_free(this_obj_conv);
26134 }
26135
26136 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
26137         LDKRecord this_ptr_conv;
26138         this_ptr_conv.inner = untag_ptr(this_ptr);
26139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26141         this_ptr_conv.is_owned = false;
26142         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
26143         return ret_conv;
26144 }
26145
26146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
26147         LDKRecord this_ptr_conv;
26148         this_ptr_conv.inner = untag_ptr(this_ptr);
26149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26151         this_ptr_conv.is_owned = false;
26152         LDKLevel val_conv = LDKLevel_from_java(env, val);
26153         Record_set_level(&this_ptr_conv, val_conv);
26154 }
26155
26156 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
26157         LDKRecord this_ptr_conv;
26158         this_ptr_conv.inner = untag_ptr(this_ptr);
26159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26161         this_ptr_conv.is_owned = false;
26162         LDKStr ret_str = Record_get_args(&this_ptr_conv);
26163         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26164         Str_free(ret_str);
26165         return ret_conv;
26166 }
26167
26168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
26169         LDKRecord this_ptr_conv;
26170         this_ptr_conv.inner = untag_ptr(this_ptr);
26171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26173         this_ptr_conv.is_owned = false;
26174         LDKStr val_conv = java_to_owned_str(env, val);
26175         Record_set_args(&this_ptr_conv, val_conv);
26176 }
26177
26178 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
26179         LDKRecord this_ptr_conv;
26180         this_ptr_conv.inner = untag_ptr(this_ptr);
26181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26183         this_ptr_conv.is_owned = false;
26184         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
26185         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26186         Str_free(ret_str);
26187         return ret_conv;
26188 }
26189
26190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
26191         LDKRecord this_ptr_conv;
26192         this_ptr_conv.inner = untag_ptr(this_ptr);
26193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26195         this_ptr_conv.is_owned = false;
26196         LDKStr val_conv = java_to_owned_str(env, val);
26197         Record_set_module_path(&this_ptr_conv, val_conv);
26198 }
26199
26200 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
26201         LDKRecord this_ptr_conv;
26202         this_ptr_conv.inner = untag_ptr(this_ptr);
26203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26205         this_ptr_conv.is_owned = false;
26206         LDKStr ret_str = Record_get_file(&this_ptr_conv);
26207         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26208         Str_free(ret_str);
26209         return ret_conv;
26210 }
26211
26212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
26213         LDKRecord this_ptr_conv;
26214         this_ptr_conv.inner = untag_ptr(this_ptr);
26215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26217         this_ptr_conv.is_owned = false;
26218         LDKStr val_conv = java_to_owned_str(env, val);
26219         Record_set_file(&this_ptr_conv, val_conv);
26220 }
26221
26222 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
26223         LDKRecord this_ptr_conv;
26224         this_ptr_conv.inner = untag_ptr(this_ptr);
26225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26227         this_ptr_conv.is_owned = false;
26228         int32_t ret_conv = Record_get_line(&this_ptr_conv);
26229         return ret_conv;
26230 }
26231
26232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26233         LDKRecord this_ptr_conv;
26234         this_ptr_conv.inner = untag_ptr(this_ptr);
26235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26237         this_ptr_conv.is_owned = false;
26238         Record_set_line(&this_ptr_conv, val);
26239 }
26240
26241 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
26242         LDKRecord ret_var = Record_clone(arg);
26243         int64_t ret_ref = 0;
26244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26246         return ret_ref;
26247 }
26248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26249         LDKRecord arg_conv;
26250         arg_conv.inner = untag_ptr(arg);
26251         arg_conv.is_owned = ptr_is_owned(arg);
26252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26253         arg_conv.is_owned = false;
26254         int64_t ret_conv = Record_clone_ptr(&arg_conv);
26255         return ret_conv;
26256 }
26257
26258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26259         LDKRecord orig_conv;
26260         orig_conv.inner = untag_ptr(orig);
26261         orig_conv.is_owned = ptr_is_owned(orig);
26262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26263         orig_conv.is_owned = false;
26264         LDKRecord ret_var = Record_clone(&orig_conv);
26265         int64_t ret_ref = 0;
26266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26268         return ret_ref;
26269 }
26270
26271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26272         if (!ptr_is_owned(this_ptr)) return;
26273         void* this_ptr_ptr = untag_ptr(this_ptr);
26274         CHECK_ACCESS(this_ptr_ptr);
26275         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
26276         FREE(untag_ptr(this_ptr));
26277         Logger_free(this_ptr_conv);
26278 }
26279
26280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26281         LDKChannelHandshakeConfig this_obj_conv;
26282         this_obj_conv.inner = untag_ptr(this_obj);
26283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26285         ChannelHandshakeConfig_free(this_obj_conv);
26286 }
26287
26288 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
26289         LDKChannelHandshakeConfig this_ptr_conv;
26290         this_ptr_conv.inner = untag_ptr(this_ptr);
26291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26293         this_ptr_conv.is_owned = false;
26294         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
26295         return ret_conv;
26296 }
26297
26298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26299         LDKChannelHandshakeConfig this_ptr_conv;
26300         this_ptr_conv.inner = untag_ptr(this_ptr);
26301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26303         this_ptr_conv.is_owned = false;
26304         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
26305 }
26306
26307 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26308         LDKChannelHandshakeConfig this_ptr_conv;
26309         this_ptr_conv.inner = untag_ptr(this_ptr);
26310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26312         this_ptr_conv.is_owned = false;
26313         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
26314         return ret_conv;
26315 }
26316
26317 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) {
26318         LDKChannelHandshakeConfig this_ptr_conv;
26319         this_ptr_conv.inner = untag_ptr(this_ptr);
26320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26322         this_ptr_conv.is_owned = false;
26323         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
26324 }
26325
26326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26327         LDKChannelHandshakeConfig this_ptr_conv;
26328         this_ptr_conv.inner = untag_ptr(this_ptr);
26329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26331         this_ptr_conv.is_owned = false;
26332         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
26333         return ret_conv;
26334 }
26335
26336 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) {
26337         LDKChannelHandshakeConfig this_ptr_conv;
26338         this_ptr_conv.inner = untag_ptr(this_ptr);
26339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26341         this_ptr_conv.is_owned = false;
26342         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
26343 }
26344
26345 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) {
26346         LDKChannelHandshakeConfig this_ptr_conv;
26347         this_ptr_conv.inner = untag_ptr(this_ptr);
26348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26350         this_ptr_conv.is_owned = false;
26351         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
26352         return ret_conv;
26353 }
26354
26355 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) {
26356         LDKChannelHandshakeConfig this_ptr_conv;
26357         this_ptr_conv.inner = untag_ptr(this_ptr);
26358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26360         this_ptr_conv.is_owned = false;
26361         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
26362 }
26363
26364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
26365         LDKChannelHandshakeConfig this_ptr_conv;
26366         this_ptr_conv.inner = untag_ptr(this_ptr);
26367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26369         this_ptr_conv.is_owned = false;
26370         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
26371         return ret_conv;
26372 }
26373
26374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26375         LDKChannelHandshakeConfig this_ptr_conv;
26376         this_ptr_conv.inner = untag_ptr(this_ptr);
26377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26379         this_ptr_conv.is_owned = false;
26380         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
26381 }
26382
26383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
26384         LDKChannelHandshakeConfig this_ptr_conv;
26385         this_ptr_conv.inner = untag_ptr(this_ptr);
26386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26388         this_ptr_conv.is_owned = false;
26389         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
26390         return ret_conv;
26391 }
26392
26393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26394         LDKChannelHandshakeConfig this_ptr_conv;
26395         this_ptr_conv.inner = untag_ptr(this_ptr);
26396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26398         this_ptr_conv.is_owned = false;
26399         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
26400 }
26401
26402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26403         LDKChannelHandshakeConfig this_ptr_conv;
26404         this_ptr_conv.inner = untag_ptr(this_ptr);
26405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26407         this_ptr_conv.is_owned = false;
26408         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
26409         return ret_conv;
26410 }
26411
26412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26413         LDKChannelHandshakeConfig this_ptr_conv;
26414         this_ptr_conv.inner = untag_ptr(this_ptr);
26415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26417         this_ptr_conv.is_owned = false;
26418         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
26419 }
26420
26421 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26422         LDKChannelHandshakeConfig this_ptr_conv;
26423         this_ptr_conv.inner = untag_ptr(this_ptr);
26424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26426         this_ptr_conv.is_owned = false;
26427         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
26428         return ret_conv;
26429 }
26430
26431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26432         LDKChannelHandshakeConfig this_ptr_conv;
26433         this_ptr_conv.inner = untag_ptr(this_ptr);
26434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26436         this_ptr_conv.is_owned = false;
26437         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
26438 }
26439
26440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int32_t their_channel_reserve_proportional_millionths_arg) {
26441         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg);
26442         int64_t ret_ref = 0;
26443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26445         return ret_ref;
26446 }
26447
26448 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
26449         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
26450         int64_t ret_ref = 0;
26451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26453         return ret_ref;
26454 }
26455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26456         LDKChannelHandshakeConfig arg_conv;
26457         arg_conv.inner = untag_ptr(arg);
26458         arg_conv.is_owned = ptr_is_owned(arg);
26459         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26460         arg_conv.is_owned = false;
26461         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
26462         return ret_conv;
26463 }
26464
26465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26466         LDKChannelHandshakeConfig orig_conv;
26467         orig_conv.inner = untag_ptr(orig);
26468         orig_conv.is_owned = ptr_is_owned(orig);
26469         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26470         orig_conv.is_owned = false;
26471         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
26472         int64_t ret_ref = 0;
26473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26475         return ret_ref;
26476 }
26477
26478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
26479         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
26480         int64_t ret_ref = 0;
26481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26483         return ret_ref;
26484 }
26485
26486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26487         LDKChannelHandshakeLimits this_obj_conv;
26488         this_obj_conv.inner = untag_ptr(this_obj);
26489         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26491         ChannelHandshakeLimits_free(this_obj_conv);
26492 }
26493
26494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26495         LDKChannelHandshakeLimits this_ptr_conv;
26496         this_ptr_conv.inner = untag_ptr(this_ptr);
26497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26499         this_ptr_conv.is_owned = false;
26500         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
26501         return ret_conv;
26502 }
26503
26504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26505         LDKChannelHandshakeLimits this_ptr_conv;
26506         this_ptr_conv.inner = untag_ptr(this_ptr);
26507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26509         this_ptr_conv.is_owned = false;
26510         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
26511 }
26512
26513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26514         LDKChannelHandshakeLimits this_ptr_conv;
26515         this_ptr_conv.inner = untag_ptr(this_ptr);
26516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26518         this_ptr_conv.is_owned = false;
26519         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
26520         return ret_conv;
26521 }
26522
26523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26524         LDKChannelHandshakeLimits this_ptr_conv;
26525         this_ptr_conv.inner = untag_ptr(this_ptr);
26526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26528         this_ptr_conv.is_owned = false;
26529         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
26530 }
26531
26532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26533         LDKChannelHandshakeLimits this_ptr_conv;
26534         this_ptr_conv.inner = untag_ptr(this_ptr);
26535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26537         this_ptr_conv.is_owned = false;
26538         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
26539         return ret_conv;
26540 }
26541
26542 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) {
26543         LDKChannelHandshakeLimits this_ptr_conv;
26544         this_ptr_conv.inner = untag_ptr(this_ptr);
26545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26547         this_ptr_conv.is_owned = false;
26548         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
26549 }
26550
26551 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) {
26552         LDKChannelHandshakeLimits this_ptr_conv;
26553         this_ptr_conv.inner = untag_ptr(this_ptr);
26554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26556         this_ptr_conv.is_owned = false;
26557         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
26558         return ret_conv;
26559 }
26560
26561 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) {
26562         LDKChannelHandshakeLimits this_ptr_conv;
26563         this_ptr_conv.inner = untag_ptr(this_ptr);
26564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26566         this_ptr_conv.is_owned = false;
26567         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
26568 }
26569
26570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26571         LDKChannelHandshakeLimits this_ptr_conv;
26572         this_ptr_conv.inner = untag_ptr(this_ptr);
26573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26575         this_ptr_conv.is_owned = false;
26576         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
26577         return ret_conv;
26578 }
26579
26580 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) {
26581         LDKChannelHandshakeLimits this_ptr_conv;
26582         this_ptr_conv.inner = untag_ptr(this_ptr);
26583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26585         this_ptr_conv.is_owned = false;
26586         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
26587 }
26588
26589 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
26590         LDKChannelHandshakeLimits this_ptr_conv;
26591         this_ptr_conv.inner = untag_ptr(this_ptr);
26592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26594         this_ptr_conv.is_owned = false;
26595         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
26596         return ret_conv;
26597 }
26598
26599 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) {
26600         LDKChannelHandshakeLimits this_ptr_conv;
26601         this_ptr_conv.inner = untag_ptr(this_ptr);
26602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26604         this_ptr_conv.is_owned = false;
26605         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
26606 }
26607
26608 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
26609         LDKChannelHandshakeLimits this_ptr_conv;
26610         this_ptr_conv.inner = untag_ptr(this_ptr);
26611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26613         this_ptr_conv.is_owned = false;
26614         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
26615         return ret_conv;
26616 }
26617
26618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26619         LDKChannelHandshakeLimits this_ptr_conv;
26620         this_ptr_conv.inner = untag_ptr(this_ptr);
26621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26623         this_ptr_conv.is_owned = false;
26624         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
26625 }
26626
26627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
26628         LDKChannelHandshakeLimits this_ptr_conv;
26629         this_ptr_conv.inner = untag_ptr(this_ptr);
26630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26632         this_ptr_conv.is_owned = false;
26633         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
26634         return ret_conv;
26635 }
26636
26637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26638         LDKChannelHandshakeLimits this_ptr_conv;
26639         this_ptr_conv.inner = untag_ptr(this_ptr);
26640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26642         this_ptr_conv.is_owned = false;
26643         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
26644 }
26645
26646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
26647         LDKChannelHandshakeLimits this_ptr_conv;
26648         this_ptr_conv.inner = untag_ptr(this_ptr);
26649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26651         this_ptr_conv.is_owned = false;
26652         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
26653         return ret_conv;
26654 }
26655
26656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26657         LDKChannelHandshakeLimits this_ptr_conv;
26658         this_ptr_conv.inner = untag_ptr(this_ptr);
26659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26661         this_ptr_conv.is_owned = false;
26662         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
26663 }
26664
26665 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26666         LDKChannelHandshakeLimits this_ptr_conv;
26667         this_ptr_conv.inner = untag_ptr(this_ptr);
26668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26670         this_ptr_conv.is_owned = false;
26671         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
26672         return ret_conv;
26673 }
26674
26675 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) {
26676         LDKChannelHandshakeLimits this_ptr_conv;
26677         this_ptr_conv.inner = untag_ptr(this_ptr);
26678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26680         this_ptr_conv.is_owned = false;
26681         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
26682 }
26683
26684 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) {
26685         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);
26686         int64_t ret_ref = 0;
26687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26689         return ret_ref;
26690 }
26691
26692 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
26693         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
26694         int64_t ret_ref = 0;
26695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26697         return ret_ref;
26698 }
26699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26700         LDKChannelHandshakeLimits arg_conv;
26701         arg_conv.inner = untag_ptr(arg);
26702         arg_conv.is_owned = ptr_is_owned(arg);
26703         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26704         arg_conv.is_owned = false;
26705         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
26706         return ret_conv;
26707 }
26708
26709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26710         LDKChannelHandshakeLimits orig_conv;
26711         orig_conv.inner = untag_ptr(orig);
26712         orig_conv.is_owned = ptr_is_owned(orig);
26713         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26714         orig_conv.is_owned = false;
26715         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
26716         int64_t ret_ref = 0;
26717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26719         return ret_ref;
26720 }
26721
26722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
26723         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
26724         int64_t ret_ref = 0;
26725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26727         return ret_ref;
26728 }
26729
26730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26731         LDKChannelConfig this_obj_conv;
26732         this_obj_conv.inner = untag_ptr(this_obj);
26733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26735         ChannelConfig_free(this_obj_conv);
26736 }
26737
26738 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26739         LDKChannelConfig this_ptr_conv;
26740         this_ptr_conv.inner = untag_ptr(this_ptr);
26741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26743         this_ptr_conv.is_owned = false;
26744         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
26745         return ret_conv;
26746 }
26747
26748 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) {
26749         LDKChannelConfig this_ptr_conv;
26750         this_ptr_conv.inner = untag_ptr(this_ptr);
26751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26753         this_ptr_conv.is_owned = false;
26754         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
26755 }
26756
26757 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26758         LDKChannelConfig this_ptr_conv;
26759         this_ptr_conv.inner = untag_ptr(this_ptr);
26760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26762         this_ptr_conv.is_owned = false;
26763         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
26764         return ret_conv;
26765 }
26766
26767 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) {
26768         LDKChannelConfig this_ptr_conv;
26769         this_ptr_conv.inner = untag_ptr(this_ptr);
26770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26772         this_ptr_conv.is_owned = false;
26773         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
26774 }
26775
26776 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26777         LDKChannelConfig this_ptr_conv;
26778         this_ptr_conv.inner = untag_ptr(this_ptr);
26779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26781         this_ptr_conv.is_owned = false;
26782         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
26783         return ret_conv;
26784 }
26785
26786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26787         LDKChannelConfig this_ptr_conv;
26788         this_ptr_conv.inner = untag_ptr(this_ptr);
26789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26791         this_ptr_conv.is_owned = false;
26792         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
26793 }
26794
26795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26796         LDKChannelConfig this_ptr_conv;
26797         this_ptr_conv.inner = untag_ptr(this_ptr);
26798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26800         this_ptr_conv.is_owned = false;
26801         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
26802         return ret_conv;
26803 }
26804
26805 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) {
26806         LDKChannelConfig this_ptr_conv;
26807         this_ptr_conv.inner = untag_ptr(this_ptr);
26808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26810         this_ptr_conv.is_owned = false;
26811         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
26812 }
26813
26814 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) {
26815         LDKChannelConfig this_ptr_conv;
26816         this_ptr_conv.inner = untag_ptr(this_ptr);
26817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26819         this_ptr_conv.is_owned = false;
26820         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
26821         return ret_conv;
26822 }
26823
26824 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) {
26825         LDKChannelConfig this_ptr_conv;
26826         this_ptr_conv.inner = untag_ptr(this_ptr);
26827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26829         this_ptr_conv.is_owned = false;
26830         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
26831 }
26832
26833 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) {
26834         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);
26835         int64_t ret_ref = 0;
26836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26838         return ret_ref;
26839 }
26840
26841 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
26842         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
26843         int64_t ret_ref = 0;
26844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26846         return ret_ref;
26847 }
26848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26849         LDKChannelConfig arg_conv;
26850         arg_conv.inner = untag_ptr(arg);
26851         arg_conv.is_owned = ptr_is_owned(arg);
26852         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26853         arg_conv.is_owned = false;
26854         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
26855         return ret_conv;
26856 }
26857
26858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26859         LDKChannelConfig orig_conv;
26860         orig_conv.inner = untag_ptr(orig);
26861         orig_conv.is_owned = ptr_is_owned(orig);
26862         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26863         orig_conv.is_owned = false;
26864         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
26865         int64_t ret_ref = 0;
26866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26868         return ret_ref;
26869 }
26870
26871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
26872         LDKChannelConfig ret_var = ChannelConfig_default();
26873         int64_t ret_ref = 0;
26874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26876         return ret_ref;
26877 }
26878
26879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
26880         LDKChannelConfig obj_conv;
26881         obj_conv.inner = untag_ptr(obj);
26882         obj_conv.is_owned = ptr_is_owned(obj);
26883         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26884         obj_conv.is_owned = false;
26885         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
26886         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26887         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26888         CVec_u8Z_free(ret_var);
26889         return ret_arr;
26890 }
26891
26892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26893         LDKu8slice ser_ref;
26894         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26895         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26896         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
26897         *ret_conv = ChannelConfig_read(ser_ref);
26898         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26899         return tag_ptr(ret_conv, true);
26900 }
26901
26902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26903         LDKUserConfig this_obj_conv;
26904         this_obj_conv.inner = untag_ptr(this_obj);
26905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26907         UserConfig_free(this_obj_conv);
26908 }
26909
26910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
26911         LDKUserConfig this_ptr_conv;
26912         this_ptr_conv.inner = untag_ptr(this_ptr);
26913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26915         this_ptr_conv.is_owned = false;
26916         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
26917         int64_t ret_ref = 0;
26918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26920         return ret_ref;
26921 }
26922
26923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26924         LDKUserConfig this_ptr_conv;
26925         this_ptr_conv.inner = untag_ptr(this_ptr);
26926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26928         this_ptr_conv.is_owned = false;
26929         LDKChannelHandshakeConfig val_conv;
26930         val_conv.inner = untag_ptr(val);
26931         val_conv.is_owned = ptr_is_owned(val);
26932         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26933         val_conv = ChannelHandshakeConfig_clone(&val_conv);
26934         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
26935 }
26936
26937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
26938         LDKUserConfig this_ptr_conv;
26939         this_ptr_conv.inner = untag_ptr(this_ptr);
26940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26942         this_ptr_conv.is_owned = false;
26943         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
26944         int64_t ret_ref = 0;
26945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26947         return ret_ref;
26948 }
26949
26950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26951         LDKUserConfig this_ptr_conv;
26952         this_ptr_conv.inner = untag_ptr(this_ptr);
26953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26955         this_ptr_conv.is_owned = false;
26956         LDKChannelHandshakeLimits val_conv;
26957         val_conv.inner = untag_ptr(val);
26958         val_conv.is_owned = ptr_is_owned(val);
26959         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26960         val_conv = ChannelHandshakeLimits_clone(&val_conv);
26961         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
26962 }
26963
26964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
26965         LDKUserConfig this_ptr_conv;
26966         this_ptr_conv.inner = untag_ptr(this_ptr);
26967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26969         this_ptr_conv.is_owned = false;
26970         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
26971         int64_t ret_ref = 0;
26972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26974         return ret_ref;
26975 }
26976
26977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26978         LDKUserConfig this_ptr_conv;
26979         this_ptr_conv.inner = untag_ptr(this_ptr);
26980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26982         this_ptr_conv.is_owned = false;
26983         LDKChannelConfig val_conv;
26984         val_conv.inner = untag_ptr(val);
26985         val_conv.is_owned = ptr_is_owned(val);
26986         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26987         val_conv = ChannelConfig_clone(&val_conv);
26988         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
26989 }
26990
26991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
26992         LDKUserConfig this_ptr_conv;
26993         this_ptr_conv.inner = untag_ptr(this_ptr);
26994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26996         this_ptr_conv.is_owned = false;
26997         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
26998         return ret_conv;
26999 }
27000
27001 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) {
27002         LDKUserConfig this_ptr_conv;
27003         this_ptr_conv.inner = untag_ptr(this_ptr);
27004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27006         this_ptr_conv.is_owned = false;
27007         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
27008 }
27009
27010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
27011         LDKUserConfig this_ptr_conv;
27012         this_ptr_conv.inner = untag_ptr(this_ptr);
27013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27015         this_ptr_conv.is_owned = false;
27016         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
27017         return ret_conv;
27018 }
27019
27020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27021         LDKUserConfig this_ptr_conv;
27022         this_ptr_conv.inner = untag_ptr(this_ptr);
27023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27025         this_ptr_conv.is_owned = false;
27026         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
27027 }
27028
27029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
27030         LDKUserConfig 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         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
27036         return ret_conv;
27037 }
27038
27039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27040         LDKUserConfig this_ptr_conv;
27041         this_ptr_conv.inner = untag_ptr(this_ptr);
27042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27044         this_ptr_conv.is_owned = false;
27045         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
27046 }
27047
27048 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) {
27049         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
27050         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
27051         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
27052         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
27053         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
27054         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
27055         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
27056         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
27057         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
27058         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
27059         LDKChannelConfig channel_config_arg_conv;
27060         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
27061         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
27062         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
27063         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
27064         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);
27065         int64_t ret_ref = 0;
27066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27068         return ret_ref;
27069 }
27070
27071 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
27072         LDKUserConfig ret_var = UserConfig_clone(arg);
27073         int64_t ret_ref = 0;
27074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27076         return ret_ref;
27077 }
27078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27079         LDKUserConfig arg_conv;
27080         arg_conv.inner = untag_ptr(arg);
27081         arg_conv.is_owned = ptr_is_owned(arg);
27082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27083         arg_conv.is_owned = false;
27084         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
27085         return ret_conv;
27086 }
27087
27088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27089         LDKUserConfig orig_conv;
27090         orig_conv.inner = untag_ptr(orig);
27091         orig_conv.is_owned = ptr_is_owned(orig);
27092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27093         orig_conv.is_owned = false;
27094         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
27095         int64_t ret_ref = 0;
27096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27098         return ret_ref;
27099 }
27100
27101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
27102         LDKUserConfig ret_var = UserConfig_default();
27103         int64_t ret_ref = 0;
27104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27106         return ret_ref;
27107 }
27108
27109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27110         LDKBestBlock this_obj_conv;
27111         this_obj_conv.inner = untag_ptr(this_obj);
27112         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27114         BestBlock_free(this_obj_conv);
27115 }
27116
27117 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
27118         LDKBestBlock ret_var = BestBlock_clone(arg);
27119         int64_t ret_ref = 0;
27120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27122         return ret_ref;
27123 }
27124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27125         LDKBestBlock arg_conv;
27126         arg_conv.inner = untag_ptr(arg);
27127         arg_conv.is_owned = ptr_is_owned(arg);
27128         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27129         arg_conv.is_owned = false;
27130         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
27131         return ret_conv;
27132 }
27133
27134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27135         LDKBestBlock orig_conv;
27136         orig_conv.inner = untag_ptr(orig);
27137         orig_conv.is_owned = ptr_is_owned(orig);
27138         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27139         orig_conv.is_owned = false;
27140         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
27141         int64_t ret_ref = 0;
27142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27144         return ret_ref;
27145 }
27146
27147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
27148         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
27149         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
27150         int64_t ret_ref = 0;
27151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27153         return ret_ref;
27154 }
27155
27156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
27157         LDKThirtyTwoBytes block_hash_ref;
27158         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
27159         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
27160         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
27161         int64_t ret_ref = 0;
27162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27164         return ret_ref;
27165 }
27166
27167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27168         LDKBestBlock this_arg_conv;
27169         this_arg_conv.inner = untag_ptr(this_arg);
27170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27172         this_arg_conv.is_owned = false;
27173         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27174         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
27175         return ret_arr;
27176 }
27177
27178 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
27179         LDKBestBlock this_arg_conv;
27180         this_arg_conv.inner = untag_ptr(this_arg);
27181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27183         this_arg_conv.is_owned = false;
27184         int32_t ret_conv = BestBlock_height(&this_arg_conv);
27185         return ret_conv;
27186 }
27187
27188 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27189         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
27190         jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
27191         return ret_conv;
27192 }
27193
27194 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
27195         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
27196         return ret_conv;
27197 }
27198
27199 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
27200         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
27201         return ret_conv;
27202 }
27203
27204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27205         if (!ptr_is_owned(this_ptr)) return;
27206         void* this_ptr_ptr = untag_ptr(this_ptr);
27207         CHECK_ACCESS(this_ptr_ptr);
27208         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
27209         FREE(untag_ptr(this_ptr));
27210         Access_free(this_ptr_conv);
27211 }
27212
27213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27214         if (!ptr_is_owned(this_ptr)) return;
27215         void* this_ptr_ptr = untag_ptr(this_ptr);
27216         CHECK_ACCESS(this_ptr_ptr);
27217         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
27218         FREE(untag_ptr(this_ptr));
27219         Listen_free(this_ptr_conv);
27220 }
27221
27222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27223         if (!ptr_is_owned(this_ptr)) return;
27224         void* this_ptr_ptr = untag_ptr(this_ptr);
27225         CHECK_ACCESS(this_ptr_ptr);
27226         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
27227         FREE(untag_ptr(this_ptr));
27228         Confirm_free(this_ptr_conv);
27229 }
27230
27231 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27232         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
27233         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
27234         return ret_conv;
27235 }
27236
27237 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
27238         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
27239         return ret_conv;
27240 }
27241
27242 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
27243         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
27244         return ret_conv;
27245 }
27246
27247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27248         if (!ptr_is_owned(this_ptr)) return;
27249         void* this_ptr_ptr = untag_ptr(this_ptr);
27250         CHECK_ACCESS(this_ptr_ptr);
27251         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
27252         FREE(untag_ptr(this_ptr));
27253         Watch_free(this_ptr_conv);
27254 }
27255
27256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27257         if (!ptr_is_owned(this_ptr)) return;
27258         void* this_ptr_ptr = untag_ptr(this_ptr);
27259         CHECK_ACCESS(this_ptr_ptr);
27260         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
27261         FREE(untag_ptr(this_ptr));
27262         Filter_free(this_ptr_conv);
27263 }
27264
27265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27266         LDKWatchedOutput this_obj_conv;
27267         this_obj_conv.inner = untag_ptr(this_obj);
27268         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27270         WatchedOutput_free(this_obj_conv);
27271 }
27272
27273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
27274         LDKWatchedOutput this_ptr_conv;
27275         this_ptr_conv.inner = untag_ptr(this_ptr);
27276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27278         this_ptr_conv.is_owned = false;
27279         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27280         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
27281         return ret_arr;
27282 }
27283
27284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27285         LDKWatchedOutput this_ptr_conv;
27286         this_ptr_conv.inner = untag_ptr(this_ptr);
27287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27289         this_ptr_conv.is_owned = false;
27290         LDKThirtyTwoBytes val_ref;
27291         CHECK((*env)->GetArrayLength(env, val) == 32);
27292         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27293         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
27294 }
27295
27296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27297         LDKWatchedOutput this_ptr_conv;
27298         this_ptr_conv.inner = untag_ptr(this_ptr);
27299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27301         this_ptr_conv.is_owned = false;
27302         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
27303         int64_t ret_ref = 0;
27304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27306         return ret_ref;
27307 }
27308
27309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27310         LDKWatchedOutput this_ptr_conv;
27311         this_ptr_conv.inner = untag_ptr(this_ptr);
27312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27314         this_ptr_conv.is_owned = false;
27315         LDKOutPoint val_conv;
27316         val_conv.inner = untag_ptr(val);
27317         val_conv.is_owned = ptr_is_owned(val);
27318         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27319         val_conv = OutPoint_clone(&val_conv);
27320         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
27321 }
27322
27323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27324         LDKWatchedOutput 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         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
27330         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27331         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27332         return ret_arr;
27333 }
27334
27335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27336         LDKWatchedOutput 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         LDKCVec_u8Z val_ref;
27342         val_ref.datalen = (*env)->GetArrayLength(env, val);
27343         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
27344         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
27345         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
27346 }
27347
27348 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) {
27349         LDKThirtyTwoBytes block_hash_arg_ref;
27350         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
27351         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
27352         LDKOutPoint outpoint_arg_conv;
27353         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
27354         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
27355         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27356         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27357         LDKCVec_u8Z script_pubkey_arg_ref;
27358         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
27359         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
27360         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
27361         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
27362         int64_t ret_ref = 0;
27363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27365         return ret_ref;
27366 }
27367
27368 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
27369         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
27370         int64_t ret_ref = 0;
27371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27373         return ret_ref;
27374 }
27375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27376         LDKWatchedOutput arg_conv;
27377         arg_conv.inner = untag_ptr(arg);
27378         arg_conv.is_owned = ptr_is_owned(arg);
27379         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27380         arg_conv.is_owned = false;
27381         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
27382         return ret_conv;
27383 }
27384
27385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27386         LDKWatchedOutput orig_conv;
27387         orig_conv.inner = untag_ptr(orig);
27388         orig_conv.is_owned = ptr_is_owned(orig);
27389         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27390         orig_conv.is_owned = false;
27391         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
27392         int64_t ret_ref = 0;
27393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27395         return ret_ref;
27396 }
27397
27398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
27399         LDKWatchedOutput o_conv;
27400         o_conv.inner = untag_ptr(o);
27401         o_conv.is_owned = ptr_is_owned(o);
27402         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27403         o_conv.is_owned = false;
27404         int64_t ret_conv = WatchedOutput_hash(&o_conv);
27405         return ret_conv;
27406 }
27407
27408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27409         if (!ptr_is_owned(this_ptr)) return;
27410         void* this_ptr_ptr = untag_ptr(this_ptr);
27411         CHECK_ACCESS(this_ptr_ptr);
27412         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
27413         FREE(untag_ptr(this_ptr));
27414         BroadcasterInterface_free(this_ptr_conv);
27415 }
27416
27417 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27418         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
27419         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
27420         return ret_conv;
27421 }
27422
27423 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
27424         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
27425         return ret_conv;
27426 }
27427
27428 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
27429         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
27430         return ret_conv;
27431 }
27432
27433 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
27434         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
27435         return ret_conv;
27436 }
27437
27438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27439         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
27440         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
27441         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
27442         return ret_conv;
27443 }
27444
27445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27446         if (!ptr_is_owned(this_ptr)) return;
27447         void* this_ptr_ptr = untag_ptr(this_ptr);
27448         CHECK_ACCESS(this_ptr_ptr);
27449         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
27450         FREE(untag_ptr(this_ptr));
27451         FeeEstimator_free(this_ptr_conv);
27452 }
27453
27454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27455         LDKMonitorUpdateId this_obj_conv;
27456         this_obj_conv.inner = untag_ptr(this_obj);
27457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27459         MonitorUpdateId_free(this_obj_conv);
27460 }
27461
27462 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
27463         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
27464         int64_t ret_ref = 0;
27465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27467         return ret_ref;
27468 }
27469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27470         LDKMonitorUpdateId arg_conv;
27471         arg_conv.inner = untag_ptr(arg);
27472         arg_conv.is_owned = ptr_is_owned(arg);
27473         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27474         arg_conv.is_owned = false;
27475         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
27476         return ret_conv;
27477 }
27478
27479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27480         LDKMonitorUpdateId orig_conv;
27481         orig_conv.inner = untag_ptr(orig);
27482         orig_conv.is_owned = ptr_is_owned(orig);
27483         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27484         orig_conv.is_owned = false;
27485         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
27486         int64_t ret_ref = 0;
27487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27489         return ret_ref;
27490 }
27491
27492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
27493         LDKMonitorUpdateId o_conv;
27494         o_conv.inner = untag_ptr(o);
27495         o_conv.is_owned = ptr_is_owned(o);
27496         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27497         o_conv.is_owned = false;
27498         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
27499         return ret_conv;
27500 }
27501
27502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27503         LDKMonitorUpdateId a_conv;
27504         a_conv.inner = untag_ptr(a);
27505         a_conv.is_owned = ptr_is_owned(a);
27506         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27507         a_conv.is_owned = false;
27508         LDKMonitorUpdateId b_conv;
27509         b_conv.inner = untag_ptr(b);
27510         b_conv.is_owned = ptr_is_owned(b);
27511         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27512         b_conv.is_owned = false;
27513         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
27514         return ret_conv;
27515 }
27516
27517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27518         if (!ptr_is_owned(this_ptr)) return;
27519         void* this_ptr_ptr = untag_ptr(this_ptr);
27520         CHECK_ACCESS(this_ptr_ptr);
27521         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
27522         FREE(untag_ptr(this_ptr));
27523         Persist_free(this_ptr_conv);
27524 }
27525
27526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27527         LDKLockedChannelMonitor this_obj_conv;
27528         this_obj_conv.inner = untag_ptr(this_obj);
27529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27531         LockedChannelMonitor_free(this_obj_conv);
27532 }
27533
27534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27535         LDKChainMonitor this_obj_conv;
27536         this_obj_conv.inner = untag_ptr(this_obj);
27537         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27539         ChainMonitor_free(this_obj_conv);
27540 }
27541
27542 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) {
27543         void* chain_source_ptr = untag_ptr(chain_source);
27544         CHECK_ACCESS(chain_source_ptr);
27545         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
27546         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
27547         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
27548                 // Manually implement clone for Java trait instances
27549                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
27550                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27551                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
27552                 }
27553         }
27554         void* broadcaster_ptr = untag_ptr(broadcaster);
27555         CHECK_ACCESS(broadcaster_ptr);
27556         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
27557         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27558                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27559                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
27560         }
27561         void* logger_ptr = untag_ptr(logger);
27562         CHECK_ACCESS(logger_ptr);
27563         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27564         if (logger_conv.free == LDKLogger_JCalls_free) {
27565                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27566                 LDKLogger_JCalls_cloned(&logger_conv);
27567         }
27568         void* feeest_ptr = untag_ptr(feeest);
27569         CHECK_ACCESS(feeest_ptr);
27570         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
27571         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
27572                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27573                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
27574         }
27575         void* persister_ptr = untag_ptr(persister);
27576         CHECK_ACCESS(persister_ptr);
27577         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
27578         if (persister_conv.free == LDKPersist_JCalls_free) {
27579                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27580                 LDKPersist_JCalls_cloned(&persister_conv);
27581         }
27582         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
27583         int64_t ret_ref = 0;
27584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27586         return ret_ref;
27587 }
27588
27589 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) {
27590         LDKChainMonitor this_arg_conv;
27591         this_arg_conv.inner = untag_ptr(this_arg);
27592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27594         this_arg_conv.is_owned = false;
27595         LDKCVec_ChannelDetailsZ ignored_channels_constr;
27596         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
27597         if (ignored_channels_constr.datalen > 0)
27598                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27599         else
27600                 ignored_channels_constr.data = NULL;
27601         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
27602         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
27603                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
27604                 LDKChannelDetails ignored_channels_conv_16_conv;
27605                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
27606                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
27607                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
27608                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
27609                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
27610         }
27611         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
27612         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
27613         int64_tArray ret_arr = NULL;
27614         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27615         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27616         for (size_t j = 0; j < ret_var.datalen; j++) {
27617                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27618                 *ret_conv_9_copy = ret_var.data[j];
27619                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
27620                 ret_arr_ptr[j] = ret_conv_9_ref;
27621         }
27622         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27623         FREE(ret_var.data);
27624         return ret_arr;
27625 }
27626
27627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
27628         LDKChainMonitor this_arg_conv;
27629         this_arg_conv.inner = untag_ptr(this_arg);
27630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27632         this_arg_conv.is_owned = false;
27633         LDKOutPoint funding_txo_conv;
27634         funding_txo_conv.inner = untag_ptr(funding_txo);
27635         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
27636         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27637         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27638         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
27639         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
27640         return tag_ptr(ret_conv, true);
27641 }
27642
27643 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
27644         LDKChainMonitor this_arg_conv;
27645         this_arg_conv.inner = untag_ptr(this_arg);
27646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27648         this_arg_conv.is_owned = false;
27649         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
27650         int64_tArray ret_arr = NULL;
27651         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27652         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27653         for (size_t k = 0; k < ret_var.datalen; k++) {
27654                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
27655                 int64_t ret_conv_10_ref = 0;
27656                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
27657                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
27658                 ret_arr_ptr[k] = ret_conv_10_ref;
27659         }
27660         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27661         FREE(ret_var.data);
27662         return ret_arr;
27663 }
27664
27665 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) {
27666         LDKChainMonitor this_arg_conv;
27667         this_arg_conv.inner = untag_ptr(this_arg);
27668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27670         this_arg_conv.is_owned = false;
27671         LDKOutPoint funding_txo_conv;
27672         funding_txo_conv.inner = untag_ptr(funding_txo);
27673         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
27674         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27675         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27676         LDKMonitorUpdateId completed_update_id_conv;
27677         completed_update_id_conv.inner = untag_ptr(completed_update_id);
27678         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
27679         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
27680         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
27681         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27682         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
27683         return tag_ptr(ret_conv, true);
27684 }
27685
27686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
27687         LDKChainMonitor this_arg_conv;
27688         this_arg_conv.inner = untag_ptr(this_arg);
27689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27691         this_arg_conv.is_owned = false;
27692         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27693         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
27694         return tag_ptr(ret_ret, true);
27695 }
27696
27697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
27698         LDKChainMonitor this_arg_conv;
27699         this_arg_conv.inner = untag_ptr(this_arg);
27700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27702         this_arg_conv.is_owned = false;
27703         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27704         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
27705         return tag_ptr(ret_ret, true);
27706 }
27707
27708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
27709         LDKChainMonitor this_arg_conv;
27710         this_arg_conv.inner = untag_ptr(this_arg);
27711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27713         this_arg_conv.is_owned = false;
27714         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
27715         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
27716         return tag_ptr(ret_ret, true);
27717 }
27718
27719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27720         LDKChainMonitor this_arg_conv;
27721         this_arg_conv.inner = untag_ptr(this_arg);
27722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27724         this_arg_conv.is_owned = false;
27725         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27726         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
27727         return tag_ptr(ret_ret, true);
27728 }
27729
27730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27731         LDKChannelMonitorUpdate this_obj_conv;
27732         this_obj_conv.inner = untag_ptr(this_obj);
27733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27735         ChannelMonitorUpdate_free(this_obj_conv);
27736 }
27737
27738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27739         LDKChannelMonitorUpdate this_ptr_conv;
27740         this_ptr_conv.inner = untag_ptr(this_ptr);
27741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27743         this_ptr_conv.is_owned = false;
27744         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
27745         return ret_conv;
27746 }
27747
27748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27749         LDKChannelMonitorUpdate this_ptr_conv;
27750         this_ptr_conv.inner = untag_ptr(this_ptr);
27751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27753         this_ptr_conv.is_owned = false;
27754         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
27755 }
27756
27757 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
27758         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
27759         int64_t ret_ref = 0;
27760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27762         return ret_ref;
27763 }
27764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27765         LDKChannelMonitorUpdate arg_conv;
27766         arg_conv.inner = untag_ptr(arg);
27767         arg_conv.is_owned = ptr_is_owned(arg);
27768         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27769         arg_conv.is_owned = false;
27770         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
27771         return ret_conv;
27772 }
27773
27774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27775         LDKChannelMonitorUpdate orig_conv;
27776         orig_conv.inner = untag_ptr(orig);
27777         orig_conv.is_owned = ptr_is_owned(orig);
27778         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27779         orig_conv.is_owned = false;
27780         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
27781         int64_t ret_ref = 0;
27782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27784         return ret_ref;
27785 }
27786
27787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27788         LDKChannelMonitorUpdate obj_conv;
27789         obj_conv.inner = untag_ptr(obj);
27790         obj_conv.is_owned = ptr_is_owned(obj);
27791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27792         obj_conv.is_owned = false;
27793         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
27794         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27795         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27796         CVec_u8Z_free(ret_var);
27797         return ret_arr;
27798 }
27799
27800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27801         LDKu8slice ser_ref;
27802         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27803         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27804         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
27805         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
27806         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27807         return tag_ptr(ret_conv, true);
27808 }
27809
27810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27811         if (!ptr_is_owned(this_ptr)) return;
27812         void* this_ptr_ptr = untag_ptr(this_ptr);
27813         CHECK_ACCESS(this_ptr_ptr);
27814         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
27815         FREE(untag_ptr(this_ptr));
27816         MonitorEvent_free(this_ptr_conv);
27817 }
27818
27819 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
27820         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27821         *ret_copy = MonitorEvent_clone(arg);
27822         int64_t ret_ref = tag_ptr(ret_copy, true);
27823         return ret_ref;
27824 }
27825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27826         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
27827         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
27828         return ret_conv;
27829 }
27830
27831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27832         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
27833         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27834         *ret_copy = MonitorEvent_clone(orig_conv);
27835         int64_t ret_ref = tag_ptr(ret_copy, true);
27836         return ret_ref;
27837 }
27838
27839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
27840         LDKHTLCUpdate a_conv;
27841         a_conv.inner = untag_ptr(a);
27842         a_conv.is_owned = ptr_is_owned(a);
27843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27844         a_conv = HTLCUpdate_clone(&a_conv);
27845         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27846         *ret_copy = MonitorEvent_htlcevent(a_conv);
27847         int64_t ret_ref = tag_ptr(ret_copy, true);
27848         return ret_ref;
27849 }
27850
27851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
27852         LDKOutPoint a_conv;
27853         a_conv.inner = untag_ptr(a);
27854         a_conv.is_owned = ptr_is_owned(a);
27855         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27856         a_conv = OutPoint_clone(&a_conv);
27857         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27858         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
27859         int64_t ret_ref = tag_ptr(ret_copy, true);
27860         return ret_ref;
27861 }
27862
27863 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) {
27864         LDKOutPoint funding_txo_conv;
27865         funding_txo_conv.inner = untag_ptr(funding_txo);
27866         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
27867         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
27868         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
27869         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27870         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
27871         int64_t ret_ref = tag_ptr(ret_copy, true);
27872         return ret_ref;
27873 }
27874
27875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
27876         LDKOutPoint a_conv;
27877         a_conv.inner = untag_ptr(a);
27878         a_conv.is_owned = ptr_is_owned(a);
27879         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27880         a_conv = OutPoint_clone(&a_conv);
27881         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
27882         *ret_copy = MonitorEvent_update_failed(a_conv);
27883         int64_t ret_ref = tag_ptr(ret_copy, true);
27884         return ret_ref;
27885 }
27886
27887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
27888         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
27889         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
27890         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27891         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27892         CVec_u8Z_free(ret_var);
27893         return ret_arr;
27894 }
27895
27896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27897         LDKu8slice ser_ref;
27898         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27899         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27900         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
27901         *ret_conv = MonitorEvent_read(ser_ref);
27902         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27903         return tag_ptr(ret_conv, true);
27904 }
27905
27906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27907         LDKHTLCUpdate this_obj_conv;
27908         this_obj_conv.inner = untag_ptr(this_obj);
27909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27911         HTLCUpdate_free(this_obj_conv);
27912 }
27913
27914 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
27915         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
27916         int64_t ret_ref = 0;
27917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27919         return ret_ref;
27920 }
27921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27922         LDKHTLCUpdate arg_conv;
27923         arg_conv.inner = untag_ptr(arg);
27924         arg_conv.is_owned = ptr_is_owned(arg);
27925         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27926         arg_conv.is_owned = false;
27927         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
27928         return ret_conv;
27929 }
27930
27931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27932         LDKHTLCUpdate orig_conv;
27933         orig_conv.inner = untag_ptr(orig);
27934         orig_conv.is_owned = ptr_is_owned(orig);
27935         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27936         orig_conv.is_owned = false;
27937         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
27938         int64_t ret_ref = 0;
27939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27941         return ret_ref;
27942 }
27943
27944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27945         LDKHTLCUpdate obj_conv;
27946         obj_conv.inner = untag_ptr(obj);
27947         obj_conv.is_owned = ptr_is_owned(obj);
27948         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27949         obj_conv.is_owned = false;
27950         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
27951         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27952         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27953         CVec_u8Z_free(ret_var);
27954         return ret_arr;
27955 }
27956
27957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27958         LDKu8slice ser_ref;
27959         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27960         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27961         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
27962         *ret_conv = HTLCUpdate_read(ser_ref);
27963         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27964         return tag_ptr(ret_conv, true);
27965 }
27966
27967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27968         if (!ptr_is_owned(this_ptr)) return;
27969         void* this_ptr_ptr = untag_ptr(this_ptr);
27970         CHECK_ACCESS(this_ptr_ptr);
27971         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
27972         FREE(untag_ptr(this_ptr));
27973         Balance_free(this_ptr_conv);
27974 }
27975
27976 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
27977         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27978         *ret_copy = Balance_clone(arg);
27979         int64_t ret_ref = tag_ptr(ret_copy, true);
27980         return ret_ref;
27981 }
27982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27983         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
27984         int64_t ret_conv = Balance_clone_ptr(arg_conv);
27985         return ret_conv;
27986 }
27987
27988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27989         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
27990         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27991         *ret_copy = Balance_clone(orig_conv);
27992         int64_t ret_ref = tag_ptr(ret_copy, true);
27993         return ret_ref;
27994 }
27995
27996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
27997         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
27998         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
27999         int64_t ret_ref = tag_ptr(ret_copy, true);
28000         return ret_ref;
28001 }
28002
28003 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) {
28004         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28005         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
28006         int64_t ret_ref = tag_ptr(ret_copy, true);
28007         return ret_ref;
28008 }
28009
28010 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) {
28011         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28012         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
28013         int64_t ret_ref = tag_ptr(ret_copy, true);
28014         return ret_ref;
28015 }
28016
28017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1timeout_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
28018         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28019         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
28020         int64_t ret_ref = tag_ptr(ret_copy, true);
28021         return ret_ref;
28022 }
28023
28024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1preimage_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t expiry_height) {
28025         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28026         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
28027         int64_t ret_ref = tag_ptr(ret_copy, true);
28028         return ret_ref;
28029 }
28030
28031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
28032         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28033         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
28034         int64_t ret_ref = tag_ptr(ret_copy, true);
28035         return ret_ref;
28036 }
28037
28038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28039         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
28040         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
28041         jboolean ret_conv = Balance_eq(a_conv, b_conv);
28042         return ret_conv;
28043 }
28044
28045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28046         LDKChannelMonitor this_obj_conv;
28047         this_obj_conv.inner = untag_ptr(this_obj);
28048         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28050         ChannelMonitor_free(this_obj_conv);
28051 }
28052
28053 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
28054         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
28055         int64_t ret_ref = 0;
28056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28058         return ret_ref;
28059 }
28060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28061         LDKChannelMonitor arg_conv;
28062         arg_conv.inner = untag_ptr(arg);
28063         arg_conv.is_owned = ptr_is_owned(arg);
28064         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28065         arg_conv.is_owned = false;
28066         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
28067         return ret_conv;
28068 }
28069
28070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28071         LDKChannelMonitor orig_conv;
28072         orig_conv.inner = untag_ptr(orig);
28073         orig_conv.is_owned = ptr_is_owned(orig);
28074         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28075         orig_conv.is_owned = false;
28076         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
28077         int64_t ret_ref = 0;
28078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28080         return ret_ref;
28081 }
28082
28083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28084         LDKChannelMonitor obj_conv;
28085         obj_conv.inner = untag_ptr(obj);
28086         obj_conv.is_owned = ptr_is_owned(obj);
28087         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28088         obj_conv.is_owned = false;
28089         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
28090         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28091         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28092         CVec_u8Z_free(ret_var);
28093         return ret_arr;
28094 }
28095
28096 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) {
28097         LDKChannelMonitor this_arg_conv;
28098         this_arg_conv.inner = untag_ptr(this_arg);
28099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28101         this_arg_conv.is_owned = false;
28102         LDKChannelMonitorUpdate updates_conv;
28103         updates_conv.inner = untag_ptr(updates);
28104         updates_conv.is_owned = ptr_is_owned(updates);
28105         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
28106         updates_conv.is_owned = false;
28107         void* broadcaster_ptr = untag_ptr(broadcaster);
28108         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
28109         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
28110         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28111         CHECK_ACCESS(fee_estimator_ptr);
28112         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28113         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28114                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28115                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28116         }
28117         void* logger_ptr = untag_ptr(logger);
28118         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
28119         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
28120         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
28121         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
28122         return tag_ptr(ret_conv, true);
28123 }
28124
28125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
28126         LDKChannelMonitor this_arg_conv;
28127         this_arg_conv.inner = untag_ptr(this_arg);
28128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28130         this_arg_conv.is_owned = false;
28131         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
28132         return ret_conv;
28133 }
28134
28135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
28136         LDKChannelMonitor this_arg_conv;
28137         this_arg_conv.inner = untag_ptr(this_arg);
28138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28140         this_arg_conv.is_owned = false;
28141         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
28142         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
28143         return tag_ptr(ret_conv, true);
28144 }
28145
28146 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
28147         LDKChannelMonitor this_arg_conv;
28148         this_arg_conv.inner = untag_ptr(this_arg);
28149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28151         this_arg_conv.is_owned = false;
28152         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
28153         int64_tArray ret_arr = NULL;
28154         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28155         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28156         for (size_t o = 0; o < ret_var.datalen; o++) {
28157                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
28158                 *ret_conv_40_conv = ret_var.data[o];
28159                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
28160         }
28161         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28162         FREE(ret_var.data);
28163         return ret_arr;
28164 }
28165
28166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
28167         LDKChannelMonitor this_arg_conv;
28168         this_arg_conv.inner = untag_ptr(this_arg);
28169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28171         this_arg_conv.is_owned = false;
28172         void* filter_ptr = untag_ptr(filter);
28173         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
28174         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
28175         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
28176 }
28177
28178 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
28179         LDKChannelMonitor this_arg_conv;
28180         this_arg_conv.inner = untag_ptr(this_arg);
28181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28183         this_arg_conv.is_owned = false;
28184         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
28185         int64_tArray ret_arr = NULL;
28186         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28187         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28188         for (size_t o = 0; o < ret_var.datalen; o++) {
28189                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
28190                 *ret_conv_14_copy = ret_var.data[o];
28191                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
28192                 ret_arr_ptr[o] = ret_conv_14_ref;
28193         }
28194         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28195         FREE(ret_var.data);
28196         return ret_arr;
28197 }
28198
28199 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
28200         LDKChannelMonitor this_arg_conv;
28201         this_arg_conv.inner = untag_ptr(this_arg);
28202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28204         this_arg_conv.is_owned = false;
28205         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
28206         int64_tArray ret_arr = NULL;
28207         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28208         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28209         for (size_t h = 0; h < ret_var.datalen; h++) {
28210                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
28211                 *ret_conv_7_copy = ret_var.data[h];
28212                 int64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
28213                 ret_arr_ptr[h] = ret_conv_7_ref;
28214         }
28215         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28216         FREE(ret_var.data);
28217         return ret_arr;
28218 }
28219
28220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
28221         LDKChannelMonitor this_arg_conv;
28222         this_arg_conv.inner = untag_ptr(this_arg);
28223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28225         this_arg_conv.is_owned = false;
28226         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28227         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
28228         return ret_arr;
28229 }
28230
28231 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) {
28232         LDKChannelMonitor this_arg_conv;
28233         this_arg_conv.inner = untag_ptr(this_arg);
28234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28236         this_arg_conv.is_owned = false;
28237         void* logger_ptr = untag_ptr(logger);
28238         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
28239         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
28240         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
28241         jobjectArray ret_arr = NULL;
28242         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
28243         ;
28244         for (size_t i = 0; i < ret_var.datalen; i++) {
28245                 LDKTransaction ret_conv_8_var = ret_var.data[i];
28246                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
28247                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
28248                 Transaction_free(ret_conv_8_var);
28249                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
28250         }
28251         
28252         FREE(ret_var.data);
28253         return ret_arr;
28254 }
28255
28256 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) {
28257         LDKChannelMonitor this_arg_conv;
28258         this_arg_conv.inner = untag_ptr(this_arg);
28259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28261         this_arg_conv.is_owned = false;
28262         unsigned char header_arr[80];
28263         CHECK((*env)->GetArrayLength(env, header) == 80);
28264         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
28265         unsigned char (*header_ref)[80] = &header_arr;
28266         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
28267         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
28268         if (txdata_constr.datalen > 0)
28269                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
28270         else
28271                 txdata_constr.data = NULL;
28272         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
28273         for (size_t c = 0; c < txdata_constr.datalen; c++) {
28274                 int64_t txdata_conv_28 = txdata_vals[c];
28275                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
28276                 CHECK_ACCESS(txdata_conv_28_ptr);
28277                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
28278                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
28279                 txdata_constr.data[c] = txdata_conv_28_conv;
28280         }
28281         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
28282         void* broadcaster_ptr = untag_ptr(broadcaster);
28283         CHECK_ACCESS(broadcaster_ptr);
28284         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
28285         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28286                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28287                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
28288         }
28289         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28290         CHECK_ACCESS(fee_estimator_ptr);
28291         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28292         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28293                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28294                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28295         }
28296         void* logger_ptr = untag_ptr(logger);
28297         CHECK_ACCESS(logger_ptr);
28298         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28299         if (logger_conv.free == LDKLogger_JCalls_free) {
28300                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28301                 LDKLogger_JCalls_cloned(&logger_conv);
28302         }
28303         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);
28304         int64_tArray ret_arr = NULL;
28305         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28306         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28307         for (size_t n = 0; n < ret_var.datalen; n++) {
28308                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
28309                 *ret_conv_39_conv = ret_var.data[n];
28310                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
28311         }
28312         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28313         FREE(ret_var.data);
28314         return ret_arr;
28315 }
28316
28317 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) {
28318         LDKChannelMonitor this_arg_conv;
28319         this_arg_conv.inner = untag_ptr(this_arg);
28320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28322         this_arg_conv.is_owned = false;
28323         unsigned char header_arr[80];
28324         CHECK((*env)->GetArrayLength(env, header) == 80);
28325         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
28326         unsigned char (*header_ref)[80] = &header_arr;
28327         void* broadcaster_ptr = untag_ptr(broadcaster);
28328         CHECK_ACCESS(broadcaster_ptr);
28329         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
28330         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28332                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
28333         }
28334         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28335         CHECK_ACCESS(fee_estimator_ptr);
28336         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28337         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28339                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28340         }
28341         void* logger_ptr = untag_ptr(logger);
28342         CHECK_ACCESS(logger_ptr);
28343         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28344         if (logger_conv.free == LDKLogger_JCalls_free) {
28345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28346                 LDKLogger_JCalls_cloned(&logger_conv);
28347         }
28348         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
28349 }
28350
28351 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) {
28352         LDKChannelMonitor this_arg_conv;
28353         this_arg_conv.inner = untag_ptr(this_arg);
28354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28356         this_arg_conv.is_owned = false;
28357         unsigned char header_arr[80];
28358         CHECK((*env)->GetArrayLength(env, header) == 80);
28359         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
28360         unsigned char (*header_ref)[80] = &header_arr;
28361         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
28362         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
28363         if (txdata_constr.datalen > 0)
28364                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
28365         else
28366                 txdata_constr.data = NULL;
28367         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
28368         for (size_t c = 0; c < txdata_constr.datalen; c++) {
28369                 int64_t txdata_conv_28 = txdata_vals[c];
28370                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
28371                 CHECK_ACCESS(txdata_conv_28_ptr);
28372                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
28373                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
28374                 txdata_constr.data[c] = txdata_conv_28_conv;
28375         }
28376         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
28377         void* broadcaster_ptr = untag_ptr(broadcaster);
28378         CHECK_ACCESS(broadcaster_ptr);
28379         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
28380         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28382                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
28383         }
28384         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28385         CHECK_ACCESS(fee_estimator_ptr);
28386         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28387         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28389                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28390         }
28391         void* logger_ptr = untag_ptr(logger);
28392         CHECK_ACCESS(logger_ptr);
28393         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28394         if (logger_conv.free == LDKLogger_JCalls_free) {
28395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28396                 LDKLogger_JCalls_cloned(&logger_conv);
28397         }
28398         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);
28399         int64_tArray ret_arr = NULL;
28400         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28401         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28402         for (size_t n = 0; n < ret_var.datalen; n++) {
28403                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
28404                 *ret_conv_39_conv = ret_var.data[n];
28405                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
28406         }
28407         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28408         FREE(ret_var.data);
28409         return ret_arr;
28410 }
28411
28412 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) {
28413         LDKChannelMonitor this_arg_conv;
28414         this_arg_conv.inner = untag_ptr(this_arg);
28415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28417         this_arg_conv.is_owned = false;
28418         unsigned char txid_arr[32];
28419         CHECK((*env)->GetArrayLength(env, txid) == 32);
28420         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
28421         unsigned char (*txid_ref)[32] = &txid_arr;
28422         void* broadcaster_ptr = untag_ptr(broadcaster);
28423         CHECK_ACCESS(broadcaster_ptr);
28424         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
28425         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28426                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28427                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
28428         }
28429         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28430         CHECK_ACCESS(fee_estimator_ptr);
28431         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28432         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28433                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28434                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28435         }
28436         void* logger_ptr = untag_ptr(logger);
28437         CHECK_ACCESS(logger_ptr);
28438         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28439         if (logger_conv.free == LDKLogger_JCalls_free) {
28440                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28441                 LDKLogger_JCalls_cloned(&logger_conv);
28442         }
28443         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
28444 }
28445
28446 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) {
28447         LDKChannelMonitor this_arg_conv;
28448         this_arg_conv.inner = untag_ptr(this_arg);
28449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28451         this_arg_conv.is_owned = false;
28452         unsigned char header_arr[80];
28453         CHECK((*env)->GetArrayLength(env, header) == 80);
28454         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
28455         unsigned char (*header_ref)[80] = &header_arr;
28456         void* broadcaster_ptr = untag_ptr(broadcaster);
28457         CHECK_ACCESS(broadcaster_ptr);
28458         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
28459         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28460                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28461                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
28462         }
28463         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28464         CHECK_ACCESS(fee_estimator_ptr);
28465         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28466         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28467                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28468                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28469         }
28470         void* logger_ptr = untag_ptr(logger);
28471         CHECK_ACCESS(logger_ptr);
28472         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28473         if (logger_conv.free == LDKLogger_JCalls_free) {
28474                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28475                 LDKLogger_JCalls_cloned(&logger_conv);
28476         }
28477         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
28478         int64_tArray ret_arr = NULL;
28479         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28480         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28481         for (size_t n = 0; n < ret_var.datalen; n++) {
28482                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
28483                 *ret_conv_39_conv = ret_var.data[n];
28484                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
28485         }
28486         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28487         FREE(ret_var.data);
28488         return ret_arr;
28489 }
28490
28491 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
28492         LDKChannelMonitor this_arg_conv;
28493         this_arg_conv.inner = untag_ptr(this_arg);
28494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28496         this_arg_conv.is_owned = false;
28497         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
28498         jobjectArray ret_arr = NULL;
28499         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
28500         ;
28501         for (size_t i = 0; i < ret_var.datalen; i++) {
28502                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
28503                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
28504                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
28505         }
28506         
28507         FREE(ret_var.data);
28508         return ret_arr;
28509 }
28510
28511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
28512         LDKChannelMonitor this_arg_conv;
28513         this_arg_conv.inner = untag_ptr(this_arg);
28514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28516         this_arg_conv.is_owned = false;
28517         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
28518         int64_t ret_ref = 0;
28519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28521         return ret_ref;
28522 }
28523
28524 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
28525         LDKChannelMonitor this_arg_conv;
28526         this_arg_conv.inner = untag_ptr(this_arg);
28527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28529         this_arg_conv.is_owned = false;
28530         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
28531         int64_tArray ret_arr = NULL;
28532         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28533         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28534         for (size_t j = 0; j < ret_var.datalen; j++) {
28535                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
28536                 *ret_conv_9_copy = ret_var.data[j];
28537                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
28538                 ret_arr_ptr[j] = ret_conv_9_ref;
28539         }
28540         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28541         FREE(ret_var.data);
28542         return ret_arr;
28543 }
28544
28545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
28546         LDKu8slice ser_ref;
28547         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28548         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28549         void* arg_ptr = untag_ptr(arg);
28550         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
28551         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
28552         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
28553         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
28554         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28555         return tag_ptr(ret_conv, true);
28556 }
28557
28558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28559         LDKOutPoint this_obj_conv;
28560         this_obj_conv.inner = untag_ptr(this_obj);
28561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28563         OutPoint_free(this_obj_conv);
28564 }
28565
28566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28567         LDKOutPoint this_ptr_conv;
28568         this_ptr_conv.inner = untag_ptr(this_ptr);
28569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28571         this_ptr_conv.is_owned = false;
28572         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28573         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
28574         return ret_arr;
28575 }
28576
28577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28578         LDKOutPoint this_ptr_conv;
28579         this_ptr_conv.inner = untag_ptr(this_ptr);
28580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28582         this_ptr_conv.is_owned = false;
28583         LDKThirtyTwoBytes val_ref;
28584         CHECK((*env)->GetArrayLength(env, val) == 32);
28585         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28586         OutPoint_set_txid(&this_ptr_conv, val_ref);
28587 }
28588
28589 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
28590         LDKOutPoint this_ptr_conv;
28591         this_ptr_conv.inner = untag_ptr(this_ptr);
28592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28594         this_ptr_conv.is_owned = false;
28595         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
28596         return ret_conv;
28597 }
28598
28599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28600         LDKOutPoint this_ptr_conv;
28601         this_ptr_conv.inner = untag_ptr(this_ptr);
28602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28604         this_ptr_conv.is_owned = false;
28605         OutPoint_set_index(&this_ptr_conv, val);
28606 }
28607
28608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
28609         LDKThirtyTwoBytes txid_arg_ref;
28610         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
28611         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
28612         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
28613         int64_t ret_ref = 0;
28614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28616         return ret_ref;
28617 }
28618
28619 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
28620         LDKOutPoint ret_var = OutPoint_clone(arg);
28621         int64_t ret_ref = 0;
28622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28624         return ret_ref;
28625 }
28626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28627         LDKOutPoint arg_conv;
28628         arg_conv.inner = untag_ptr(arg);
28629         arg_conv.is_owned = ptr_is_owned(arg);
28630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28631         arg_conv.is_owned = false;
28632         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
28633         return ret_conv;
28634 }
28635
28636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28637         LDKOutPoint orig_conv;
28638         orig_conv.inner = untag_ptr(orig);
28639         orig_conv.is_owned = ptr_is_owned(orig);
28640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28641         orig_conv.is_owned = false;
28642         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
28643         int64_t ret_ref = 0;
28644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28646         return ret_ref;
28647 }
28648
28649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28650         LDKOutPoint a_conv;
28651         a_conv.inner = untag_ptr(a);
28652         a_conv.is_owned = ptr_is_owned(a);
28653         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28654         a_conv.is_owned = false;
28655         LDKOutPoint b_conv;
28656         b_conv.inner = untag_ptr(b);
28657         b_conv.is_owned = ptr_is_owned(b);
28658         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28659         b_conv.is_owned = false;
28660         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
28661         return ret_conv;
28662 }
28663
28664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
28665         LDKOutPoint o_conv;
28666         o_conv.inner = untag_ptr(o);
28667         o_conv.is_owned = ptr_is_owned(o);
28668         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28669         o_conv.is_owned = false;
28670         int64_t ret_conv = OutPoint_hash(&o_conv);
28671         return ret_conv;
28672 }
28673
28674 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
28675         LDKOutPoint this_arg_conv;
28676         this_arg_conv.inner = untag_ptr(this_arg);
28677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28679         this_arg_conv.is_owned = false;
28680         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28681         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
28682         return ret_arr;
28683 }
28684
28685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
28686         LDKOutPoint obj_conv;
28687         obj_conv.inner = untag_ptr(obj);
28688         obj_conv.is_owned = ptr_is_owned(obj);
28689         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28690         obj_conv.is_owned = false;
28691         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
28692         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28693         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28694         CVec_u8Z_free(ret_var);
28695         return ret_arr;
28696 }
28697
28698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28699         LDKu8slice ser_ref;
28700         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28701         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28702         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
28703         *ret_conv = OutPoint_read(ser_ref);
28704         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28705         return tag_ptr(ret_conv, true);
28706 }
28707
28708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28709         LDKDelayedPaymentOutputDescriptor this_obj_conv;
28710         this_obj_conv.inner = untag_ptr(this_obj);
28711         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28713         DelayedPaymentOutputDescriptor_free(this_obj_conv);
28714 }
28715
28716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28717         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28718         this_ptr_conv.inner = untag_ptr(this_ptr);
28719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28721         this_ptr_conv.is_owned = false;
28722         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
28723         int64_t ret_ref = 0;
28724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28726         return ret_ref;
28727 }
28728
28729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28730         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28731         this_ptr_conv.inner = untag_ptr(this_ptr);
28732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28734         this_ptr_conv.is_owned = false;
28735         LDKOutPoint val_conv;
28736         val_conv.inner = untag_ptr(val);
28737         val_conv.is_owned = ptr_is_owned(val);
28738         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28739         val_conv = OutPoint_clone(&val_conv);
28740         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
28741 }
28742
28743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28744         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28745         this_ptr_conv.inner = untag_ptr(this_ptr);
28746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28748         this_ptr_conv.is_owned = false;
28749         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28750         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
28751         return ret_arr;
28752 }
28753
28754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28755         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28756         this_ptr_conv.inner = untag_ptr(this_ptr);
28757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28759         this_ptr_conv.is_owned = false;
28760         LDKPublicKey val_ref;
28761         CHECK((*env)->GetArrayLength(env, val) == 33);
28762         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28763         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
28764 }
28765
28766 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28767         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28768         this_ptr_conv.inner = untag_ptr(this_ptr);
28769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28771         this_ptr_conv.is_owned = false;
28772         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
28773         return ret_conv;
28774 }
28775
28776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28777         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28778         this_ptr_conv.inner = untag_ptr(this_ptr);
28779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28781         this_ptr_conv.is_owned = false;
28782         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
28783 }
28784
28785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
28786         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28787         this_ptr_conv.inner = untag_ptr(this_ptr);
28788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28790         this_ptr_conv.is_owned = false;
28791         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
28792         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
28793         return tag_ptr(ret_ref, true);
28794 }
28795
28796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28797         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28798         this_ptr_conv.inner = untag_ptr(this_ptr);
28799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28801         this_ptr_conv.is_owned = false;
28802         void* val_ptr = untag_ptr(val);
28803         CHECK_ACCESS(val_ptr);
28804         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
28805         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
28806         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
28807 }
28808
28809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28810         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28811         this_ptr_conv.inner = untag_ptr(this_ptr);
28812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28814         this_ptr_conv.is_owned = false;
28815         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28816         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
28817         return ret_arr;
28818 }
28819
28820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28821         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28822         this_ptr_conv.inner = untag_ptr(this_ptr);
28823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28825         this_ptr_conv.is_owned = false;
28826         LDKPublicKey val_ref;
28827         CHECK((*env)->GetArrayLength(env, val) == 33);
28828         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28829         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
28830 }
28831
28832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28833         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28834         this_ptr_conv.inner = untag_ptr(this_ptr);
28835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28837         this_ptr_conv.is_owned = false;
28838         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28839         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
28840         return ret_arr;
28841 }
28842
28843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28844         LDKDelayedPaymentOutputDescriptor 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         LDKThirtyTwoBytes val_ref;
28850         CHECK((*env)->GetArrayLength(env, val) == 32);
28851         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28852         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
28853 }
28854
28855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28856         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28857         this_ptr_conv.inner = untag_ptr(this_ptr);
28858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28860         this_ptr_conv.is_owned = false;
28861         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
28862         return ret_conv;
28863 }
28864
28865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28866         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
28867         this_ptr_conv.inner = untag_ptr(this_ptr);
28868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28870         this_ptr_conv.is_owned = false;
28871         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
28872 }
28873
28874 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) {
28875         LDKOutPoint outpoint_arg_conv;
28876         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
28877         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
28878         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
28879         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
28880         LDKPublicKey per_commitment_point_arg_ref;
28881         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
28882         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
28883         void* output_arg_ptr = untag_ptr(output_arg);
28884         CHECK_ACCESS(output_arg_ptr);
28885         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
28886         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
28887         LDKPublicKey revocation_pubkey_arg_ref;
28888         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
28889         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
28890         LDKThirtyTwoBytes channel_keys_id_arg_ref;
28891         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
28892         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
28893         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);
28894         int64_t ret_ref = 0;
28895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28897         return ret_ref;
28898 }
28899
28900 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
28901         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
28902         int64_t ret_ref = 0;
28903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28905         return ret_ref;
28906 }
28907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28908         LDKDelayedPaymentOutputDescriptor arg_conv;
28909         arg_conv.inner = untag_ptr(arg);
28910         arg_conv.is_owned = ptr_is_owned(arg);
28911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28912         arg_conv.is_owned = false;
28913         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
28914         return ret_conv;
28915 }
28916
28917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28918         LDKDelayedPaymentOutputDescriptor orig_conv;
28919         orig_conv.inner = untag_ptr(orig);
28920         orig_conv.is_owned = ptr_is_owned(orig);
28921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28922         orig_conv.is_owned = false;
28923         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
28924         int64_t ret_ref = 0;
28925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28927         return ret_ref;
28928 }
28929
28930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
28931         LDKDelayedPaymentOutputDescriptor obj_conv;
28932         obj_conv.inner = untag_ptr(obj);
28933         obj_conv.is_owned = ptr_is_owned(obj);
28934         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
28935         obj_conv.is_owned = false;
28936         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
28937         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28938         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28939         CVec_u8Z_free(ret_var);
28940         return ret_arr;
28941 }
28942
28943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28944         LDKu8slice ser_ref;
28945         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28946         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28947         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
28948         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
28949         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28950         return tag_ptr(ret_conv, true);
28951 }
28952
28953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28954         LDKStaticPaymentOutputDescriptor this_obj_conv;
28955         this_obj_conv.inner = untag_ptr(this_obj);
28956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28958         StaticPaymentOutputDescriptor_free(this_obj_conv);
28959 }
28960
28961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28962         LDKStaticPaymentOutputDescriptor this_ptr_conv;
28963         this_ptr_conv.inner = untag_ptr(this_ptr);
28964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28966         this_ptr_conv.is_owned = false;
28967         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
28968         int64_t ret_ref = 0;
28969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28971         return ret_ref;
28972 }
28973
28974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28975         LDKStaticPaymentOutputDescriptor this_ptr_conv;
28976         this_ptr_conv.inner = untag_ptr(this_ptr);
28977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28979         this_ptr_conv.is_owned = false;
28980         LDKOutPoint val_conv;
28981         val_conv.inner = untag_ptr(val);
28982         val_conv.is_owned = ptr_is_owned(val);
28983         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28984         val_conv = OutPoint_clone(&val_conv);
28985         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
28986 }
28987
28988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
28989         LDKStaticPaymentOutputDescriptor 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         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
28995         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
28996         return tag_ptr(ret_ref, true);
28997 }
28998
28999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29000         LDKStaticPaymentOutputDescriptor this_ptr_conv;
29001         this_ptr_conv.inner = untag_ptr(this_ptr);
29002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29004         this_ptr_conv.is_owned = false;
29005         void* val_ptr = untag_ptr(val);
29006         CHECK_ACCESS(val_ptr);
29007         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
29008         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
29009         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
29010 }
29011
29012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29013         LDKStaticPaymentOutputDescriptor this_ptr_conv;
29014         this_ptr_conv.inner = untag_ptr(this_ptr);
29015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29017         this_ptr_conv.is_owned = false;
29018         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29019         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
29020         return ret_arr;
29021 }
29022
29023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29024         LDKStaticPaymentOutputDescriptor this_ptr_conv;
29025         this_ptr_conv.inner = untag_ptr(this_ptr);
29026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29028         this_ptr_conv.is_owned = false;
29029         LDKThirtyTwoBytes val_ref;
29030         CHECK((*env)->GetArrayLength(env, val) == 32);
29031         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29032         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
29033 }
29034
29035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29036         LDKStaticPaymentOutputDescriptor this_ptr_conv;
29037         this_ptr_conv.inner = untag_ptr(this_ptr);
29038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29040         this_ptr_conv.is_owned = false;
29041         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
29042         return ret_conv;
29043 }
29044
29045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29046         LDKStaticPaymentOutputDescriptor this_ptr_conv;
29047         this_ptr_conv.inner = untag_ptr(this_ptr);
29048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29050         this_ptr_conv.is_owned = false;
29051         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
29052 }
29053
29054 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) {
29055         LDKOutPoint outpoint_arg_conv;
29056         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
29057         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
29058         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
29059         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
29060         void* output_arg_ptr = untag_ptr(output_arg);
29061         CHECK_ACCESS(output_arg_ptr);
29062         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
29063         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
29064         LDKThirtyTwoBytes channel_keys_id_arg_ref;
29065         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
29066         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
29067         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
29068         int64_t ret_ref = 0;
29069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29071         return ret_ref;
29072 }
29073
29074 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
29075         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
29076         int64_t ret_ref = 0;
29077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29079         return ret_ref;
29080 }
29081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29082         LDKStaticPaymentOutputDescriptor arg_conv;
29083         arg_conv.inner = untag_ptr(arg);
29084         arg_conv.is_owned = ptr_is_owned(arg);
29085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29086         arg_conv.is_owned = false;
29087         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
29088         return ret_conv;
29089 }
29090
29091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29092         LDKStaticPaymentOutputDescriptor orig_conv;
29093         orig_conv.inner = untag_ptr(orig);
29094         orig_conv.is_owned = ptr_is_owned(orig);
29095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29096         orig_conv.is_owned = false;
29097         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
29098         int64_t ret_ref = 0;
29099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29101         return ret_ref;
29102 }
29103
29104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
29105         LDKStaticPaymentOutputDescriptor obj_conv;
29106         obj_conv.inner = untag_ptr(obj);
29107         obj_conv.is_owned = ptr_is_owned(obj);
29108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29109         obj_conv.is_owned = false;
29110         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
29111         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29112         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29113         CVec_u8Z_free(ret_var);
29114         return ret_arr;
29115 }
29116
29117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29118         LDKu8slice ser_ref;
29119         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29120         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29121         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
29122         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
29123         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29124         return tag_ptr(ret_conv, true);
29125 }
29126
29127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29128         if (!ptr_is_owned(this_ptr)) return;
29129         void* this_ptr_ptr = untag_ptr(this_ptr);
29130         CHECK_ACCESS(this_ptr_ptr);
29131         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
29132         FREE(untag_ptr(this_ptr));
29133         SpendableOutputDescriptor_free(this_ptr_conv);
29134 }
29135
29136 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
29137         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
29138         *ret_copy = SpendableOutputDescriptor_clone(arg);
29139         int64_t ret_ref = tag_ptr(ret_copy, true);
29140         return ret_ref;
29141 }
29142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29143         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
29144         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
29145         return ret_conv;
29146 }
29147
29148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29149         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
29150         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
29151         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
29152         int64_t ret_ref = tag_ptr(ret_copy, true);
29153         return ret_ref;
29154 }
29155
29156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
29157         LDKOutPoint outpoint_conv;
29158         outpoint_conv.inner = untag_ptr(outpoint);
29159         outpoint_conv.is_owned = ptr_is_owned(outpoint);
29160         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
29161         outpoint_conv = OutPoint_clone(&outpoint_conv);
29162         void* output_ptr = untag_ptr(output);
29163         CHECK_ACCESS(output_ptr);
29164         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
29165         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
29166         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
29167         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
29168         int64_t ret_ref = tag_ptr(ret_copy, true);
29169         return ret_ref;
29170 }
29171
29172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
29173         LDKDelayedPaymentOutputDescriptor a_conv;
29174         a_conv.inner = untag_ptr(a);
29175         a_conv.is_owned = ptr_is_owned(a);
29176         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29177         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
29178         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
29179         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
29180         int64_t ret_ref = tag_ptr(ret_copy, true);
29181         return ret_ref;
29182 }
29183
29184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
29185         LDKStaticPaymentOutputDescriptor a_conv;
29186         a_conv.inner = untag_ptr(a);
29187         a_conv.is_owned = ptr_is_owned(a);
29188         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29189         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
29190         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
29191         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
29192         int64_t ret_ref = tag_ptr(ret_copy, true);
29193         return ret_ref;
29194 }
29195
29196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
29197         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
29198         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
29199         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29200         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29201         CVec_u8Z_free(ret_var);
29202         return ret_arr;
29203 }
29204
29205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29206         LDKu8slice ser_ref;
29207         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29208         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29209         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
29210         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
29211         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29212         return tag_ptr(ret_conv, true);
29213 }
29214
29215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29216         if (!ptr_is_owned(this_ptr)) return;
29217         void* this_ptr_ptr = untag_ptr(this_ptr);
29218         CHECK_ACCESS(this_ptr_ptr);
29219         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
29220         FREE(untag_ptr(this_ptr));
29221         BaseSign_free(this_ptr_conv);
29222 }
29223
29224 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
29225         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
29226         *ret_ret = Sign_clone(arg);
29227         return tag_ptr(ret_ret, true);
29228 }
29229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29230         void* arg_ptr = untag_ptr(arg);
29231         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
29232         LDKSign* arg_conv = (LDKSign*)arg_ptr;
29233         int64_t ret_conv = Sign_clone_ptr(arg_conv);
29234         return ret_conv;
29235 }
29236
29237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29238         void* orig_ptr = untag_ptr(orig);
29239         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
29240         LDKSign* orig_conv = (LDKSign*)orig_ptr;
29241         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
29242         *ret_ret = Sign_clone(orig_conv);
29243         return tag_ptr(ret_ret, true);
29244 }
29245
29246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29247         if (!ptr_is_owned(this_ptr)) return;
29248         void* this_ptr_ptr = untag_ptr(this_ptr);
29249         CHECK_ACCESS(this_ptr_ptr);
29250         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
29251         FREE(untag_ptr(this_ptr));
29252         Sign_free(this_ptr_conv);
29253 }
29254
29255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29256         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
29257         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
29258         return ret_conv;
29259 }
29260
29261 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
29262         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
29263         return ret_conv;
29264 }
29265
29266 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
29267         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
29268         return ret_conv;
29269 }
29270
29271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29272         if (!ptr_is_owned(this_ptr)) return;
29273         void* this_ptr_ptr = untag_ptr(this_ptr);
29274         CHECK_ACCESS(this_ptr_ptr);
29275         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
29276         FREE(untag_ptr(this_ptr));
29277         KeysInterface_free(this_ptr_conv);
29278 }
29279
29280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29281         LDKInMemorySigner this_obj_conv;
29282         this_obj_conv.inner = untag_ptr(this_obj);
29283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29285         InMemorySigner_free(this_obj_conv);
29286 }
29287
29288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
29289         LDKInMemorySigner this_ptr_conv;
29290         this_ptr_conv.inner = untag_ptr(this_ptr);
29291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29293         this_ptr_conv.is_owned = false;
29294         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29295         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
29296         return ret_arr;
29297 }
29298
29299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29300         LDKInMemorySigner this_ptr_conv;
29301         this_ptr_conv.inner = untag_ptr(this_ptr);
29302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29304         this_ptr_conv.is_owned = false;
29305         LDKSecretKey val_ref;
29306         CHECK((*env)->GetArrayLength(env, val) == 32);
29307         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
29308         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
29309 }
29310
29311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
29312         LDKInMemorySigner this_ptr_conv;
29313         this_ptr_conv.inner = untag_ptr(this_ptr);
29314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29316         this_ptr_conv.is_owned = false;
29317         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29318         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
29319         return ret_arr;
29320 }
29321
29322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29323         LDKInMemorySigner this_ptr_conv;
29324         this_ptr_conv.inner = untag_ptr(this_ptr);
29325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29327         this_ptr_conv.is_owned = false;
29328         LDKSecretKey val_ref;
29329         CHECK((*env)->GetArrayLength(env, val) == 32);
29330         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
29331         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
29332 }
29333
29334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
29335         LDKInMemorySigner this_ptr_conv;
29336         this_ptr_conv.inner = untag_ptr(this_ptr);
29337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29339         this_ptr_conv.is_owned = false;
29340         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29341         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
29342         return ret_arr;
29343 }
29344
29345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29346         LDKInMemorySigner this_ptr_conv;
29347         this_ptr_conv.inner = untag_ptr(this_ptr);
29348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29350         this_ptr_conv.is_owned = false;
29351         LDKSecretKey val_ref;
29352         CHECK((*env)->GetArrayLength(env, val) == 32);
29353         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
29354         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
29355 }
29356
29357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
29358         LDKInMemorySigner this_ptr_conv;
29359         this_ptr_conv.inner = untag_ptr(this_ptr);
29360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29362         this_ptr_conv.is_owned = false;
29363         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29364         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
29365         return ret_arr;
29366 }
29367
29368 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) {
29369         LDKInMemorySigner this_ptr_conv;
29370         this_ptr_conv.inner = untag_ptr(this_ptr);
29371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29373         this_ptr_conv.is_owned = false;
29374         LDKSecretKey val_ref;
29375         CHECK((*env)->GetArrayLength(env, val) == 32);
29376         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
29377         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
29378 }
29379
29380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
29381         LDKInMemorySigner this_ptr_conv;
29382         this_ptr_conv.inner = untag_ptr(this_ptr);
29383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29385         this_ptr_conv.is_owned = false;
29386         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29387         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
29388         return ret_arr;
29389 }
29390
29391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29392         LDKInMemorySigner 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         LDKSecretKey val_ref;
29398         CHECK((*env)->GetArrayLength(env, val) == 32);
29399         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
29400         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
29401 }
29402
29403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
29404         LDKInMemorySigner this_ptr_conv;
29405         this_ptr_conv.inner = untag_ptr(this_ptr);
29406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29408         this_ptr_conv.is_owned = false;
29409         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29410         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
29411         return ret_arr;
29412 }
29413
29414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29415         LDKInMemorySigner this_ptr_conv;
29416         this_ptr_conv.inner = untag_ptr(this_ptr);
29417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29419         this_ptr_conv.is_owned = false;
29420         LDKThirtyTwoBytes val_ref;
29421         CHECK((*env)->GetArrayLength(env, val) == 32);
29422         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29423         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
29424 }
29425
29426 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
29427         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
29428         int64_t ret_ref = 0;
29429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29431         return ret_ref;
29432 }
29433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29434         LDKInMemorySigner arg_conv;
29435         arg_conv.inner = untag_ptr(arg);
29436         arg_conv.is_owned = ptr_is_owned(arg);
29437         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29438         arg_conv.is_owned = false;
29439         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
29440         return ret_conv;
29441 }
29442
29443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29444         LDKInMemorySigner orig_conv;
29445         orig_conv.inner = untag_ptr(orig);
29446         orig_conv.is_owned = ptr_is_owned(orig);
29447         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29448         orig_conv.is_owned = false;
29449         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
29450         int64_t ret_ref = 0;
29451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29453         return ret_ref;
29454 }
29455
29456 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) {
29457         LDKSecretKey node_secret_ref;
29458         CHECK((*env)->GetArrayLength(env, node_secret) == 32);
29459         (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
29460         LDKSecretKey funding_key_ref;
29461         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
29462         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
29463         LDKSecretKey revocation_base_key_ref;
29464         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
29465         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
29466         LDKSecretKey payment_key_ref;
29467         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
29468         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
29469         LDKSecretKey delayed_payment_base_key_ref;
29470         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
29471         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
29472         LDKSecretKey htlc_base_key_ref;
29473         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
29474         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
29475         LDKThirtyTwoBytes commitment_seed_ref;
29476         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
29477         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
29478         LDKThirtyTwoBytes channel_keys_id_ref;
29479         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
29480         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
29481         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);
29482         int64_t ret_ref = 0;
29483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29485         return ret_ref;
29486 }
29487
29488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
29489         LDKInMemorySigner this_arg_conv;
29490         this_arg_conv.inner = untag_ptr(this_arg);
29491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29493         this_arg_conv.is_owned = false;
29494         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
29495         int64_t ret_ref = 0;
29496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29498         return ret_ref;
29499 }
29500
29501 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
29502         LDKInMemorySigner this_arg_conv;
29503         this_arg_conv.inner = untag_ptr(this_arg);
29504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29506         this_arg_conv.is_owned = false;
29507         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
29508         return ret_conv;
29509 }
29510
29511 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
29512         LDKInMemorySigner this_arg_conv;
29513         this_arg_conv.inner = untag_ptr(this_arg);
29514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29516         this_arg_conv.is_owned = false;
29517         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
29518         return ret_conv;
29519 }
29520
29521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
29522         LDKInMemorySigner this_arg_conv;
29523         this_arg_conv.inner = untag_ptr(this_arg);
29524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29526         this_arg_conv.is_owned = false;
29527         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
29528         return ret_conv;
29529 }
29530
29531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
29532         LDKInMemorySigner this_arg_conv;
29533         this_arg_conv.inner = untag_ptr(this_arg);
29534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29536         this_arg_conv.is_owned = false;
29537         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_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_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
29545         LDKInMemorySigner 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         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&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 jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
29558         LDKInMemorySigner 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         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
29564         return ret_conv;
29565 }
29566
29567 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) {
29568         LDKInMemorySigner this_arg_conv;
29569         this_arg_conv.inner = untag_ptr(this_arg);
29570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29572         this_arg_conv.is_owned = false;
29573         LDKTransaction spend_tx_ref;
29574         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
29575         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
29576         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
29577         spend_tx_ref.data_is_owned = true;
29578         LDKStaticPaymentOutputDescriptor descriptor_conv;
29579         descriptor_conv.inner = untag_ptr(descriptor);
29580         descriptor_conv.is_owned = ptr_is_owned(descriptor);
29581         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
29582         descriptor_conv.is_owned = false;
29583         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
29584         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
29585         return tag_ptr(ret_conv, true);
29586 }
29587
29588 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) {
29589         LDKInMemorySigner this_arg_conv;
29590         this_arg_conv.inner = untag_ptr(this_arg);
29591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29593         this_arg_conv.is_owned = false;
29594         LDKTransaction spend_tx_ref;
29595         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
29596         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
29597         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
29598         spend_tx_ref.data_is_owned = true;
29599         LDKDelayedPaymentOutputDescriptor descriptor_conv;
29600         descriptor_conv.inner = untag_ptr(descriptor);
29601         descriptor_conv.is_owned = ptr_is_owned(descriptor);
29602         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
29603         descriptor_conv.is_owned = false;
29604         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
29605         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
29606         return tag_ptr(ret_conv, true);
29607 }
29608
29609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
29610         LDKInMemorySigner this_arg_conv;
29611         this_arg_conv.inner = untag_ptr(this_arg);
29612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29614         this_arg_conv.is_owned = false;
29615         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
29616         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
29617         return tag_ptr(ret_ret, true);
29618 }
29619
29620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
29621         LDKInMemorySigner 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         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
29627         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
29628         return tag_ptr(ret_ret, true);
29629 }
29630
29631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
29632         LDKInMemorySigner obj_conv;
29633         obj_conv.inner = untag_ptr(obj);
29634         obj_conv.is_owned = ptr_is_owned(obj);
29635         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29636         obj_conv.is_owned = false;
29637         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
29638         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29639         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29640         CVec_u8Z_free(ret_var);
29641         return ret_arr;
29642 }
29643
29644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
29645         LDKu8slice ser_ref;
29646         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29647         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29648         LDKSecretKey arg_ref;
29649         CHECK((*env)->GetArrayLength(env, arg) == 32);
29650         (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
29651         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
29652         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
29653         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29654         return tag_ptr(ret_conv, true);
29655 }
29656
29657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29658         LDKKeysManager this_obj_conv;
29659         this_obj_conv.inner = untag_ptr(this_obj);
29660         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29662         KeysManager_free(this_obj_conv);
29663 }
29664
29665 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) {
29666         unsigned char seed_arr[32];
29667         CHECK((*env)->GetArrayLength(env, seed) == 32);
29668         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
29669         unsigned char (*seed_ref)[32] = &seed_arr;
29670         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
29671         int64_t ret_ref = 0;
29672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29674         return ret_ref;
29675 }
29676
29677 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) {
29678         LDKKeysManager this_arg_conv;
29679         this_arg_conv.inner = untag_ptr(this_arg);
29680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29682         this_arg_conv.is_owned = false;
29683         unsigned char params_arr[32];
29684         CHECK((*env)->GetArrayLength(env, params) == 32);
29685         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
29686         unsigned char (*params_ref)[32] = &params_arr;
29687         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
29688         int64_t ret_ref = 0;
29689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29691         return ret_ref;
29692 }
29693
29694 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) {
29695         LDKKeysManager this_arg_conv;
29696         this_arg_conv.inner = untag_ptr(this_arg);
29697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29699         this_arg_conv.is_owned = false;
29700         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
29701         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
29702         if (descriptors_constr.datalen > 0)
29703                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
29704         else
29705                 descriptors_constr.data = NULL;
29706         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
29707         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
29708                 int64_t descriptors_conv_27 = descriptors_vals[b];
29709                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
29710                 CHECK_ACCESS(descriptors_conv_27_ptr);
29711                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
29712                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
29713                 descriptors_constr.data[b] = descriptors_conv_27_conv;
29714         }
29715         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
29716         LDKCVec_TxOutZ outputs_constr;
29717         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
29718         if (outputs_constr.datalen > 0)
29719                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
29720         else
29721                 outputs_constr.data = NULL;
29722         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
29723         for (size_t h = 0; h < outputs_constr.datalen; h++) {
29724                 int64_t outputs_conv_7 = outputs_vals[h];
29725                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
29726                 CHECK_ACCESS(outputs_conv_7_ptr);
29727                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
29728                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
29729                 outputs_constr.data[h] = outputs_conv_7_conv;
29730         }
29731         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
29732         LDKCVec_u8Z change_destination_script_ref;
29733         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
29734         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
29735         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
29736         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
29737         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
29738         return tag_ptr(ret_conv, true);
29739 }
29740
29741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
29742         LDKKeysManager this_arg_conv;
29743         this_arg_conv.inner = untag_ptr(this_arg);
29744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29746         this_arg_conv.is_owned = false;
29747         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
29748         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
29749         return tag_ptr(ret_ret, true);
29750 }
29751
29752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29753         LDKPhantomKeysManager this_obj_conv;
29754         this_obj_conv.inner = untag_ptr(this_obj);
29755         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29757         PhantomKeysManager_free(this_obj_conv);
29758 }
29759
29760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
29761         LDKPhantomKeysManager this_arg_conv;
29762         this_arg_conv.inner = untag_ptr(this_arg);
29763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29765         this_arg_conv.is_owned = false;
29766         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
29767         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
29768         return tag_ptr(ret_ret, true);
29769 }
29770
29771 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) {
29772         unsigned char seed_arr[32];
29773         CHECK((*env)->GetArrayLength(env, seed) == 32);
29774         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
29775         unsigned char (*seed_ref)[32] = &seed_arr;
29776         unsigned char cross_node_seed_arr[32];
29777         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
29778         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
29779         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
29780         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
29781         int64_t ret_ref = 0;
29782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29784         return ret_ref;
29785 }
29786
29787 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) {
29788         LDKPhantomKeysManager this_arg_conv;
29789         this_arg_conv.inner = untag_ptr(this_arg);
29790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29792         this_arg_conv.is_owned = false;
29793         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
29794         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
29795         if (descriptors_constr.datalen > 0)
29796                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
29797         else
29798                 descriptors_constr.data = NULL;
29799         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
29800         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
29801                 int64_t descriptors_conv_27 = descriptors_vals[b];
29802                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
29803                 CHECK_ACCESS(descriptors_conv_27_ptr);
29804                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
29805                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
29806                 descriptors_constr.data[b] = descriptors_conv_27_conv;
29807         }
29808         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
29809         LDKCVec_TxOutZ outputs_constr;
29810         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
29811         if (outputs_constr.datalen > 0)
29812                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
29813         else
29814                 outputs_constr.data = NULL;
29815         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
29816         for (size_t h = 0; h < outputs_constr.datalen; h++) {
29817                 int64_t outputs_conv_7 = outputs_vals[h];
29818                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
29819                 CHECK_ACCESS(outputs_conv_7_ptr);
29820                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
29821                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
29822                 outputs_constr.data[h] = outputs_conv_7_conv;
29823         }
29824         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
29825         LDKCVec_u8Z change_destination_script_ref;
29826         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
29827         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
29828         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
29829         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
29830         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
29831         return tag_ptr(ret_conv, true);
29832 }
29833
29834 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) {
29835         LDKPhantomKeysManager this_arg_conv;
29836         this_arg_conv.inner = untag_ptr(this_arg);
29837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29839         this_arg_conv.is_owned = false;
29840         unsigned char params_arr[32];
29841         CHECK((*env)->GetArrayLength(env, params) == 32);
29842         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
29843         unsigned char (*params_ref)[32] = &params_arr;
29844         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
29845         int64_t ret_ref = 0;
29846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29848         return ret_ref;
29849 }
29850
29851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29852         LDKChannelManager this_obj_conv;
29853         this_obj_conv.inner = untag_ptr(this_obj);
29854         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29856         ChannelManager_free(this_obj_conv);
29857 }
29858
29859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29860         LDKChainParameters this_obj_conv;
29861         this_obj_conv.inner = untag_ptr(this_obj);
29862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29864         ChainParameters_free(this_obj_conv);
29865 }
29866
29867 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
29868         LDKChainParameters this_ptr_conv;
29869         this_ptr_conv.inner = untag_ptr(this_ptr);
29870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29872         this_ptr_conv.is_owned = false;
29873         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
29874         return ret_conv;
29875 }
29876
29877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
29878         LDKChainParameters this_ptr_conv;
29879         this_ptr_conv.inner = untag_ptr(this_ptr);
29880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29882         this_ptr_conv.is_owned = false;
29883         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
29884         ChainParameters_set_network(&this_ptr_conv, val_conv);
29885 }
29886
29887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
29888         LDKChainParameters this_ptr_conv;
29889         this_ptr_conv.inner = untag_ptr(this_ptr);
29890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29892         this_ptr_conv.is_owned = false;
29893         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
29894         int64_t ret_ref = 0;
29895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29897         return ret_ref;
29898 }
29899
29900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29901         LDKChainParameters this_ptr_conv;
29902         this_ptr_conv.inner = untag_ptr(this_ptr);
29903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29905         this_ptr_conv.is_owned = false;
29906         LDKBestBlock val_conv;
29907         val_conv.inner = untag_ptr(val);
29908         val_conv.is_owned = ptr_is_owned(val);
29909         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29910         val_conv = BestBlock_clone(&val_conv);
29911         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
29912 }
29913
29914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
29915         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
29916         LDKBestBlock best_block_arg_conv;
29917         best_block_arg_conv.inner = untag_ptr(best_block_arg);
29918         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
29919         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
29920         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
29921         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
29922         int64_t ret_ref = 0;
29923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29925         return ret_ref;
29926 }
29927
29928 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
29929         LDKChainParameters ret_var = ChainParameters_clone(arg);
29930         int64_t ret_ref = 0;
29931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29933         return ret_ref;
29934 }
29935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29936         LDKChainParameters arg_conv;
29937         arg_conv.inner = untag_ptr(arg);
29938         arg_conv.is_owned = ptr_is_owned(arg);
29939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29940         arg_conv.is_owned = false;
29941         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
29942         return ret_conv;
29943 }
29944
29945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29946         LDKChainParameters orig_conv;
29947         orig_conv.inner = untag_ptr(orig);
29948         orig_conv.is_owned = ptr_is_owned(orig);
29949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29950         orig_conv.is_owned = false;
29951         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
29952         int64_t ret_ref = 0;
29953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29955         return ret_ref;
29956 }
29957
29958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29959         LDKCounterpartyForwardingInfo this_obj_conv;
29960         this_obj_conv.inner = untag_ptr(this_obj);
29961         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29963         CounterpartyForwardingInfo_free(this_obj_conv);
29964 }
29965
29966 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29967         LDKCounterpartyForwardingInfo this_ptr_conv;
29968         this_ptr_conv.inner = untag_ptr(this_ptr);
29969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29971         this_ptr_conv.is_owned = false;
29972         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
29973         return ret_conv;
29974 }
29975
29976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29977         LDKCounterpartyForwardingInfo this_ptr_conv;
29978         this_ptr_conv.inner = untag_ptr(this_ptr);
29979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29981         this_ptr_conv.is_owned = false;
29982         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
29983 }
29984
29985 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
29986         LDKCounterpartyForwardingInfo this_ptr_conv;
29987         this_ptr_conv.inner = untag_ptr(this_ptr);
29988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29990         this_ptr_conv.is_owned = false;
29991         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
29992         return ret_conv;
29993 }
29994
29995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29996         LDKCounterpartyForwardingInfo this_ptr_conv;
29997         this_ptr_conv.inner = untag_ptr(this_ptr);
29998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30000         this_ptr_conv.is_owned = false;
30001         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
30002 }
30003
30004 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
30005         LDKCounterpartyForwardingInfo this_ptr_conv;
30006         this_ptr_conv.inner = untag_ptr(this_ptr);
30007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30009         this_ptr_conv.is_owned = false;
30010         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
30011         return ret_conv;
30012 }
30013
30014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30015         LDKCounterpartyForwardingInfo this_ptr_conv;
30016         this_ptr_conv.inner = untag_ptr(this_ptr);
30017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30019         this_ptr_conv.is_owned = false;
30020         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
30021 }
30022
30023 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) {
30024         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
30025         int64_t ret_ref = 0;
30026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30028         return ret_ref;
30029 }
30030
30031 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
30032         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
30033         int64_t ret_ref = 0;
30034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30036         return ret_ref;
30037 }
30038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30039         LDKCounterpartyForwardingInfo arg_conv;
30040         arg_conv.inner = untag_ptr(arg);
30041         arg_conv.is_owned = ptr_is_owned(arg);
30042         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30043         arg_conv.is_owned = false;
30044         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
30045         return ret_conv;
30046 }
30047
30048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30049         LDKCounterpartyForwardingInfo orig_conv;
30050         orig_conv.inner = untag_ptr(orig);
30051         orig_conv.is_owned = ptr_is_owned(orig);
30052         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30053         orig_conv.is_owned = false;
30054         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
30055         int64_t ret_ref = 0;
30056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30058         return ret_ref;
30059 }
30060
30061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30062         LDKChannelCounterparty this_obj_conv;
30063         this_obj_conv.inner = untag_ptr(this_obj);
30064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30066         ChannelCounterparty_free(this_obj_conv);
30067 }
30068
30069 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30070         LDKChannelCounterparty this_ptr_conv;
30071         this_ptr_conv.inner = untag_ptr(this_ptr);
30072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30074         this_ptr_conv.is_owned = false;
30075         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30076         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
30077         return ret_arr;
30078 }
30079
30080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30081         LDKChannelCounterparty this_ptr_conv;
30082         this_ptr_conv.inner = untag_ptr(this_ptr);
30083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30085         this_ptr_conv.is_owned = false;
30086         LDKPublicKey val_ref;
30087         CHECK((*env)->GetArrayLength(env, val) == 33);
30088         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30089         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
30090 }
30091
30092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30093         LDKChannelCounterparty this_ptr_conv;
30094         this_ptr_conv.inner = untag_ptr(this_ptr);
30095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30097         this_ptr_conv.is_owned = false;
30098         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
30099         int64_t ret_ref = 0;
30100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30102         return ret_ref;
30103 }
30104
30105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30106         LDKChannelCounterparty this_ptr_conv;
30107         this_ptr_conv.inner = untag_ptr(this_ptr);
30108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30110         this_ptr_conv.is_owned = false;
30111         LDKInitFeatures val_conv;
30112         val_conv.inner = untag_ptr(val);
30113         val_conv.is_owned = ptr_is_owned(val);
30114         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30115         val_conv = InitFeatures_clone(&val_conv);
30116         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
30117 }
30118
30119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
30120         LDKChannelCounterparty this_ptr_conv;
30121         this_ptr_conv.inner = untag_ptr(this_ptr);
30122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30124         this_ptr_conv.is_owned = false;
30125         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
30126         return ret_conv;
30127 }
30128
30129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30130         LDKChannelCounterparty this_ptr_conv;
30131         this_ptr_conv.inner = untag_ptr(this_ptr);
30132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30134         this_ptr_conv.is_owned = false;
30135         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
30136 }
30137
30138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
30139         LDKChannelCounterparty this_ptr_conv;
30140         this_ptr_conv.inner = untag_ptr(this_ptr);
30141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30143         this_ptr_conv.is_owned = false;
30144         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
30145         int64_t ret_ref = 0;
30146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30148         return ret_ref;
30149 }
30150
30151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30152         LDKChannelCounterparty this_ptr_conv;
30153         this_ptr_conv.inner = untag_ptr(this_ptr);
30154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30156         this_ptr_conv.is_owned = false;
30157         LDKCounterpartyForwardingInfo val_conv;
30158         val_conv.inner = untag_ptr(val);
30159         val_conv.is_owned = ptr_is_owned(val);
30160         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30161         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
30162         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
30163 }
30164
30165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30166         LDKChannelCounterparty this_ptr_conv;
30167         this_ptr_conv.inner = untag_ptr(this_ptr);
30168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30170         this_ptr_conv.is_owned = false;
30171         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30172         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
30173         int64_t ret_ref = tag_ptr(ret_copy, true);
30174         return ret_ref;
30175 }
30176
30177 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) {
30178         LDKChannelCounterparty this_ptr_conv;
30179         this_ptr_conv.inner = untag_ptr(this_ptr);
30180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30182         this_ptr_conv.is_owned = false;
30183         void* val_ptr = untag_ptr(val);
30184         CHECK_ACCESS(val_ptr);
30185         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30186         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30187         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
30188 }
30189
30190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30191         LDKChannelCounterparty this_ptr_conv;
30192         this_ptr_conv.inner = untag_ptr(this_ptr);
30193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30195         this_ptr_conv.is_owned = false;
30196         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30197         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
30198         int64_t ret_ref = tag_ptr(ret_copy, true);
30199         return ret_ref;
30200 }
30201
30202 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) {
30203         LDKChannelCounterparty this_ptr_conv;
30204         this_ptr_conv.inner = untag_ptr(this_ptr);
30205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30207         this_ptr_conv.is_owned = false;
30208         void* val_ptr = untag_ptr(val);
30209         CHECK_ACCESS(val_ptr);
30210         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30211         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30212         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
30213 }
30214
30215 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) {
30216         LDKPublicKey node_id_arg_ref;
30217         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
30218         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
30219         LDKInitFeatures features_arg_conv;
30220         features_arg_conv.inner = untag_ptr(features_arg);
30221         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30222         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30223         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30224         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
30225         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
30226         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
30227         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
30228         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
30229         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
30230         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
30231         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
30232         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
30233         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
30234         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
30235         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
30236         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
30237         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);
30238         int64_t ret_ref = 0;
30239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30241         return ret_ref;
30242 }
30243
30244 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
30245         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
30246         int64_t ret_ref = 0;
30247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30249         return ret_ref;
30250 }
30251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30252         LDKChannelCounterparty arg_conv;
30253         arg_conv.inner = untag_ptr(arg);
30254         arg_conv.is_owned = ptr_is_owned(arg);
30255         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30256         arg_conv.is_owned = false;
30257         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
30258         return ret_conv;
30259 }
30260
30261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30262         LDKChannelCounterparty orig_conv;
30263         orig_conv.inner = untag_ptr(orig);
30264         orig_conv.is_owned = ptr_is_owned(orig);
30265         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30266         orig_conv.is_owned = false;
30267         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
30268         int64_t ret_ref = 0;
30269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30271         return ret_ref;
30272 }
30273
30274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30275         LDKChannelDetails this_obj_conv;
30276         this_obj_conv.inner = untag_ptr(this_obj);
30277         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30279         ChannelDetails_free(this_obj_conv);
30280 }
30281
30282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30283         LDKChannelDetails this_ptr_conv;
30284         this_ptr_conv.inner = untag_ptr(this_ptr);
30285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30287         this_ptr_conv.is_owned = false;
30288         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30289         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
30290         return ret_arr;
30291 }
30292
30293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30294         LDKChannelDetails this_ptr_conv;
30295         this_ptr_conv.inner = untag_ptr(this_ptr);
30296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30298         this_ptr_conv.is_owned = false;
30299         LDKThirtyTwoBytes val_ref;
30300         CHECK((*env)->GetArrayLength(env, val) == 32);
30301         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30302         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
30303 }
30304
30305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
30306         LDKChannelDetails this_ptr_conv;
30307         this_ptr_conv.inner = untag_ptr(this_ptr);
30308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30310         this_ptr_conv.is_owned = false;
30311         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
30312         int64_t ret_ref = 0;
30313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30315         return ret_ref;
30316 }
30317
30318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30319         LDKChannelDetails 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         LDKChannelCounterparty val_conv;
30325         val_conv.inner = untag_ptr(val);
30326         val_conv.is_owned = ptr_is_owned(val);
30327         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30328         val_conv = ChannelCounterparty_clone(&val_conv);
30329         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
30330 }
30331
30332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
30333         LDKChannelDetails this_ptr_conv;
30334         this_ptr_conv.inner = untag_ptr(this_ptr);
30335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30337         this_ptr_conv.is_owned = false;
30338         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
30339         int64_t ret_ref = 0;
30340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30342         return ret_ref;
30343 }
30344
30345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30346         LDKChannelDetails 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         LDKOutPoint val_conv;
30352         val_conv.inner = untag_ptr(val);
30353         val_conv.is_owned = ptr_is_owned(val);
30354         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30355         val_conv = OutPoint_clone(&val_conv);
30356         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
30357 }
30358
30359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
30360         LDKChannelDetails this_ptr_conv;
30361         this_ptr_conv.inner = untag_ptr(this_ptr);
30362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30364         this_ptr_conv.is_owned = false;
30365         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
30366         int64_t ret_ref = 0;
30367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30369         return ret_ref;
30370 }
30371
30372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30373         LDKChannelDetails 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         LDKChannelTypeFeatures val_conv;
30379         val_conv.inner = untag_ptr(val);
30380         val_conv.is_owned = ptr_is_owned(val);
30381         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30382         val_conv = ChannelTypeFeatures_clone(&val_conv);
30383         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
30384 }
30385
30386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30387         LDKChannelDetails this_ptr_conv;
30388         this_ptr_conv.inner = untag_ptr(this_ptr);
30389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30391         this_ptr_conv.is_owned = false;
30392         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30393         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
30394         int64_t ret_ref = tag_ptr(ret_copy, true);
30395         return ret_ref;
30396 }
30397
30398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30399         LDKChannelDetails this_ptr_conv;
30400         this_ptr_conv.inner = untag_ptr(this_ptr);
30401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30403         this_ptr_conv.is_owned = false;
30404         void* val_ptr = untag_ptr(val);
30405         CHECK_ACCESS(val_ptr);
30406         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30407         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30408         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
30409 }
30410
30411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
30412         LDKChannelDetails this_ptr_conv;
30413         this_ptr_conv.inner = untag_ptr(this_ptr);
30414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30416         this_ptr_conv.is_owned = false;
30417         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30418         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
30419         int64_t ret_ref = tag_ptr(ret_copy, true);
30420         return ret_ref;
30421 }
30422
30423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30424         LDKChannelDetails this_ptr_conv;
30425         this_ptr_conv.inner = untag_ptr(this_ptr);
30426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30428         this_ptr_conv.is_owned = false;
30429         void* val_ptr = untag_ptr(val);
30430         CHECK_ACCESS(val_ptr);
30431         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30432         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30433         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
30434 }
30435
30436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
30437         LDKChannelDetails this_ptr_conv;
30438         this_ptr_conv.inner = untag_ptr(this_ptr);
30439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30441         this_ptr_conv.is_owned = false;
30442         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30443         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
30444         int64_t ret_ref = tag_ptr(ret_copy, true);
30445         return ret_ref;
30446 }
30447
30448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30449         LDKChannelDetails this_ptr_conv;
30450         this_ptr_conv.inner = untag_ptr(this_ptr);
30451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30453         this_ptr_conv.is_owned = false;
30454         void* val_ptr = untag_ptr(val);
30455         CHECK_ACCESS(val_ptr);
30456         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30457         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30458         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
30459 }
30460
30461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30462         LDKChannelDetails this_ptr_conv;
30463         this_ptr_conv.inner = untag_ptr(this_ptr);
30464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30466         this_ptr_conv.is_owned = false;
30467         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
30468         return ret_conv;
30469 }
30470
30471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30472         LDKChannelDetails this_ptr_conv;
30473         this_ptr_conv.inner = untag_ptr(this_ptr);
30474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30476         this_ptr_conv.is_owned = false;
30477         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
30478 }
30479
30480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
30481         LDKChannelDetails this_ptr_conv;
30482         this_ptr_conv.inner = untag_ptr(this_ptr);
30483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30485         this_ptr_conv.is_owned = false;
30486         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30487         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
30488         int64_t ret_ref = tag_ptr(ret_copy, true);
30489         return ret_ref;
30490 }
30491
30492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30493         LDKChannelDetails this_ptr_conv;
30494         this_ptr_conv.inner = untag_ptr(this_ptr);
30495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30497         this_ptr_conv.is_owned = false;
30498         void* val_ptr = untag_ptr(val);
30499         CHECK_ACCESS(val_ptr);
30500         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30501         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30502         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
30503 }
30504
30505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30506         LDKChannelDetails this_ptr_conv;
30507         this_ptr_conv.inner = untag_ptr(this_ptr);
30508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30510         this_ptr_conv.is_owned = false;
30511         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
30512         return ret_conv;
30513 }
30514
30515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30516         LDKChannelDetails this_ptr_conv;
30517         this_ptr_conv.inner = untag_ptr(this_ptr);
30518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30520         this_ptr_conv.is_owned = false;
30521         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
30522 }
30523
30524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30525         LDKChannelDetails this_ptr_conv;
30526         this_ptr_conv.inner = untag_ptr(this_ptr);
30527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30529         this_ptr_conv.is_owned = false;
30530         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
30531         return ret_conv;
30532 }
30533
30534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30535         LDKChannelDetails this_ptr_conv;
30536         this_ptr_conv.inner = untag_ptr(this_ptr);
30537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30539         this_ptr_conv.is_owned = false;
30540         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
30541 }
30542
30543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30544         LDKChannelDetails this_ptr_conv;
30545         this_ptr_conv.inner = untag_ptr(this_ptr);
30546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30548         this_ptr_conv.is_owned = false;
30549         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
30550         return ret_conv;
30551 }
30552
30553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30554         LDKChannelDetails this_ptr_conv;
30555         this_ptr_conv.inner = untag_ptr(this_ptr);
30556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30558         this_ptr_conv.is_owned = false;
30559         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
30560 }
30561
30562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30563         LDKChannelDetails this_ptr_conv;
30564         this_ptr_conv.inner = untag_ptr(this_ptr);
30565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30567         this_ptr_conv.is_owned = false;
30568         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
30569         return ret_conv;
30570 }
30571
30572 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) {
30573         LDKChannelDetails this_ptr_conv;
30574         this_ptr_conv.inner = untag_ptr(this_ptr);
30575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30577         this_ptr_conv.is_owned = false;
30578         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
30579 }
30580
30581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30582         LDKChannelDetails this_ptr_conv;
30583         this_ptr_conv.inner = untag_ptr(this_ptr);
30584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30586         this_ptr_conv.is_owned = false;
30587         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
30588         return ret_conv;
30589 }
30590
30591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30592         LDKChannelDetails this_ptr_conv;
30593         this_ptr_conv.inner = untag_ptr(this_ptr);
30594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30596         this_ptr_conv.is_owned = false;
30597         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
30598 }
30599
30600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
30601         LDKChannelDetails this_ptr_conv;
30602         this_ptr_conv.inner = untag_ptr(this_ptr);
30603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30605         this_ptr_conv.is_owned = false;
30606         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
30607         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
30608         int64_t ret_ref = tag_ptr(ret_copy, true);
30609         return ret_ref;
30610 }
30611
30612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30613         LDKChannelDetails this_ptr_conv;
30614         this_ptr_conv.inner = untag_ptr(this_ptr);
30615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30617         this_ptr_conv.is_owned = false;
30618         void* val_ptr = untag_ptr(val);
30619         CHECK_ACCESS(val_ptr);
30620         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
30621         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
30622         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
30623 }
30624
30625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30626         LDKChannelDetails this_ptr_conv;
30627         this_ptr_conv.inner = untag_ptr(this_ptr);
30628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30630         this_ptr_conv.is_owned = false;
30631         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
30632         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
30633         int64_t ret_ref = tag_ptr(ret_copy, true);
30634         return ret_ref;
30635 }
30636
30637 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) {
30638         LDKChannelDetails this_ptr_conv;
30639         this_ptr_conv.inner = untag_ptr(this_ptr);
30640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30642         this_ptr_conv.is_owned = false;
30643         void* val_ptr = untag_ptr(val);
30644         CHECK_ACCESS(val_ptr);
30645         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
30646         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
30647         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
30648 }
30649
30650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
30651         LDKChannelDetails this_ptr_conv;
30652         this_ptr_conv.inner = untag_ptr(this_ptr);
30653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30655         this_ptr_conv.is_owned = false;
30656         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
30657         return ret_conv;
30658 }
30659
30660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30661         LDKChannelDetails this_ptr_conv;
30662         this_ptr_conv.inner = untag_ptr(this_ptr);
30663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30665         this_ptr_conv.is_owned = false;
30666         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
30667 }
30668
30669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
30670         LDKChannelDetails this_ptr_conv;
30671         this_ptr_conv.inner = untag_ptr(this_ptr);
30672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30674         this_ptr_conv.is_owned = false;
30675         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
30676         return ret_conv;
30677 }
30678
30679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30680         LDKChannelDetails this_ptr_conv;
30681         this_ptr_conv.inner = untag_ptr(this_ptr);
30682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30684         this_ptr_conv.is_owned = false;
30685         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
30686 }
30687
30688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
30689         LDKChannelDetails this_ptr_conv;
30690         this_ptr_conv.inner = untag_ptr(this_ptr);
30691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30693         this_ptr_conv.is_owned = false;
30694         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
30695         return ret_conv;
30696 }
30697
30698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30699         LDKChannelDetails this_ptr_conv;
30700         this_ptr_conv.inner = untag_ptr(this_ptr);
30701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30703         this_ptr_conv.is_owned = false;
30704         ChannelDetails_set_is_usable(&this_ptr_conv, val);
30705 }
30706
30707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
30708         LDKChannelDetails this_ptr_conv;
30709         this_ptr_conv.inner = untag_ptr(this_ptr);
30710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30712         this_ptr_conv.is_owned = false;
30713         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
30714         return ret_conv;
30715 }
30716
30717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
30718         LDKChannelDetails this_ptr_conv;
30719         this_ptr_conv.inner = untag_ptr(this_ptr);
30720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30722         this_ptr_conv.is_owned = false;
30723         ChannelDetails_set_is_public(&this_ptr_conv, val);
30724 }
30725
30726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30727         LDKChannelDetails this_ptr_conv;
30728         this_ptr_conv.inner = untag_ptr(this_ptr);
30729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30731         this_ptr_conv.is_owned = false;
30732         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30733         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
30734         int64_t ret_ref = tag_ptr(ret_copy, true);
30735         return ret_ref;
30736 }
30737
30738 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) {
30739         LDKChannelDetails this_ptr_conv;
30740         this_ptr_conv.inner = untag_ptr(this_ptr);
30741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30743         this_ptr_conv.is_owned = false;
30744         void* val_ptr = untag_ptr(val);
30745         CHECK_ACCESS(val_ptr);
30746         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30747         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30748         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
30749 }
30750
30751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30752         LDKChannelDetails this_ptr_conv;
30753         this_ptr_conv.inner = untag_ptr(this_ptr);
30754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30756         this_ptr_conv.is_owned = false;
30757         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30758         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
30759         int64_t ret_ref = tag_ptr(ret_copy, true);
30760         return ret_ref;
30761 }
30762
30763 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) {
30764         LDKChannelDetails this_ptr_conv;
30765         this_ptr_conv.inner = untag_ptr(this_ptr);
30766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30768         this_ptr_conv.is_owned = false;
30769         void* val_ptr = untag_ptr(val);
30770         CHECK_ACCESS(val_ptr);
30771         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
30772         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
30773         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
30774 }
30775
30776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30777         LDKChannelDetails this_ptr_conv;
30778         this_ptr_conv.inner = untag_ptr(this_ptr);
30779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30781         this_ptr_conv.is_owned = false;
30782         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
30783         int64_t ret_ref = 0;
30784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30786         return ret_ref;
30787 }
30788
30789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30790         LDKChannelDetails this_ptr_conv;
30791         this_ptr_conv.inner = untag_ptr(this_ptr);
30792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30794         this_ptr_conv.is_owned = false;
30795         LDKChannelConfig val_conv;
30796         val_conv.inner = untag_ptr(val);
30797         val_conv.is_owned = ptr_is_owned(val);
30798         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30799         val_conv = ChannelConfig_clone(&val_conv);
30800         ChannelDetails_set_config(&this_ptr_conv, val_conv);
30801 }
30802
30803 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) {
30804         LDKThirtyTwoBytes channel_id_arg_ref;
30805         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30806         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30807         LDKChannelCounterparty counterparty_arg_conv;
30808         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
30809         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
30810         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
30811         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
30812         LDKOutPoint funding_txo_arg_conv;
30813         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
30814         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
30815         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
30816         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
30817         LDKChannelTypeFeatures channel_type_arg_conv;
30818         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
30819         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
30820         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
30821         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
30822         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
30823         CHECK_ACCESS(short_channel_id_arg_ptr);
30824         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
30825         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
30826         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
30827         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
30828         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
30829         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
30830         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
30831         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
30832         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
30833         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
30834         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
30835         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
30836         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
30837         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
30838         CHECK_ACCESS(confirmations_required_arg_ptr);
30839         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
30840         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
30841         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
30842         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
30843         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
30844         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
30845         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
30846         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
30847         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
30848         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
30849         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
30850         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
30851         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
30852         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
30853         LDKChannelConfig config_arg_conv;
30854         config_arg_conv.inner = untag_ptr(config_arg);
30855         config_arg_conv.is_owned = ptr_is_owned(config_arg);
30856         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
30857         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
30858         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);
30859         int64_t ret_ref = 0;
30860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30862         return ret_ref;
30863 }
30864
30865 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
30866         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
30867         int64_t ret_ref = 0;
30868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30870         return ret_ref;
30871 }
30872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30873         LDKChannelDetails arg_conv;
30874         arg_conv.inner = untag_ptr(arg);
30875         arg_conv.is_owned = ptr_is_owned(arg);
30876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30877         arg_conv.is_owned = false;
30878         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
30879         return ret_conv;
30880 }
30881
30882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30883         LDKChannelDetails orig_conv;
30884         orig_conv.inner = untag_ptr(orig);
30885         orig_conv.is_owned = ptr_is_owned(orig);
30886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30887         orig_conv.is_owned = false;
30888         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
30889         int64_t ret_ref = 0;
30890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30892         return ret_ref;
30893 }
30894
30895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30896         LDKChannelDetails this_arg_conv;
30897         this_arg_conv.inner = untag_ptr(this_arg);
30898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30900         this_arg_conv.is_owned = false;
30901         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30902         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
30903         int64_t ret_ref = tag_ptr(ret_copy, true);
30904         return ret_ref;
30905 }
30906
30907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30908         LDKChannelDetails this_arg_conv;
30909         this_arg_conv.inner = untag_ptr(this_arg);
30910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30912         this_arg_conv.is_owned = false;
30913         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
30914         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
30915         int64_t ret_ref = tag_ptr(ret_copy, true);
30916         return ret_ref;
30917 }
30918
30919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30920         if (!ptr_is_owned(this_ptr)) return;
30921         void* this_ptr_ptr = untag_ptr(this_ptr);
30922         CHECK_ACCESS(this_ptr_ptr);
30923         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
30924         FREE(untag_ptr(this_ptr));
30925         PaymentSendFailure_free(this_ptr_conv);
30926 }
30927
30928 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
30929         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30930         *ret_copy = PaymentSendFailure_clone(arg);
30931         int64_t ret_ref = tag_ptr(ret_copy, true);
30932         return ret_ref;
30933 }
30934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30935         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
30936         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
30937         return ret_conv;
30938 }
30939
30940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30941         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
30942         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30943         *ret_copy = PaymentSendFailure_clone(orig_conv);
30944         int64_t ret_ref = tag_ptr(ret_copy, true);
30945         return ret_ref;
30946 }
30947
30948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
30949         void* a_ptr = untag_ptr(a);
30950         CHECK_ACCESS(a_ptr);
30951         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
30952         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
30953         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30954         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
30955         int64_t ret_ref = tag_ptr(ret_copy, true);
30956         return ret_ref;
30957 }
30958
30959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
30960         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
30961         a_constr.datalen = (*env)->GetArrayLength(env, a);
30962         if (a_constr.datalen > 0)
30963                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
30964         else
30965                 a_constr.data = NULL;
30966         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
30967         for (size_t w = 0; w < a_constr.datalen; w++) {
30968                 int64_t a_conv_22 = a_vals[w];
30969                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
30970                 CHECK_ACCESS(a_conv_22_ptr);
30971                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
30972                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
30973                 a_constr.data[w] = a_conv_22_conv;
30974         }
30975         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
30976         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
30977         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
30978         int64_t ret_ref = tag_ptr(ret_copy, true);
30979         return ret_ref;
30980 }
30981
30982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
30983         LDKCVec_APIErrorZ a_constr;
30984         a_constr.datalen = (*env)->GetArrayLength(env, a);
30985         if (a_constr.datalen > 0)
30986                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
30987         else
30988                 a_constr.data = NULL;
30989         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
30990         for (size_t k = 0; k < a_constr.datalen; k++) {
30991                 int64_t a_conv_10 = a_vals[k];
30992                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
30993                 CHECK_ACCESS(a_conv_10_ptr);
30994                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
30995                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
30996                 a_constr.data[k] = a_conv_10_conv;
30997         }
30998         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
30999         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
31000         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
31001         int64_t ret_ref = tag_ptr(ret_copy, true);
31002         return ret_ref;
31003 }
31004
31005 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) {
31006         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
31007         results_constr.datalen = (*env)->GetArrayLength(env, results);
31008         if (results_constr.datalen > 0)
31009                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
31010         else
31011                 results_constr.data = NULL;
31012         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
31013         for (size_t w = 0; w < results_constr.datalen; w++) {
31014                 int64_t results_conv_22 = results_vals[w];
31015                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
31016                 CHECK_ACCESS(results_conv_22_ptr);
31017                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
31018                 results_constr.data[w] = results_conv_22_conv;
31019         }
31020         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
31021         LDKRouteParameters failed_paths_retry_conv;
31022         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
31023         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
31024         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
31025         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
31026         LDKThirtyTwoBytes payment_id_ref;
31027         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
31028         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
31029         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
31030         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
31031         int64_t ret_ref = tag_ptr(ret_copy, true);
31032         return ret_ref;
31033 }
31034
31035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31036         LDKPhantomRouteHints this_obj_conv;
31037         this_obj_conv.inner = untag_ptr(this_obj);
31038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31040         PhantomRouteHints_free(this_obj_conv);
31041 }
31042
31043 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
31044         LDKPhantomRouteHints this_ptr_conv;
31045         this_ptr_conv.inner = untag_ptr(this_ptr);
31046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31048         this_ptr_conv.is_owned = false;
31049         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
31050         int64_tArray ret_arr = NULL;
31051         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31052         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31053         for (size_t q = 0; q < ret_var.datalen; q++) {
31054                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
31055                 int64_t ret_conv_16_ref = 0;
31056                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
31057                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
31058                 ret_arr_ptr[q] = ret_conv_16_ref;
31059         }
31060         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31061         FREE(ret_var.data);
31062         return ret_arr;
31063 }
31064
31065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
31066         LDKPhantomRouteHints this_ptr_conv;
31067         this_ptr_conv.inner = untag_ptr(this_ptr);
31068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31070         this_ptr_conv.is_owned = false;
31071         LDKCVec_ChannelDetailsZ val_constr;
31072         val_constr.datalen = (*env)->GetArrayLength(env, val);
31073         if (val_constr.datalen > 0)
31074                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
31075         else
31076                 val_constr.data = NULL;
31077         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31078         for (size_t q = 0; q < val_constr.datalen; q++) {
31079                 int64_t val_conv_16 = val_vals[q];
31080                 LDKChannelDetails val_conv_16_conv;
31081                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
31082                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
31083                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
31084                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
31085                 val_constr.data[q] = val_conv_16_conv;
31086         }
31087         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31088         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
31089 }
31090
31091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
31092         LDKPhantomRouteHints this_ptr_conv;
31093         this_ptr_conv.inner = untag_ptr(this_ptr);
31094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31096         this_ptr_conv.is_owned = false;
31097         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
31098         return ret_conv;
31099 }
31100
31101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31102         LDKPhantomRouteHints this_ptr_conv;
31103         this_ptr_conv.inner = untag_ptr(this_ptr);
31104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31106         this_ptr_conv.is_owned = false;
31107         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
31108 }
31109
31110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31111         LDKPhantomRouteHints this_ptr_conv;
31112         this_ptr_conv.inner = untag_ptr(this_ptr);
31113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31115         this_ptr_conv.is_owned = false;
31116         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31117         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
31118         return ret_arr;
31119 }
31120
31121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31122         LDKPhantomRouteHints this_ptr_conv;
31123         this_ptr_conv.inner = untag_ptr(this_ptr);
31124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31126         this_ptr_conv.is_owned = false;
31127         LDKPublicKey val_ref;
31128         CHECK((*env)->GetArrayLength(env, val) == 33);
31129         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31130         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
31131 }
31132
31133 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) {
31134         LDKCVec_ChannelDetailsZ channels_arg_constr;
31135         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
31136         if (channels_arg_constr.datalen > 0)
31137                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
31138         else
31139                 channels_arg_constr.data = NULL;
31140         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
31141         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
31142                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
31143                 LDKChannelDetails channels_arg_conv_16_conv;
31144                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
31145                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
31146                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
31147                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
31148                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
31149         }
31150         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
31151         LDKPublicKey real_node_pubkey_arg_ref;
31152         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
31153         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
31154         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
31155         int64_t ret_ref = 0;
31156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31158         return ret_ref;
31159 }
31160
31161 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
31162         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
31163         int64_t ret_ref = 0;
31164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31166         return ret_ref;
31167 }
31168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31169         LDKPhantomRouteHints arg_conv;
31170         arg_conv.inner = untag_ptr(arg);
31171         arg_conv.is_owned = ptr_is_owned(arg);
31172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31173         arg_conv.is_owned = false;
31174         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
31175         return ret_conv;
31176 }
31177
31178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31179         LDKPhantomRouteHints orig_conv;
31180         orig_conv.inner = untag_ptr(orig);
31181         orig_conv.is_owned = ptr_is_owned(orig);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31183         orig_conv.is_owned = false;
31184         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
31185         int64_t ret_ref = 0;
31186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31188         return ret_ref;
31189 }
31190
31191 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) {
31192         void* fee_est_ptr = untag_ptr(fee_est);
31193         CHECK_ACCESS(fee_est_ptr);
31194         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
31195         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
31196                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31197                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
31198         }
31199         void* chain_monitor_ptr = untag_ptr(chain_monitor);
31200         CHECK_ACCESS(chain_monitor_ptr);
31201         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
31202         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
31203                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31204                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
31205         }
31206         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
31207         CHECK_ACCESS(tx_broadcaster_ptr);
31208         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
31209         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
31210                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31211                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
31212         }
31213         void* logger_ptr = untag_ptr(logger);
31214         CHECK_ACCESS(logger_ptr);
31215         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31216         if (logger_conv.free == LDKLogger_JCalls_free) {
31217                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31218                 LDKLogger_JCalls_cloned(&logger_conv);
31219         }
31220         void* keys_manager_ptr = untag_ptr(keys_manager);
31221         CHECK_ACCESS(keys_manager_ptr);
31222         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
31223         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
31224                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31225                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
31226         }
31227         LDKUserConfig config_conv;
31228         config_conv.inner = untag_ptr(config);
31229         config_conv.is_owned = ptr_is_owned(config);
31230         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
31231         config_conv = UserConfig_clone(&config_conv);
31232         LDKChainParameters params_conv;
31233         params_conv.inner = untag_ptr(params);
31234         params_conv.is_owned = ptr_is_owned(params);
31235         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
31236         params_conv = ChainParameters_clone(&params_conv);
31237         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
31238         int64_t ret_ref = 0;
31239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31241         return ret_ref;
31242 }
31243
31244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
31245         LDKChannelManager this_arg_conv;
31246         this_arg_conv.inner = untag_ptr(this_arg);
31247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31249         this_arg_conv.is_owned = false;
31250         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
31251         int64_t ret_ref = 0;
31252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31254         return ret_ref;
31255 }
31256
31257 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) {
31258         LDKChannelManager this_arg_conv;
31259         this_arg_conv.inner = untag_ptr(this_arg);
31260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31262         this_arg_conv.is_owned = false;
31263         LDKPublicKey their_network_key_ref;
31264         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
31265         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
31266         LDKUserConfig override_config_conv;
31267         override_config_conv.inner = untag_ptr(override_config);
31268         override_config_conv.is_owned = ptr_is_owned(override_config);
31269         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
31270         override_config_conv = UserConfig_clone(&override_config_conv);
31271         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
31272         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
31273         return tag_ptr(ret_conv, true);
31274 }
31275
31276 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
31277         LDKChannelManager this_arg_conv;
31278         this_arg_conv.inner = untag_ptr(this_arg);
31279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31281         this_arg_conv.is_owned = false;
31282         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
31283         int64_tArray ret_arr = NULL;
31284         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31285         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31286         for (size_t q = 0; q < ret_var.datalen; q++) {
31287                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
31288                 int64_t ret_conv_16_ref = 0;
31289                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
31290                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
31291                 ret_arr_ptr[q] = ret_conv_16_ref;
31292         }
31293         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31294         FREE(ret_var.data);
31295         return ret_arr;
31296 }
31297
31298 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
31299         LDKChannelManager this_arg_conv;
31300         this_arg_conv.inner = untag_ptr(this_arg);
31301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31303         this_arg_conv.is_owned = false;
31304         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
31305         int64_tArray ret_arr = NULL;
31306         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
31307         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
31308         for (size_t q = 0; q < ret_var.datalen; q++) {
31309                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
31310                 int64_t ret_conv_16_ref = 0;
31311                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
31312                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
31313                 ret_arr_ptr[q] = ret_conv_16_ref;
31314         }
31315         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
31316         FREE(ret_var.data);
31317         return ret_arr;
31318 }
31319
31320 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) {
31321         LDKChannelManager this_arg_conv;
31322         this_arg_conv.inner = untag_ptr(this_arg);
31323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31325         this_arg_conv.is_owned = false;
31326         unsigned char channel_id_arr[32];
31327         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
31328         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
31329         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
31330         LDKPublicKey counterparty_node_id_ref;
31331         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31332         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31333         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31334         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
31335         return tag_ptr(ret_conv, true);
31336 }
31337
31338 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) {
31339         LDKChannelManager this_arg_conv;
31340         this_arg_conv.inner = untag_ptr(this_arg);
31341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31343         this_arg_conv.is_owned = false;
31344         unsigned char channel_id_arr[32];
31345         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
31346         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
31347         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
31348         LDKPublicKey counterparty_node_id_ref;
31349         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31350         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31351         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31352         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
31353         return tag_ptr(ret_conv, true);
31354 }
31355
31356 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) {
31357         LDKChannelManager this_arg_conv;
31358         this_arg_conv.inner = untag_ptr(this_arg);
31359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31361         this_arg_conv.is_owned = false;
31362         unsigned char channel_id_arr[32];
31363         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
31364         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
31365         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
31366         LDKPublicKey counterparty_node_id_ref;
31367         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31368         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31369         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31370         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
31371         return tag_ptr(ret_conv, true);
31372 }
31373
31374 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) {
31375         LDKChannelManager this_arg_conv;
31376         this_arg_conv.inner = untag_ptr(this_arg);
31377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31379         this_arg_conv.is_owned = false;
31380         unsigned char channel_id_arr[32];
31381         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
31382         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
31383         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
31384         LDKPublicKey counterparty_node_id_ref;
31385         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31386         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31387         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31388         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
31389         return tag_ptr(ret_conv, true);
31390 }
31391
31392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
31393         LDKChannelManager this_arg_conv;
31394         this_arg_conv.inner = untag_ptr(this_arg);
31395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31397         this_arg_conv.is_owned = false;
31398         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
31399 }
31400
31401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
31402         LDKChannelManager this_arg_conv;
31403         this_arg_conv.inner = untag_ptr(this_arg);
31404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31406         this_arg_conv.is_owned = false;
31407         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
31408 }
31409
31410 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) {
31411         LDKChannelManager this_arg_conv;
31412         this_arg_conv.inner = untag_ptr(this_arg);
31413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31415         this_arg_conv.is_owned = false;
31416         LDKRoute route_conv;
31417         route_conv.inner = untag_ptr(route);
31418         route_conv.is_owned = ptr_is_owned(route);
31419         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
31420         route_conv.is_owned = false;
31421         LDKThirtyTwoBytes payment_hash_ref;
31422         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31423         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31424         LDKThirtyTwoBytes payment_secret_ref;
31425         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
31426         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
31427         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
31428         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
31429         return tag_ptr(ret_conv, true);
31430 }
31431
31432 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) {
31433         LDKChannelManager this_arg_conv;
31434         this_arg_conv.inner = untag_ptr(this_arg);
31435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31437         this_arg_conv.is_owned = false;
31438         LDKRoute route_conv;
31439         route_conv.inner = untag_ptr(route);
31440         route_conv.is_owned = ptr_is_owned(route);
31441         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
31442         route_conv.is_owned = false;
31443         LDKThirtyTwoBytes payment_id_ref;
31444         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
31445         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
31446         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
31447         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
31448         return tag_ptr(ret_conv, true);
31449 }
31450
31451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
31452         LDKChannelManager this_arg_conv;
31453         this_arg_conv.inner = untag_ptr(this_arg);
31454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31456         this_arg_conv.is_owned = false;
31457         LDKThirtyTwoBytes payment_id_ref;
31458         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
31459         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
31460         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
31461 }
31462
31463 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) {
31464         LDKChannelManager this_arg_conv;
31465         this_arg_conv.inner = untag_ptr(this_arg);
31466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31468         this_arg_conv.is_owned = false;
31469         LDKRoute route_conv;
31470         route_conv.inner = untag_ptr(route);
31471         route_conv.is_owned = ptr_is_owned(route);
31472         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
31473         route_conv.is_owned = false;
31474         LDKThirtyTwoBytes payment_preimage_ref;
31475         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
31476         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
31477         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
31478         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
31479         return tag_ptr(ret_conv, true);
31480 }
31481
31482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) {
31483         LDKChannelManager this_arg_conv;
31484         this_arg_conv.inner = untag_ptr(this_arg);
31485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31487         this_arg_conv.is_owned = false;
31488         LDKCVec_RouteHopZ hops_constr;
31489         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
31490         if (hops_constr.datalen > 0)
31491                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
31492         else
31493                 hops_constr.data = NULL;
31494         int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
31495         for (size_t k = 0; k < hops_constr.datalen; k++) {
31496                 int64_t hops_conv_10 = hops_vals[k];
31497                 LDKRouteHop hops_conv_10_conv;
31498                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
31499                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
31500                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
31501                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
31502                 hops_constr.data[k] = hops_conv_10_conv;
31503         }
31504         (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
31505         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
31506         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
31507         return tag_ptr(ret_conv, true);
31508 }
31509
31510 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) {
31511         LDKChannelManager this_arg_conv;
31512         this_arg_conv.inner = untag_ptr(this_arg);
31513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31515         this_arg_conv.is_owned = false;
31516         unsigned char temporary_channel_id_arr[32];
31517         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31518         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31519         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31520         LDKPublicKey counterparty_node_id_ref;
31521         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31522         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31523         LDKTransaction funding_transaction_ref;
31524         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
31525         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
31526         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
31527         funding_transaction_ref.data_is_owned = true;
31528         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31529         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
31530         return tag_ptr(ret_conv, true);
31531 }
31532
31533 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) {
31534         LDKChannelManager this_arg_conv;
31535         this_arg_conv.inner = untag_ptr(this_arg);
31536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31538         this_arg_conv.is_owned = false;
31539         LDKPublicKey counterparty_node_id_ref;
31540         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31541         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31542         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
31543         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
31544         if (channel_ids_constr.datalen > 0)
31545                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
31546         else
31547                 channel_ids_constr.data = NULL;
31548         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
31549                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
31550                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
31551                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
31552                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
31553                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
31554         }
31555         LDKChannelConfig config_conv;
31556         config_conv.inner = untag_ptr(config);
31557         config_conv.is_owned = ptr_is_owned(config);
31558         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
31559         config_conv.is_owned = false;
31560         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31561         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
31562         return tag_ptr(ret_conv, true);
31563 }
31564
31565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
31566         LDKChannelManager this_arg_conv;
31567         this_arg_conv.inner = untag_ptr(this_arg);
31568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31570         this_arg_conv.is_owned = false;
31571         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
31572 }
31573
31574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
31575         LDKChannelManager this_arg_conv;
31576         this_arg_conv.inner = untag_ptr(this_arg);
31577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31579         this_arg_conv.is_owned = false;
31580         ChannelManager_timer_tick_occurred(&this_arg_conv);
31581 }
31582
31583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
31584         LDKChannelManager this_arg_conv;
31585         this_arg_conv.inner = untag_ptr(this_arg);
31586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31588         this_arg_conv.is_owned = false;
31589         unsigned char payment_hash_arr[32];
31590         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31591         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
31592         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
31593         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
31594 }
31595
31596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
31597         LDKChannelManager this_arg_conv;
31598         this_arg_conv.inner = untag_ptr(this_arg);
31599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31601         this_arg_conv.is_owned = false;
31602         LDKThirtyTwoBytes payment_preimage_ref;
31603         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
31604         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
31605         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
31606 }
31607
31608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
31609         LDKChannelManager this_arg_conv;
31610         this_arg_conv.inner = untag_ptr(this_arg);
31611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31613         this_arg_conv.is_owned = false;
31614         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31615         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
31616         return ret_arr;
31617 }
31618
31619 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) {
31620         LDKChannelManager this_arg_conv;
31621         this_arg_conv.inner = untag_ptr(this_arg);
31622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31624         this_arg_conv.is_owned = false;
31625         unsigned char temporary_channel_id_arr[32];
31626         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31627         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31628         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31629         LDKPublicKey counterparty_node_id_ref;
31630         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31631         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31632         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31633         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
31634         return tag_ptr(ret_conv, true);
31635 }
31636
31637 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) {
31638         LDKChannelManager this_arg_conv;
31639         this_arg_conv.inner = untag_ptr(this_arg);
31640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31642         this_arg_conv.is_owned = false;
31643         unsigned char temporary_channel_id_arr[32];
31644         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
31645         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
31646         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
31647         LDKPublicKey counterparty_node_id_ref;
31648         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
31649         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
31650         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
31651         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
31652         return tag_ptr(ret_conv, true);
31653 }
31654
31655 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) {
31656         LDKChannelManager this_arg_conv;
31657         this_arg_conv.inner = untag_ptr(this_arg);
31658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31660         this_arg_conv.is_owned = false;
31661         void* min_value_msat_ptr = untag_ptr(min_value_msat);
31662         CHECK_ACCESS(min_value_msat_ptr);
31663         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31664         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
31665         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
31666         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
31667         return tag_ptr(ret_conv, true);
31668 }
31669
31670 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) {
31671         LDKChannelManager this_arg_conv;
31672         this_arg_conv.inner = untag_ptr(this_arg);
31673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31675         this_arg_conv.is_owned = false;
31676         void* min_value_msat_ptr = untag_ptr(min_value_msat);
31677         CHECK_ACCESS(min_value_msat_ptr);
31678         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31679         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
31680         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
31681         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
31682         return tag_ptr(ret_conv, true);
31683 }
31684
31685 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) {
31686         LDKChannelManager this_arg_conv;
31687         this_arg_conv.inner = untag_ptr(this_arg);
31688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31690         this_arg_conv.is_owned = false;
31691         LDKThirtyTwoBytes payment_hash_ref;
31692         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31693         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31694         void* min_value_msat_ptr = untag_ptr(min_value_msat);
31695         CHECK_ACCESS(min_value_msat_ptr);
31696         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31697         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
31698         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
31699         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
31700         return tag_ptr(ret_conv, true);
31701 }
31702
31703 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) {
31704         LDKChannelManager this_arg_conv;
31705         this_arg_conv.inner = untag_ptr(this_arg);
31706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31708         this_arg_conv.is_owned = false;
31709         LDKThirtyTwoBytes payment_hash_ref;
31710         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31711         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31712         void* min_value_msat_ptr = untag_ptr(min_value_msat);
31713         CHECK_ACCESS(min_value_msat_ptr);
31714         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
31715         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
31716         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
31717         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
31718         return tag_ptr(ret_conv, true);
31719 }
31720
31721 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) {
31722         LDKChannelManager this_arg_conv;
31723         this_arg_conv.inner = untag_ptr(this_arg);
31724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31726         this_arg_conv.is_owned = false;
31727         LDKThirtyTwoBytes payment_hash_ref;
31728         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
31729         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
31730         LDKThirtyTwoBytes payment_secret_ref;
31731         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
31732         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
31733         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
31734         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
31735         return tag_ptr(ret_conv, true);
31736 }
31737
31738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
31739         LDKChannelManager this_arg_conv;
31740         this_arg_conv.inner = untag_ptr(this_arg);
31741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31743         this_arg_conv.is_owned = false;
31744         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
31745         return ret_conv;
31746 }
31747
31748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
31749         LDKChannelManager this_arg_conv;
31750         this_arg_conv.inner = untag_ptr(this_arg);
31751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31753         this_arg_conv.is_owned = false;
31754         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
31755         int64_t ret_ref = 0;
31756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31758         return ret_ref;
31759 }
31760
31761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31762         LDKChannelManager this_arg_conv;
31763         this_arg_conv.inner = untag_ptr(this_arg);
31764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31766         this_arg_conv.is_owned = false;
31767         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
31768         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
31769         return tag_ptr(ret_ret, true);
31770 }
31771
31772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
31773         LDKChannelManager this_arg_conv;
31774         this_arg_conv.inner = untag_ptr(this_arg);
31775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31777         this_arg_conv.is_owned = false;
31778         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
31779         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
31780         return tag_ptr(ret_ret, true);
31781 }
31782
31783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
31784         LDKChannelManager this_arg_conv;
31785         this_arg_conv.inner = untag_ptr(this_arg);
31786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31788         this_arg_conv.is_owned = false;
31789         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
31790         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
31791         return tag_ptr(ret_ret, true);
31792 }
31793
31794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
31795         LDKChannelManager this_arg_conv;
31796         this_arg_conv.inner = untag_ptr(this_arg);
31797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31799         this_arg_conv.is_owned = false;
31800         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
31801         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
31802         return tag_ptr(ret_ret, true);
31803 }
31804
31805 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) {
31806         LDKChannelManager this_arg_conv;
31807         this_arg_conv.inner = untag_ptr(this_arg);
31808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31810         this_arg_conv.is_owned = false;
31811         jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
31812         return ret_conv;
31813 }
31814
31815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
31816         LDKChannelManager this_arg_conv;
31817         this_arg_conv.inner = untag_ptr(this_arg);
31818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31820         this_arg_conv.is_owned = false;
31821         ChannelManager_await_persistable_update(&this_arg_conv);
31822 }
31823
31824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1persistable_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
31825         LDKChannelManager this_arg_conv;
31826         this_arg_conv.inner = untag_ptr(this_arg);
31827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31829         this_arg_conv.is_owned = false;
31830         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
31831         int64_t ret_ref = 0;
31832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31834         return ret_ref;
31835 }
31836
31837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
31838         LDKChannelManager this_arg_conv;
31839         this_arg_conv.inner = untag_ptr(this_arg);
31840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31842         this_arg_conv.is_owned = false;
31843         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
31844         int64_t ret_ref = 0;
31845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31847         return ret_ref;
31848 }
31849
31850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
31851         LDKChannelManager this_arg_conv;
31852         this_arg_conv.inner = untag_ptr(this_arg);
31853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31855         this_arg_conv.is_owned = false;
31856         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
31857         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
31858         return tag_ptr(ret_ret, true);
31859 }
31860
31861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
31862         LDKCounterpartyForwardingInfo obj_conv;
31863         obj_conv.inner = untag_ptr(obj);
31864         obj_conv.is_owned = ptr_is_owned(obj);
31865         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31866         obj_conv.is_owned = false;
31867         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
31868         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31869         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31870         CVec_u8Z_free(ret_var);
31871         return ret_arr;
31872 }
31873
31874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31875         LDKu8slice ser_ref;
31876         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31877         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31878         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
31879         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
31880         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31881         return tag_ptr(ret_conv, true);
31882 }
31883
31884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
31885         LDKChannelCounterparty obj_conv;
31886         obj_conv.inner = untag_ptr(obj);
31887         obj_conv.is_owned = ptr_is_owned(obj);
31888         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31889         obj_conv.is_owned = false;
31890         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
31891         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31892         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31893         CVec_u8Z_free(ret_var);
31894         return ret_arr;
31895 }
31896
31897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31898         LDKu8slice ser_ref;
31899         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31900         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31901         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
31902         *ret_conv = ChannelCounterparty_read(ser_ref);
31903         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31904         return tag_ptr(ret_conv, true);
31905 }
31906
31907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
31908         LDKChannelDetails obj_conv;
31909         obj_conv.inner = untag_ptr(obj);
31910         obj_conv.is_owned = ptr_is_owned(obj);
31911         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31912         obj_conv.is_owned = false;
31913         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
31914         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31915         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31916         CVec_u8Z_free(ret_var);
31917         return ret_arr;
31918 }
31919
31920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31921         LDKu8slice ser_ref;
31922         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31923         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31924         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31925         *ret_conv = ChannelDetails_read(ser_ref);
31926         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31927         return tag_ptr(ret_conv, true);
31928 }
31929
31930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
31931         LDKPhantomRouteHints obj_conv;
31932         obj_conv.inner = untag_ptr(obj);
31933         obj_conv.is_owned = ptr_is_owned(obj);
31934         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31935         obj_conv.is_owned = false;
31936         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
31937         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31938         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31939         CVec_u8Z_free(ret_var);
31940         return ret_arr;
31941 }
31942
31943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
31944         LDKu8slice ser_ref;
31945         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
31946         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
31947         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
31948         *ret_conv = PhantomRouteHints_read(ser_ref);
31949         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
31950         return tag_ptr(ret_conv, true);
31951 }
31952
31953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
31954         LDKChannelManager obj_conv;
31955         obj_conv.inner = untag_ptr(obj);
31956         obj_conv.is_owned = ptr_is_owned(obj);
31957         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31958         obj_conv.is_owned = false;
31959         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
31960         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31961         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31962         CVec_u8Z_free(ret_var);
31963         return ret_arr;
31964 }
31965
31966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31967         LDKChannelManagerReadArgs this_obj_conv;
31968         this_obj_conv.inner = untag_ptr(this_obj);
31969         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31971         ChannelManagerReadArgs_free(this_obj_conv);
31972 }
31973
31974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
31975         LDKChannelManagerReadArgs this_ptr_conv;
31976         this_ptr_conv.inner = untag_ptr(this_ptr);
31977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31979         this_ptr_conv.is_owned = false;
31980         // WARNING: This object doesn't live past this scope, needs clone!
31981         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
31982         return ret_ret;
31983 }
31984
31985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31986         LDKChannelManagerReadArgs this_ptr_conv;
31987         this_ptr_conv.inner = untag_ptr(this_ptr);
31988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31990         this_ptr_conv.is_owned = false;
31991         void* val_ptr = untag_ptr(val);
31992         CHECK_ACCESS(val_ptr);
31993         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
31994         if (val_conv.free == LDKKeysInterface_JCalls_free) {
31995                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31996                 LDKKeysInterface_JCalls_cloned(&val_conv);
31997         }
31998         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
31999 }
32000
32001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
32002         LDKChannelManagerReadArgs this_ptr_conv;
32003         this_ptr_conv.inner = untag_ptr(this_ptr);
32004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32006         this_ptr_conv.is_owned = false;
32007         // WARNING: This object doesn't live past this scope, needs clone!
32008         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
32009         return ret_ret;
32010 }
32011
32012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32013         LDKChannelManagerReadArgs this_ptr_conv;
32014         this_ptr_conv.inner = untag_ptr(this_ptr);
32015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017         this_ptr_conv.is_owned = false;
32018         void* val_ptr = untag_ptr(val);
32019         CHECK_ACCESS(val_ptr);
32020         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
32021         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
32022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32023                 LDKFeeEstimator_JCalls_cloned(&val_conv);
32024         }
32025         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
32026 }
32027
32028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
32029         LDKChannelManagerReadArgs this_ptr_conv;
32030         this_ptr_conv.inner = untag_ptr(this_ptr);
32031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32033         this_ptr_conv.is_owned = false;
32034         // WARNING: This object doesn't live past this scope, needs clone!
32035         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
32036         return ret_ret;
32037 }
32038
32039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32040         LDKChannelManagerReadArgs this_ptr_conv;
32041         this_ptr_conv.inner = untag_ptr(this_ptr);
32042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32044         this_ptr_conv.is_owned = false;
32045         void* val_ptr = untag_ptr(val);
32046         CHECK_ACCESS(val_ptr);
32047         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
32048         if (val_conv.free == LDKWatch_JCalls_free) {
32049                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32050                 LDKWatch_JCalls_cloned(&val_conv);
32051         }
32052         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
32053 }
32054
32055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
32056         LDKChannelManagerReadArgs this_ptr_conv;
32057         this_ptr_conv.inner = untag_ptr(this_ptr);
32058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32060         this_ptr_conv.is_owned = false;
32061         // WARNING: This object doesn't live past this scope, needs clone!
32062         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
32063         return ret_ret;
32064 }
32065
32066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32067         LDKChannelManagerReadArgs this_ptr_conv;
32068         this_ptr_conv.inner = untag_ptr(this_ptr);
32069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32071         this_ptr_conv.is_owned = false;
32072         void* val_ptr = untag_ptr(val);
32073         CHECK_ACCESS(val_ptr);
32074         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
32075         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
32076                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32077                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
32078         }
32079         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
32080 }
32081
32082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
32083         LDKChannelManagerReadArgs this_ptr_conv;
32084         this_ptr_conv.inner = untag_ptr(this_ptr);
32085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32087         this_ptr_conv.is_owned = false;
32088         // WARNING: This object doesn't live past this scope, needs clone!
32089         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
32090         return ret_ret;
32091 }
32092
32093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32094         LDKChannelManagerReadArgs this_ptr_conv;
32095         this_ptr_conv.inner = untag_ptr(this_ptr);
32096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32098         this_ptr_conv.is_owned = false;
32099         void* val_ptr = untag_ptr(val);
32100         CHECK_ACCESS(val_ptr);
32101         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
32102         if (val_conv.free == LDKLogger_JCalls_free) {
32103                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32104                 LDKLogger_JCalls_cloned(&val_conv);
32105         }
32106         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
32107 }
32108
32109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
32110         LDKChannelManagerReadArgs this_ptr_conv;
32111         this_ptr_conv.inner = untag_ptr(this_ptr);
32112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32114         this_ptr_conv.is_owned = false;
32115         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
32116         int64_t ret_ref = 0;
32117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32119         return ret_ref;
32120 }
32121
32122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32123         LDKChannelManagerReadArgs this_ptr_conv;
32124         this_ptr_conv.inner = untag_ptr(this_ptr);
32125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32127         this_ptr_conv.is_owned = false;
32128         LDKUserConfig val_conv;
32129         val_conv.inner = untag_ptr(val);
32130         val_conv.is_owned = ptr_is_owned(val);
32131         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32132         val_conv = UserConfig_clone(&val_conv);
32133         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
32134 }
32135
32136 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) {
32137         void* keys_manager_ptr = untag_ptr(keys_manager);
32138         CHECK_ACCESS(keys_manager_ptr);
32139         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
32140         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
32141                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32142                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
32143         }
32144         void* fee_estimator_ptr = untag_ptr(fee_estimator);
32145         CHECK_ACCESS(fee_estimator_ptr);
32146         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
32147         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
32148                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32149                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
32150         }
32151         void* chain_monitor_ptr = untag_ptr(chain_monitor);
32152         CHECK_ACCESS(chain_monitor_ptr);
32153         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
32154         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
32155                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32156                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
32157         }
32158         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
32159         CHECK_ACCESS(tx_broadcaster_ptr);
32160         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
32161         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32162                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32163                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
32164         }
32165         void* logger_ptr = untag_ptr(logger);
32166         CHECK_ACCESS(logger_ptr);
32167         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32168         if (logger_conv.free == LDKLogger_JCalls_free) {
32169                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32170                 LDKLogger_JCalls_cloned(&logger_conv);
32171         }
32172         LDKUserConfig default_config_conv;
32173         default_config_conv.inner = untag_ptr(default_config);
32174         default_config_conv.is_owned = ptr_is_owned(default_config);
32175         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
32176         default_config_conv = UserConfig_clone(&default_config_conv);
32177         LDKCVec_ChannelMonitorZ channel_monitors_constr;
32178         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
32179         if (channel_monitors_constr.datalen > 0)
32180                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
32181         else
32182                 channel_monitors_constr.data = NULL;
32183         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
32184         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
32185                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
32186                 LDKChannelMonitor channel_monitors_conv_16_conv;
32187                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
32188                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
32189                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
32190                 channel_monitors_conv_16_conv.is_owned = false;
32191                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
32192         }
32193         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
32194         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);
32195         int64_t ret_ref = 0;
32196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32198         return ret_ref;
32199 }
32200
32201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
32202         LDKu8slice ser_ref;
32203         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32204         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32205         LDKChannelManagerReadArgs arg_conv;
32206         arg_conv.inner = untag_ptr(arg);
32207         arg_conv.is_owned = ptr_is_owned(arg);
32208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32209         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
32210         
32211         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
32212         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
32213         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32214         return tag_ptr(ret_conv, true);
32215 }
32216
32217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32218         LDKExpandedKey this_obj_conv;
32219         this_obj_conv.inner = untag_ptr(this_obj);
32220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32222         ExpandedKey_free(this_obj_conv);
32223 }
32224
32225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
32226         unsigned char key_material_arr[32];
32227         CHECK((*env)->GetArrayLength(env, key_material) == 32);
32228         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
32229         unsigned char (*key_material_ref)[32] = &key_material_arr;
32230         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
32231         int64_t ret_ref = 0;
32232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32234         return ret_ref;
32235 }
32236
32237 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) {
32238         LDKExpandedKey keys_conv;
32239         keys_conv.inner = untag_ptr(keys);
32240         keys_conv.is_owned = ptr_is_owned(keys);
32241         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
32242         keys_conv.is_owned = false;
32243         void* min_value_msat_ptr = untag_ptr(min_value_msat);
32244         CHECK_ACCESS(min_value_msat_ptr);
32245         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
32246         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
32247         void* keys_manager_ptr = untag_ptr(keys_manager);
32248         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
32249         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
32250         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
32251         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
32252         return tag_ptr(ret_conv, true);
32253 }
32254
32255 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) {
32256         LDKExpandedKey keys_conv;
32257         keys_conv.inner = untag_ptr(keys);
32258         keys_conv.is_owned = ptr_is_owned(keys);
32259         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
32260         keys_conv.is_owned = false;
32261         void* min_value_msat_ptr = untag_ptr(min_value_msat);
32262         CHECK_ACCESS(min_value_msat_ptr);
32263         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
32264         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
32265         LDKThirtyTwoBytes payment_hash_ref;
32266         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
32267         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
32268         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
32269         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
32270         return tag_ptr(ret_conv, true);
32271 }
32272
32273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32274         LDKDecodeError this_obj_conv;
32275         this_obj_conv.inner = untag_ptr(this_obj);
32276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32278         DecodeError_free(this_obj_conv);
32279 }
32280
32281 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
32282         LDKDecodeError ret_var = DecodeError_clone(arg);
32283         int64_t ret_ref = 0;
32284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32286         return ret_ref;
32287 }
32288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32289         LDKDecodeError arg_conv;
32290         arg_conv.inner = untag_ptr(arg);
32291         arg_conv.is_owned = ptr_is_owned(arg);
32292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32293         arg_conv.is_owned = false;
32294         int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
32295         return ret_conv;
32296 }
32297
32298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32299         LDKDecodeError orig_conv;
32300         orig_conv.inner = untag_ptr(orig);
32301         orig_conv.is_owned = ptr_is_owned(orig);
32302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32303         orig_conv.is_owned = false;
32304         LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
32305         int64_t ret_ref = 0;
32306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32308         return ret_ref;
32309 }
32310
32311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32312         LDKInit this_obj_conv;
32313         this_obj_conv.inner = untag_ptr(this_obj);
32314         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32316         Init_free(this_obj_conv);
32317 }
32318
32319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
32320         LDKInit this_ptr_conv;
32321         this_ptr_conv.inner = untag_ptr(this_ptr);
32322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32324         this_ptr_conv.is_owned = false;
32325         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
32326         int64_t ret_ref = 0;
32327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32329         return ret_ref;
32330 }
32331
32332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32333         LDKInit this_ptr_conv;
32334         this_ptr_conv.inner = untag_ptr(this_ptr);
32335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32337         this_ptr_conv.is_owned = false;
32338         LDKInitFeatures val_conv;
32339         val_conv.inner = untag_ptr(val);
32340         val_conv.is_owned = ptr_is_owned(val);
32341         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32342         val_conv = InitFeatures_clone(&val_conv);
32343         Init_set_features(&this_ptr_conv, val_conv);
32344 }
32345
32346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
32347         LDKInit this_ptr_conv;
32348         this_ptr_conv.inner = untag_ptr(this_ptr);
32349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32351         this_ptr_conv.is_owned = false;
32352         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
32353         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
32354         int64_t ret_ref = tag_ptr(ret_copy, true);
32355         return ret_ref;
32356 }
32357
32358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32359         LDKInit 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         void* val_ptr = untag_ptr(val);
32365         CHECK_ACCESS(val_ptr);
32366         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
32367         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
32368         Init_set_remote_network_address(&this_ptr_conv, val_conv);
32369 }
32370
32371 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) {
32372         LDKInitFeatures features_arg_conv;
32373         features_arg_conv.inner = untag_ptr(features_arg);
32374         features_arg_conv.is_owned = ptr_is_owned(features_arg);
32375         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
32376         features_arg_conv = InitFeatures_clone(&features_arg_conv);
32377         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
32378         CHECK_ACCESS(remote_network_address_arg_ptr);
32379         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
32380         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
32381         int64_t ret_ref = 0;
32382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32384         return ret_ref;
32385 }
32386
32387 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
32388         LDKInit ret_var = Init_clone(arg);
32389         int64_t ret_ref = 0;
32390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32392         return ret_ref;
32393 }
32394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32395         LDKInit arg_conv;
32396         arg_conv.inner = untag_ptr(arg);
32397         arg_conv.is_owned = ptr_is_owned(arg);
32398         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32399         arg_conv.is_owned = false;
32400         int64_t ret_conv = Init_clone_ptr(&arg_conv);
32401         return ret_conv;
32402 }
32403
32404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32405         LDKInit orig_conv;
32406         orig_conv.inner = untag_ptr(orig);
32407         orig_conv.is_owned = ptr_is_owned(orig);
32408         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32409         orig_conv.is_owned = false;
32410         LDKInit ret_var = Init_clone(&orig_conv);
32411         int64_t ret_ref = 0;
32412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32414         return ret_ref;
32415 }
32416
32417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32418         LDKErrorMessage this_obj_conv;
32419         this_obj_conv.inner = untag_ptr(this_obj);
32420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32422         ErrorMessage_free(this_obj_conv);
32423 }
32424
32425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32426         LDKErrorMessage this_ptr_conv;
32427         this_ptr_conv.inner = untag_ptr(this_ptr);
32428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32430         this_ptr_conv.is_owned = false;
32431         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32432         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
32433         return ret_arr;
32434 }
32435
32436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32437         LDKErrorMessage this_ptr_conv;
32438         this_ptr_conv.inner = untag_ptr(this_ptr);
32439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32441         this_ptr_conv.is_owned = false;
32442         LDKThirtyTwoBytes val_ref;
32443         CHECK((*env)->GetArrayLength(env, val) == 32);
32444         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32445         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
32446 }
32447
32448 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
32449         LDKErrorMessage this_ptr_conv;
32450         this_ptr_conv.inner = untag_ptr(this_ptr);
32451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32453         this_ptr_conv.is_owned = false;
32454         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
32455         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32456         Str_free(ret_str);
32457         return ret_conv;
32458 }
32459
32460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
32461         LDKErrorMessage this_ptr_conv;
32462         this_ptr_conv.inner = untag_ptr(this_ptr);
32463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32465         this_ptr_conv.is_owned = false;
32466         LDKStr val_conv = java_to_owned_str(env, val);
32467         ErrorMessage_set_data(&this_ptr_conv, val_conv);
32468 }
32469
32470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
32471         LDKThirtyTwoBytes channel_id_arg_ref;
32472         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32473         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32474         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
32475         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
32476         int64_t ret_ref = 0;
32477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32479         return ret_ref;
32480 }
32481
32482 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
32483         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
32484         int64_t ret_ref = 0;
32485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32487         return ret_ref;
32488 }
32489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32490         LDKErrorMessage arg_conv;
32491         arg_conv.inner = untag_ptr(arg);
32492         arg_conv.is_owned = ptr_is_owned(arg);
32493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32494         arg_conv.is_owned = false;
32495         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
32496         return ret_conv;
32497 }
32498
32499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32500         LDKErrorMessage orig_conv;
32501         orig_conv.inner = untag_ptr(orig);
32502         orig_conv.is_owned = ptr_is_owned(orig);
32503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32504         orig_conv.is_owned = false;
32505         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
32506         int64_t ret_ref = 0;
32507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32509         return ret_ref;
32510 }
32511
32512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32513         LDKWarningMessage this_obj_conv;
32514         this_obj_conv.inner = untag_ptr(this_obj);
32515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32517         WarningMessage_free(this_obj_conv);
32518 }
32519
32520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32521         LDKWarningMessage this_ptr_conv;
32522         this_ptr_conv.inner = untag_ptr(this_ptr);
32523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32525         this_ptr_conv.is_owned = false;
32526         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32527         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
32528         return ret_arr;
32529 }
32530
32531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32532         LDKWarningMessage this_ptr_conv;
32533         this_ptr_conv.inner = untag_ptr(this_ptr);
32534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32536         this_ptr_conv.is_owned = false;
32537         LDKThirtyTwoBytes val_ref;
32538         CHECK((*env)->GetArrayLength(env, val) == 32);
32539         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32540         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
32541 }
32542
32543 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
32544         LDKWarningMessage this_ptr_conv;
32545         this_ptr_conv.inner = untag_ptr(this_ptr);
32546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32548         this_ptr_conv.is_owned = false;
32549         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
32550         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32551         Str_free(ret_str);
32552         return ret_conv;
32553 }
32554
32555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
32556         LDKWarningMessage this_ptr_conv;
32557         this_ptr_conv.inner = untag_ptr(this_ptr);
32558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32560         this_ptr_conv.is_owned = false;
32561         LDKStr val_conv = java_to_owned_str(env, val);
32562         WarningMessage_set_data(&this_ptr_conv, val_conv);
32563 }
32564
32565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
32566         LDKThirtyTwoBytes channel_id_arg_ref;
32567         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32568         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32569         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
32570         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
32571         int64_t ret_ref = 0;
32572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32574         return ret_ref;
32575 }
32576
32577 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
32578         LDKWarningMessage ret_var = WarningMessage_clone(arg);
32579         int64_t ret_ref = 0;
32580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32582         return ret_ref;
32583 }
32584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32585         LDKWarningMessage arg_conv;
32586         arg_conv.inner = untag_ptr(arg);
32587         arg_conv.is_owned = ptr_is_owned(arg);
32588         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32589         arg_conv.is_owned = false;
32590         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
32591         return ret_conv;
32592 }
32593
32594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32595         LDKWarningMessage orig_conv;
32596         orig_conv.inner = untag_ptr(orig);
32597         orig_conv.is_owned = ptr_is_owned(orig);
32598         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32599         orig_conv.is_owned = false;
32600         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
32601         int64_t ret_ref = 0;
32602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32604         return ret_ref;
32605 }
32606
32607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32608         LDKPing this_obj_conv;
32609         this_obj_conv.inner = untag_ptr(this_obj);
32610         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32612         Ping_free(this_obj_conv);
32613 }
32614
32615 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32616         LDKPing this_ptr_conv;
32617         this_ptr_conv.inner = untag_ptr(this_ptr);
32618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32620         this_ptr_conv.is_owned = false;
32621         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
32622         return ret_conv;
32623 }
32624
32625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32626         LDKPing this_ptr_conv;
32627         this_ptr_conv.inner = untag_ptr(this_ptr);
32628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32630         this_ptr_conv.is_owned = false;
32631         Ping_set_ponglen(&this_ptr_conv, val);
32632 }
32633
32634 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32635         LDKPing this_ptr_conv;
32636         this_ptr_conv.inner = untag_ptr(this_ptr);
32637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32639         this_ptr_conv.is_owned = false;
32640         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
32641         return ret_conv;
32642 }
32643
32644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32645         LDKPing this_ptr_conv;
32646         this_ptr_conv.inner = untag_ptr(this_ptr);
32647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32649         this_ptr_conv.is_owned = false;
32650         Ping_set_byteslen(&this_ptr_conv, val);
32651 }
32652
32653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
32654         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
32655         int64_t ret_ref = 0;
32656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32658         return ret_ref;
32659 }
32660
32661 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
32662         LDKPing ret_var = Ping_clone(arg);
32663         int64_t ret_ref = 0;
32664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32666         return ret_ref;
32667 }
32668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32669         LDKPing arg_conv;
32670         arg_conv.inner = untag_ptr(arg);
32671         arg_conv.is_owned = ptr_is_owned(arg);
32672         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32673         arg_conv.is_owned = false;
32674         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
32675         return ret_conv;
32676 }
32677
32678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32679         LDKPing orig_conv;
32680         orig_conv.inner = untag_ptr(orig);
32681         orig_conv.is_owned = ptr_is_owned(orig);
32682         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32683         orig_conv.is_owned = false;
32684         LDKPing ret_var = Ping_clone(&orig_conv);
32685         int64_t ret_ref = 0;
32686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32688         return ret_ref;
32689 }
32690
32691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32692         LDKPong this_obj_conv;
32693         this_obj_conv.inner = untag_ptr(this_obj);
32694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32696         Pong_free(this_obj_conv);
32697 }
32698
32699 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
32700         LDKPong this_ptr_conv;
32701         this_ptr_conv.inner = untag_ptr(this_ptr);
32702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32704         this_ptr_conv.is_owned = false;
32705         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
32706         return ret_conv;
32707 }
32708
32709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32710         LDKPong this_ptr_conv;
32711         this_ptr_conv.inner = untag_ptr(this_ptr);
32712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32714         this_ptr_conv.is_owned = false;
32715         Pong_set_byteslen(&this_ptr_conv, val);
32716 }
32717
32718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
32719         LDKPong ret_var = Pong_new(byteslen_arg);
32720         int64_t ret_ref = 0;
32721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32723         return ret_ref;
32724 }
32725
32726 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
32727         LDKPong ret_var = Pong_clone(arg);
32728         int64_t ret_ref = 0;
32729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32731         return ret_ref;
32732 }
32733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32734         LDKPong arg_conv;
32735         arg_conv.inner = untag_ptr(arg);
32736         arg_conv.is_owned = ptr_is_owned(arg);
32737         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32738         arg_conv.is_owned = false;
32739         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
32740         return ret_conv;
32741 }
32742
32743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32744         LDKPong orig_conv;
32745         orig_conv.inner = untag_ptr(orig);
32746         orig_conv.is_owned = ptr_is_owned(orig);
32747         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32748         orig_conv.is_owned = false;
32749         LDKPong ret_var = Pong_clone(&orig_conv);
32750         int64_t ret_ref = 0;
32751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32753         return ret_ref;
32754 }
32755
32756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32757         LDKOpenChannel this_obj_conv;
32758         this_obj_conv.inner = untag_ptr(this_obj);
32759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32761         OpenChannel_free(this_obj_conv);
32762 }
32763
32764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32765         LDKOpenChannel 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, *OpenChannel_get_chain_hash(&this_ptr_conv));
32772         return ret_arr;
32773 }
32774
32775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32776         LDKOpenChannel 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         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
32785 }
32786
32787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32788         LDKOpenChannel this_ptr_conv;
32789         this_ptr_conv.inner = untag_ptr(this_ptr);
32790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32792         this_ptr_conv.is_owned = false;
32793         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32794         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
32795         return ret_arr;
32796 }
32797
32798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32799         LDKOpenChannel this_ptr_conv;
32800         this_ptr_conv.inner = untag_ptr(this_ptr);
32801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32803         this_ptr_conv.is_owned = false;
32804         LDKThirtyTwoBytes val_ref;
32805         CHECK((*env)->GetArrayLength(env, val) == 32);
32806         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32807         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
32808 }
32809
32810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32811         LDKOpenChannel this_ptr_conv;
32812         this_ptr_conv.inner = untag_ptr(this_ptr);
32813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32815         this_ptr_conv.is_owned = false;
32816         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
32817         return ret_conv;
32818 }
32819
32820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32821         LDKOpenChannel this_ptr_conv;
32822         this_ptr_conv.inner = untag_ptr(this_ptr);
32823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32825         this_ptr_conv.is_owned = false;
32826         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
32827 }
32828
32829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32830         LDKOpenChannel this_ptr_conv;
32831         this_ptr_conv.inner = untag_ptr(this_ptr);
32832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32834         this_ptr_conv.is_owned = false;
32835         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
32836         return ret_conv;
32837 }
32838
32839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32840         LDKOpenChannel 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         OpenChannel_set_push_msat(&this_ptr_conv, val);
32846 }
32847
32848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32849         LDKOpenChannel this_ptr_conv;
32850         this_ptr_conv.inner = untag_ptr(this_ptr);
32851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32853         this_ptr_conv.is_owned = false;
32854         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
32855         return ret_conv;
32856 }
32857
32858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32859         LDKOpenChannel this_ptr_conv;
32860         this_ptr_conv.inner = untag_ptr(this_ptr);
32861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32863         this_ptr_conv.is_owned = false;
32864         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
32865 }
32866
32867 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) {
32868         LDKOpenChannel this_ptr_conv;
32869         this_ptr_conv.inner = untag_ptr(this_ptr);
32870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32872         this_ptr_conv.is_owned = false;
32873         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
32874         return ret_conv;
32875 }
32876
32877 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) {
32878         LDKOpenChannel this_ptr_conv;
32879         this_ptr_conv.inner = untag_ptr(this_ptr);
32880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32882         this_ptr_conv.is_owned = false;
32883         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
32884 }
32885
32886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32887         LDKOpenChannel this_ptr_conv;
32888         this_ptr_conv.inner = untag_ptr(this_ptr);
32889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32891         this_ptr_conv.is_owned = false;
32892         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
32893         return ret_conv;
32894 }
32895
32896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32897         LDKOpenChannel this_ptr_conv;
32898         this_ptr_conv.inner = untag_ptr(this_ptr);
32899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32901         this_ptr_conv.is_owned = false;
32902         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
32903 }
32904
32905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32906         LDKOpenChannel this_ptr_conv;
32907         this_ptr_conv.inner = untag_ptr(this_ptr);
32908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32910         this_ptr_conv.is_owned = false;
32911         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
32912         return ret_conv;
32913 }
32914
32915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32916         LDKOpenChannel this_ptr_conv;
32917         this_ptr_conv.inner = untag_ptr(this_ptr);
32918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32920         this_ptr_conv.is_owned = false;
32921         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
32922 }
32923
32924 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
32925         LDKOpenChannel this_ptr_conv;
32926         this_ptr_conv.inner = untag_ptr(this_ptr);
32927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32929         this_ptr_conv.is_owned = false;
32930         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
32931         return ret_conv;
32932 }
32933
32934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32935         LDKOpenChannel this_ptr_conv;
32936         this_ptr_conv.inner = untag_ptr(this_ptr);
32937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32939         this_ptr_conv.is_owned = false;
32940         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
32941 }
32942
32943 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
32944         LDKOpenChannel this_ptr_conv;
32945         this_ptr_conv.inner = untag_ptr(this_ptr);
32946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32948         this_ptr_conv.is_owned = false;
32949         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
32950         return ret_conv;
32951 }
32952
32953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32954         LDKOpenChannel this_ptr_conv;
32955         this_ptr_conv.inner = untag_ptr(this_ptr);
32956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32958         this_ptr_conv.is_owned = false;
32959         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
32960 }
32961
32962 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32963         LDKOpenChannel this_ptr_conv;
32964         this_ptr_conv.inner = untag_ptr(this_ptr);
32965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32967         this_ptr_conv.is_owned = false;
32968         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
32969         return ret_conv;
32970 }
32971
32972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32973         LDKOpenChannel this_ptr_conv;
32974         this_ptr_conv.inner = untag_ptr(this_ptr);
32975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32977         this_ptr_conv.is_owned = false;
32978         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
32979 }
32980
32981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32982         LDKOpenChannel this_ptr_conv;
32983         this_ptr_conv.inner = untag_ptr(this_ptr);
32984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32986         this_ptr_conv.is_owned = false;
32987         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32988         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
32989         return ret_arr;
32990 }
32991
32992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32993         LDKOpenChannel this_ptr_conv;
32994         this_ptr_conv.inner = untag_ptr(this_ptr);
32995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32997         this_ptr_conv.is_owned = false;
32998         LDKPublicKey val_ref;
32999         CHECK((*env)->GetArrayLength(env, val) == 33);
33000         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33001         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
33002 }
33003
33004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
33005         LDKOpenChannel this_ptr_conv;
33006         this_ptr_conv.inner = untag_ptr(this_ptr);
33007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33009         this_ptr_conv.is_owned = false;
33010         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33011         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
33012         return ret_arr;
33013 }
33014
33015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33016         LDKOpenChannel this_ptr_conv;
33017         this_ptr_conv.inner = untag_ptr(this_ptr);
33018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33020         this_ptr_conv.is_owned = false;
33021         LDKPublicKey val_ref;
33022         CHECK((*env)->GetArrayLength(env, val) == 33);
33023         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33024         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
33025 }
33026
33027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33028         LDKOpenChannel this_ptr_conv;
33029         this_ptr_conv.inner = untag_ptr(this_ptr);
33030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33032         this_ptr_conv.is_owned = false;
33033         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33034         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
33035         return ret_arr;
33036 }
33037
33038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33039         LDKOpenChannel this_ptr_conv;
33040         this_ptr_conv.inner = untag_ptr(this_ptr);
33041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33043         this_ptr_conv.is_owned = false;
33044         LDKPublicKey val_ref;
33045         CHECK((*env)->GetArrayLength(env, val) == 33);
33046         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33047         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
33048 }
33049
33050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
33051         LDKOpenChannel this_ptr_conv;
33052         this_ptr_conv.inner = untag_ptr(this_ptr);
33053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33055         this_ptr_conv.is_owned = false;
33056         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33057         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
33058         return ret_arr;
33059 }
33060
33061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33062         LDKOpenChannel this_ptr_conv;
33063         this_ptr_conv.inner = untag_ptr(this_ptr);
33064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33066         this_ptr_conv.is_owned = false;
33067         LDKPublicKey val_ref;
33068         CHECK((*env)->GetArrayLength(env, val) == 33);
33069         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33070         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
33071 }
33072
33073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
33074         LDKOpenChannel this_ptr_conv;
33075         this_ptr_conv.inner = untag_ptr(this_ptr);
33076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33078         this_ptr_conv.is_owned = false;
33079         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33080         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
33081         return ret_arr;
33082 }
33083
33084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33085         LDKOpenChannel 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         LDKPublicKey val_ref;
33091         CHECK((*env)->GetArrayLength(env, val) == 33);
33092         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33093         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
33094 }
33095
33096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33097         LDKOpenChannel this_ptr_conv;
33098         this_ptr_conv.inner = untag_ptr(this_ptr);
33099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33101         this_ptr_conv.is_owned = false;
33102         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33103         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
33104         return ret_arr;
33105 }
33106
33107 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) {
33108         LDKOpenChannel this_ptr_conv;
33109         this_ptr_conv.inner = untag_ptr(this_ptr);
33110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33112         this_ptr_conv.is_owned = false;
33113         LDKPublicKey val_ref;
33114         CHECK((*env)->GetArrayLength(env, val) == 33);
33115         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33116         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
33117 }
33118
33119 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
33120         LDKOpenChannel this_ptr_conv;
33121         this_ptr_conv.inner = untag_ptr(this_ptr);
33122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33124         this_ptr_conv.is_owned = false;
33125         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
33126         return ret_conv;
33127 }
33128
33129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
33130         LDKOpenChannel this_ptr_conv;
33131         this_ptr_conv.inner = untag_ptr(this_ptr);
33132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33134         this_ptr_conv.is_owned = false;
33135         OpenChannel_set_channel_flags(&this_ptr_conv, val);
33136 }
33137
33138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
33139         LDKOpenChannel this_ptr_conv;
33140         this_ptr_conv.inner = untag_ptr(this_ptr);
33141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33143         this_ptr_conv.is_owned = false;
33144         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
33145         int64_t ret_ref = 0;
33146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33148         return ret_ref;
33149 }
33150
33151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33152         LDKOpenChannel this_ptr_conv;
33153         this_ptr_conv.inner = untag_ptr(this_ptr);
33154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33156         this_ptr_conv.is_owned = false;
33157         LDKChannelTypeFeatures val_conv;
33158         val_conv.inner = untag_ptr(val);
33159         val_conv.is_owned = ptr_is_owned(val);
33160         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33161         val_conv = ChannelTypeFeatures_clone(&val_conv);
33162         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
33163 }
33164
33165 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
33166         LDKOpenChannel ret_var = OpenChannel_clone(arg);
33167         int64_t ret_ref = 0;
33168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33170         return ret_ref;
33171 }
33172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33173         LDKOpenChannel arg_conv;
33174         arg_conv.inner = untag_ptr(arg);
33175         arg_conv.is_owned = ptr_is_owned(arg);
33176         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33177         arg_conv.is_owned = false;
33178         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
33179         return ret_conv;
33180 }
33181
33182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33183         LDKOpenChannel orig_conv;
33184         orig_conv.inner = untag_ptr(orig);
33185         orig_conv.is_owned = ptr_is_owned(orig);
33186         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33187         orig_conv.is_owned = false;
33188         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
33189         int64_t ret_ref = 0;
33190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33192         return ret_ref;
33193 }
33194
33195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33196         LDKAcceptChannel this_obj_conv;
33197         this_obj_conv.inner = untag_ptr(this_obj);
33198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33200         AcceptChannel_free(this_obj_conv);
33201 }
33202
33203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33204         LDKAcceptChannel this_ptr_conv;
33205         this_ptr_conv.inner = untag_ptr(this_ptr);
33206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33208         this_ptr_conv.is_owned = false;
33209         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33210         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
33211         return ret_arr;
33212 }
33213
33214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33215         LDKAcceptChannel this_ptr_conv;
33216         this_ptr_conv.inner = untag_ptr(this_ptr);
33217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33219         this_ptr_conv.is_owned = false;
33220         LDKThirtyTwoBytes val_ref;
33221         CHECK((*env)->GetArrayLength(env, val) == 32);
33222         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33223         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
33224 }
33225
33226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33227         LDKAcceptChannel this_ptr_conv;
33228         this_ptr_conv.inner = untag_ptr(this_ptr);
33229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33231         this_ptr_conv.is_owned = false;
33232         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
33233         return ret_conv;
33234 }
33235
33236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33237         LDKAcceptChannel this_ptr_conv;
33238         this_ptr_conv.inner = untag_ptr(this_ptr);
33239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33241         this_ptr_conv.is_owned = false;
33242         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
33243 }
33244
33245 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) {
33246         LDKAcceptChannel this_ptr_conv;
33247         this_ptr_conv.inner = untag_ptr(this_ptr);
33248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33250         this_ptr_conv.is_owned = false;
33251         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
33252         return ret_conv;
33253 }
33254
33255 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) {
33256         LDKAcceptChannel this_ptr_conv;
33257         this_ptr_conv.inner = untag_ptr(this_ptr);
33258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33260         this_ptr_conv.is_owned = false;
33261         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
33262 }
33263
33264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33265         LDKAcceptChannel this_ptr_conv;
33266         this_ptr_conv.inner = untag_ptr(this_ptr);
33267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33269         this_ptr_conv.is_owned = false;
33270         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
33271         return ret_conv;
33272 }
33273
33274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33275         LDKAcceptChannel this_ptr_conv;
33276         this_ptr_conv.inner = untag_ptr(this_ptr);
33277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33279         this_ptr_conv.is_owned = false;
33280         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
33281 }
33282
33283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33284         LDKAcceptChannel this_ptr_conv;
33285         this_ptr_conv.inner = untag_ptr(this_ptr);
33286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33288         this_ptr_conv.is_owned = false;
33289         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
33290         return ret_conv;
33291 }
33292
33293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33294         LDKAcceptChannel this_ptr_conv;
33295         this_ptr_conv.inner = untag_ptr(this_ptr);
33296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33298         this_ptr_conv.is_owned = false;
33299         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
33300 }
33301
33302 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
33303         LDKAcceptChannel this_ptr_conv;
33304         this_ptr_conv.inner = untag_ptr(this_ptr);
33305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33307         this_ptr_conv.is_owned = false;
33308         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
33309         return ret_conv;
33310 }
33311
33312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33313         LDKAcceptChannel this_ptr_conv;
33314         this_ptr_conv.inner = untag_ptr(this_ptr);
33315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33317         this_ptr_conv.is_owned = false;
33318         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
33319 }
33320
33321 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
33322         LDKAcceptChannel this_ptr_conv;
33323         this_ptr_conv.inner = untag_ptr(this_ptr);
33324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33326         this_ptr_conv.is_owned = false;
33327         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
33328         return ret_conv;
33329 }
33330
33331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33332         LDKAcceptChannel this_ptr_conv;
33333         this_ptr_conv.inner = untag_ptr(this_ptr);
33334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33336         this_ptr_conv.is_owned = false;
33337         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
33338 }
33339
33340 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
33341         LDKAcceptChannel this_ptr_conv;
33342         this_ptr_conv.inner = untag_ptr(this_ptr);
33343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33345         this_ptr_conv.is_owned = false;
33346         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
33347         return ret_conv;
33348 }
33349
33350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33351         LDKAcceptChannel this_ptr_conv;
33352         this_ptr_conv.inner = untag_ptr(this_ptr);
33353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33355         this_ptr_conv.is_owned = false;
33356         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
33357 }
33358
33359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
33360         LDKAcceptChannel this_ptr_conv;
33361         this_ptr_conv.inner = untag_ptr(this_ptr);
33362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33364         this_ptr_conv.is_owned = false;
33365         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33366         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
33367         return ret_arr;
33368 }
33369
33370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33371         LDKAcceptChannel this_ptr_conv;
33372         this_ptr_conv.inner = untag_ptr(this_ptr);
33373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33375         this_ptr_conv.is_owned = false;
33376         LDKPublicKey val_ref;
33377         CHECK((*env)->GetArrayLength(env, val) == 33);
33378         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33379         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
33380 }
33381
33382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
33383         LDKAcceptChannel this_ptr_conv;
33384         this_ptr_conv.inner = untag_ptr(this_ptr);
33385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33387         this_ptr_conv.is_owned = false;
33388         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33389         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
33390         return ret_arr;
33391 }
33392
33393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33394         LDKAcceptChannel this_ptr_conv;
33395         this_ptr_conv.inner = untag_ptr(this_ptr);
33396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33398         this_ptr_conv.is_owned = false;
33399         LDKPublicKey val_ref;
33400         CHECK((*env)->GetArrayLength(env, val) == 33);
33401         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33402         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
33403 }
33404
33405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33406         LDKAcceptChannel this_ptr_conv;
33407         this_ptr_conv.inner = untag_ptr(this_ptr);
33408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33410         this_ptr_conv.is_owned = false;
33411         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33412         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
33413         return ret_arr;
33414 }
33415
33416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33417         LDKAcceptChannel this_ptr_conv;
33418         this_ptr_conv.inner = untag_ptr(this_ptr);
33419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33421         this_ptr_conv.is_owned = false;
33422         LDKPublicKey val_ref;
33423         CHECK((*env)->GetArrayLength(env, val) == 33);
33424         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33425         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
33426 }
33427
33428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
33429         LDKAcceptChannel this_ptr_conv;
33430         this_ptr_conv.inner = untag_ptr(this_ptr);
33431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33433         this_ptr_conv.is_owned = false;
33434         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33435         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
33436         return ret_arr;
33437 }
33438
33439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33440         LDKAcceptChannel this_ptr_conv;
33441         this_ptr_conv.inner = untag_ptr(this_ptr);
33442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33444         this_ptr_conv.is_owned = false;
33445         LDKPublicKey val_ref;
33446         CHECK((*env)->GetArrayLength(env, val) == 33);
33447         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33448         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
33449 }
33450
33451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
33452         LDKAcceptChannel this_ptr_conv;
33453         this_ptr_conv.inner = untag_ptr(this_ptr);
33454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33456         this_ptr_conv.is_owned = false;
33457         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33458         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
33459         return ret_arr;
33460 }
33461
33462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33463         LDKAcceptChannel this_ptr_conv;
33464         this_ptr_conv.inner = untag_ptr(this_ptr);
33465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33467         this_ptr_conv.is_owned = false;
33468         LDKPublicKey val_ref;
33469         CHECK((*env)->GetArrayLength(env, val) == 33);
33470         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33471         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
33472 }
33473
33474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33475         LDKAcceptChannel this_ptr_conv;
33476         this_ptr_conv.inner = untag_ptr(this_ptr);
33477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33479         this_ptr_conv.is_owned = false;
33480         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33481         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
33482         return ret_arr;
33483 }
33484
33485 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) {
33486         LDKAcceptChannel this_ptr_conv;
33487         this_ptr_conv.inner = untag_ptr(this_ptr);
33488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33490         this_ptr_conv.is_owned = false;
33491         LDKPublicKey val_ref;
33492         CHECK((*env)->GetArrayLength(env, val) == 33);
33493         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33494         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
33495 }
33496
33497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
33498         LDKAcceptChannel this_ptr_conv;
33499         this_ptr_conv.inner = untag_ptr(this_ptr);
33500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33502         this_ptr_conv.is_owned = false;
33503         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
33504         int64_t ret_ref = 0;
33505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33507         return ret_ref;
33508 }
33509
33510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33511         LDKAcceptChannel this_ptr_conv;
33512         this_ptr_conv.inner = untag_ptr(this_ptr);
33513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33515         this_ptr_conv.is_owned = false;
33516         LDKChannelTypeFeatures val_conv;
33517         val_conv.inner = untag_ptr(val);
33518         val_conv.is_owned = ptr_is_owned(val);
33519         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33520         val_conv = ChannelTypeFeatures_clone(&val_conv);
33521         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
33522 }
33523
33524 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
33525         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
33526         int64_t ret_ref = 0;
33527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33529         return ret_ref;
33530 }
33531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33532         LDKAcceptChannel arg_conv;
33533         arg_conv.inner = untag_ptr(arg);
33534         arg_conv.is_owned = ptr_is_owned(arg);
33535         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33536         arg_conv.is_owned = false;
33537         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
33538         return ret_conv;
33539 }
33540
33541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33542         LDKAcceptChannel orig_conv;
33543         orig_conv.inner = untag_ptr(orig);
33544         orig_conv.is_owned = ptr_is_owned(orig);
33545         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33546         orig_conv.is_owned = false;
33547         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
33548         int64_t ret_ref = 0;
33549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33551         return ret_ref;
33552 }
33553
33554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33555         LDKFundingCreated this_obj_conv;
33556         this_obj_conv.inner = untag_ptr(this_obj);
33557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33559         FundingCreated_free(this_obj_conv);
33560 }
33561
33562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33563         LDKFundingCreated this_ptr_conv;
33564         this_ptr_conv.inner = untag_ptr(this_ptr);
33565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33567         this_ptr_conv.is_owned = false;
33568         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33569         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
33570         return ret_arr;
33571 }
33572
33573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33574         LDKFundingCreated this_ptr_conv;
33575         this_ptr_conv.inner = untag_ptr(this_ptr);
33576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33578         this_ptr_conv.is_owned = false;
33579         LDKThirtyTwoBytes val_ref;
33580         CHECK((*env)->GetArrayLength(env, val) == 32);
33581         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33582         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
33583 }
33584
33585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
33586         LDKFundingCreated this_ptr_conv;
33587         this_ptr_conv.inner = untag_ptr(this_ptr);
33588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33590         this_ptr_conv.is_owned = false;
33591         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33592         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
33593         return ret_arr;
33594 }
33595
33596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33597         LDKFundingCreated this_ptr_conv;
33598         this_ptr_conv.inner = untag_ptr(this_ptr);
33599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33601         this_ptr_conv.is_owned = false;
33602         LDKThirtyTwoBytes val_ref;
33603         CHECK((*env)->GetArrayLength(env, val) == 32);
33604         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33605         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
33606 }
33607
33608 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
33609         LDKFundingCreated this_ptr_conv;
33610         this_ptr_conv.inner = untag_ptr(this_ptr);
33611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33613         this_ptr_conv.is_owned = false;
33614         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
33615         return ret_conv;
33616 }
33617
33618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33619         LDKFundingCreated this_ptr_conv;
33620         this_ptr_conv.inner = untag_ptr(this_ptr);
33621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33623         this_ptr_conv.is_owned = false;
33624         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
33625 }
33626
33627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33628         LDKFundingCreated this_ptr_conv;
33629         this_ptr_conv.inner = untag_ptr(this_ptr);
33630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33632         this_ptr_conv.is_owned = false;
33633         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33634         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
33635         return ret_arr;
33636 }
33637
33638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33639         LDKFundingCreated this_ptr_conv;
33640         this_ptr_conv.inner = untag_ptr(this_ptr);
33641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33643         this_ptr_conv.is_owned = false;
33644         LDKSignature val_ref;
33645         CHECK((*env)->GetArrayLength(env, val) == 64);
33646         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33647         FundingCreated_set_signature(&this_ptr_conv, val_ref);
33648 }
33649
33650 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) {
33651         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
33652         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
33653         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
33654         LDKThirtyTwoBytes funding_txid_arg_ref;
33655         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
33656         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
33657         LDKSignature signature_arg_ref;
33658         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33659         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33660         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
33661         int64_t ret_ref = 0;
33662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33664         return ret_ref;
33665 }
33666
33667 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
33668         LDKFundingCreated ret_var = FundingCreated_clone(arg);
33669         int64_t ret_ref = 0;
33670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33672         return ret_ref;
33673 }
33674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33675         LDKFundingCreated arg_conv;
33676         arg_conv.inner = untag_ptr(arg);
33677         arg_conv.is_owned = ptr_is_owned(arg);
33678         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33679         arg_conv.is_owned = false;
33680         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
33681         return ret_conv;
33682 }
33683
33684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33685         LDKFundingCreated orig_conv;
33686         orig_conv.inner = untag_ptr(orig);
33687         orig_conv.is_owned = ptr_is_owned(orig);
33688         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33689         orig_conv.is_owned = false;
33690         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
33691         int64_t ret_ref = 0;
33692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33694         return ret_ref;
33695 }
33696
33697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33698         LDKFundingSigned this_obj_conv;
33699         this_obj_conv.inner = untag_ptr(this_obj);
33700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33702         FundingSigned_free(this_obj_conv);
33703 }
33704
33705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33706         LDKFundingSigned this_ptr_conv;
33707         this_ptr_conv.inner = untag_ptr(this_ptr);
33708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33710         this_ptr_conv.is_owned = false;
33711         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33712         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
33713         return ret_arr;
33714 }
33715
33716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33717         LDKFundingSigned this_ptr_conv;
33718         this_ptr_conv.inner = untag_ptr(this_ptr);
33719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33721         this_ptr_conv.is_owned = false;
33722         LDKThirtyTwoBytes val_ref;
33723         CHECK((*env)->GetArrayLength(env, val) == 32);
33724         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33725         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
33726 }
33727
33728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33729         LDKFundingSigned this_ptr_conv;
33730         this_ptr_conv.inner = untag_ptr(this_ptr);
33731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33733         this_ptr_conv.is_owned = false;
33734         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33735         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
33736         return ret_arr;
33737 }
33738
33739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33740         LDKFundingSigned this_ptr_conv;
33741         this_ptr_conv.inner = untag_ptr(this_ptr);
33742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33744         this_ptr_conv.is_owned = false;
33745         LDKSignature val_ref;
33746         CHECK((*env)->GetArrayLength(env, val) == 64);
33747         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33748         FundingSigned_set_signature(&this_ptr_conv, val_ref);
33749 }
33750
33751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
33752         LDKThirtyTwoBytes channel_id_arg_ref;
33753         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33754         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33755         LDKSignature signature_arg_ref;
33756         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33757         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33758         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
33759         int64_t ret_ref = 0;
33760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33762         return ret_ref;
33763 }
33764
33765 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
33766         LDKFundingSigned ret_var = FundingSigned_clone(arg);
33767         int64_t ret_ref = 0;
33768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33770         return ret_ref;
33771 }
33772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33773         LDKFundingSigned arg_conv;
33774         arg_conv.inner = untag_ptr(arg);
33775         arg_conv.is_owned = ptr_is_owned(arg);
33776         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33777         arg_conv.is_owned = false;
33778         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
33779         return ret_conv;
33780 }
33781
33782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33783         LDKFundingSigned orig_conv;
33784         orig_conv.inner = untag_ptr(orig);
33785         orig_conv.is_owned = ptr_is_owned(orig);
33786         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33787         orig_conv.is_owned = false;
33788         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
33789         int64_t ret_ref = 0;
33790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33792         return ret_ref;
33793 }
33794
33795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33796         LDKChannelReady this_obj_conv;
33797         this_obj_conv.inner = untag_ptr(this_obj);
33798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33800         ChannelReady_free(this_obj_conv);
33801 }
33802
33803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33804         LDKChannelReady this_ptr_conv;
33805         this_ptr_conv.inner = untag_ptr(this_ptr);
33806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33808         this_ptr_conv.is_owned = false;
33809         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33810         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
33811         return ret_arr;
33812 }
33813
33814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33815         LDKChannelReady this_ptr_conv;
33816         this_ptr_conv.inner = untag_ptr(this_ptr);
33817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33819         this_ptr_conv.is_owned = false;
33820         LDKThirtyTwoBytes val_ref;
33821         CHECK((*env)->GetArrayLength(env, val) == 32);
33822         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33823         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
33824 }
33825
33826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33827         LDKChannelReady 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33833         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33834         return ret_arr;
33835 }
33836
33837 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) {
33838         LDKChannelReady this_ptr_conv;
33839         this_ptr_conv.inner = untag_ptr(this_ptr);
33840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33842         this_ptr_conv.is_owned = false;
33843         LDKPublicKey val_ref;
33844         CHECK((*env)->GetArrayLength(env, val) == 33);
33845         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33846         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33847 }
33848
33849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33850         LDKChannelReady this_ptr_conv;
33851         this_ptr_conv.inner = untag_ptr(this_ptr);
33852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33854         this_ptr_conv.is_owned = false;
33855         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
33856         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
33857         int64_t ret_ref = tag_ptr(ret_copy, true);
33858         return ret_ref;
33859 }
33860
33861 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) {
33862         LDKChannelReady this_ptr_conv;
33863         this_ptr_conv.inner = untag_ptr(this_ptr);
33864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33866         this_ptr_conv.is_owned = false;
33867         void* val_ptr = untag_ptr(val);
33868         CHECK_ACCESS(val_ptr);
33869         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
33870         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
33871         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
33872 }
33873
33874 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) {
33875         LDKThirtyTwoBytes channel_id_arg_ref;
33876         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33877         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33878         LDKPublicKey next_per_commitment_point_arg_ref;
33879         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33880         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33881         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
33882         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
33883         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
33884         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
33885         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
33886         int64_t ret_ref = 0;
33887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33889         return ret_ref;
33890 }
33891
33892 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
33893         LDKChannelReady ret_var = ChannelReady_clone(arg);
33894         int64_t ret_ref = 0;
33895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33897         return ret_ref;
33898 }
33899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33900         LDKChannelReady arg_conv;
33901         arg_conv.inner = untag_ptr(arg);
33902         arg_conv.is_owned = ptr_is_owned(arg);
33903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33904         arg_conv.is_owned = false;
33905         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
33906         return ret_conv;
33907 }
33908
33909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33910         LDKChannelReady orig_conv;
33911         orig_conv.inner = untag_ptr(orig);
33912         orig_conv.is_owned = ptr_is_owned(orig);
33913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33914         orig_conv.is_owned = false;
33915         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
33916         int64_t ret_ref = 0;
33917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33919         return ret_ref;
33920 }
33921
33922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33923         LDKShutdown this_obj_conv;
33924         this_obj_conv.inner = untag_ptr(this_obj);
33925         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33927         Shutdown_free(this_obj_conv);
33928 }
33929
33930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33931         LDKShutdown this_ptr_conv;
33932         this_ptr_conv.inner = untag_ptr(this_ptr);
33933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33935         this_ptr_conv.is_owned = false;
33936         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33937         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
33938         return ret_arr;
33939 }
33940
33941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33942         LDKShutdown 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         LDKThirtyTwoBytes val_ref;
33948         CHECK((*env)->GetArrayLength(env, val) == 32);
33949         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33950         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
33951 }
33952
33953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
33954         LDKShutdown this_ptr_conv;
33955         this_ptr_conv.inner = untag_ptr(this_ptr);
33956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33958         this_ptr_conv.is_owned = false;
33959         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
33960         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33961         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33962         return ret_arr;
33963 }
33964
33965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33966         LDKShutdown this_ptr_conv;
33967         this_ptr_conv.inner = untag_ptr(this_ptr);
33968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33970         this_ptr_conv.is_owned = false;
33971         LDKCVec_u8Z val_ref;
33972         val_ref.datalen = (*env)->GetArrayLength(env, val);
33973         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
33974         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
33975         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
33976 }
33977
33978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
33979         LDKThirtyTwoBytes channel_id_arg_ref;
33980         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33981         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33982         LDKCVec_u8Z scriptpubkey_arg_ref;
33983         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
33984         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
33985         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
33986         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
33987         int64_t ret_ref = 0;
33988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33990         return ret_ref;
33991 }
33992
33993 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
33994         LDKShutdown ret_var = Shutdown_clone(arg);
33995         int64_t ret_ref = 0;
33996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33998         return ret_ref;
33999 }
34000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34001         LDKShutdown arg_conv;
34002         arg_conv.inner = untag_ptr(arg);
34003         arg_conv.is_owned = ptr_is_owned(arg);
34004         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34005         arg_conv.is_owned = false;
34006         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
34007         return ret_conv;
34008 }
34009
34010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34011         LDKShutdown orig_conv;
34012         orig_conv.inner = untag_ptr(orig);
34013         orig_conv.is_owned = ptr_is_owned(orig);
34014         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34015         orig_conv.is_owned = false;
34016         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
34017         int64_t ret_ref = 0;
34018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34020         return ret_ref;
34021 }
34022
34023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34024         LDKClosingSignedFeeRange this_obj_conv;
34025         this_obj_conv.inner = untag_ptr(this_obj);
34026         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34028         ClosingSignedFeeRange_free(this_obj_conv);
34029 }
34030
34031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
34032         LDKClosingSignedFeeRange this_ptr_conv;
34033         this_ptr_conv.inner = untag_ptr(this_ptr);
34034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34036         this_ptr_conv.is_owned = false;
34037         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
34038         return ret_conv;
34039 }
34040
34041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34042         LDKClosingSignedFeeRange this_ptr_conv;
34043         this_ptr_conv.inner = untag_ptr(this_ptr);
34044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34046         this_ptr_conv.is_owned = false;
34047         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
34048 }
34049
34050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
34051         LDKClosingSignedFeeRange this_ptr_conv;
34052         this_ptr_conv.inner = untag_ptr(this_ptr);
34053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34055         this_ptr_conv.is_owned = false;
34056         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
34057         return ret_conv;
34058 }
34059
34060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34061         LDKClosingSignedFeeRange this_ptr_conv;
34062         this_ptr_conv.inner = untag_ptr(this_ptr);
34063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34065         this_ptr_conv.is_owned = false;
34066         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
34067 }
34068
34069 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) {
34070         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
34071         int64_t ret_ref = 0;
34072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34074         return ret_ref;
34075 }
34076
34077 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
34078         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
34079         int64_t ret_ref = 0;
34080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34082         return ret_ref;
34083 }
34084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34085         LDKClosingSignedFeeRange arg_conv;
34086         arg_conv.inner = untag_ptr(arg);
34087         arg_conv.is_owned = ptr_is_owned(arg);
34088         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34089         arg_conv.is_owned = false;
34090         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
34091         return ret_conv;
34092 }
34093
34094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34095         LDKClosingSignedFeeRange orig_conv;
34096         orig_conv.inner = untag_ptr(orig);
34097         orig_conv.is_owned = ptr_is_owned(orig);
34098         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34099         orig_conv.is_owned = false;
34100         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
34101         int64_t ret_ref = 0;
34102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34104         return ret_ref;
34105 }
34106
34107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34108         LDKClosingSigned this_obj_conv;
34109         this_obj_conv.inner = untag_ptr(this_obj);
34110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34112         ClosingSigned_free(this_obj_conv);
34113 }
34114
34115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34116         LDKClosingSigned this_ptr_conv;
34117         this_ptr_conv.inner = untag_ptr(this_ptr);
34118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34120         this_ptr_conv.is_owned = false;
34121         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34122         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
34123         return ret_arr;
34124 }
34125
34126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34127         LDKClosingSigned this_ptr_conv;
34128         this_ptr_conv.inner = untag_ptr(this_ptr);
34129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34131         this_ptr_conv.is_owned = false;
34132         LDKThirtyTwoBytes val_ref;
34133         CHECK((*env)->GetArrayLength(env, val) == 32);
34134         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34135         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
34136 }
34137
34138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
34139         LDKClosingSigned this_ptr_conv;
34140         this_ptr_conv.inner = untag_ptr(this_ptr);
34141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34143         this_ptr_conv.is_owned = false;
34144         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
34145         return ret_conv;
34146 }
34147
34148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34149         LDKClosingSigned this_ptr_conv;
34150         this_ptr_conv.inner = untag_ptr(this_ptr);
34151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34153         this_ptr_conv.is_owned = false;
34154         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
34155 }
34156
34157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34158         LDKClosingSigned this_ptr_conv;
34159         this_ptr_conv.inner = untag_ptr(this_ptr);
34160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34162         this_ptr_conv.is_owned = false;
34163         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34164         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
34165         return ret_arr;
34166 }
34167
34168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34169         LDKClosingSigned this_ptr_conv;
34170         this_ptr_conv.inner = untag_ptr(this_ptr);
34171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34173         this_ptr_conv.is_owned = false;
34174         LDKSignature val_ref;
34175         CHECK((*env)->GetArrayLength(env, val) == 64);
34176         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34177         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
34178 }
34179
34180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
34181         LDKClosingSigned this_ptr_conv;
34182         this_ptr_conv.inner = untag_ptr(this_ptr);
34183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34185         this_ptr_conv.is_owned = false;
34186         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
34187         int64_t ret_ref = 0;
34188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34190         return ret_ref;
34191 }
34192
34193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34194         LDKClosingSigned this_ptr_conv;
34195         this_ptr_conv.inner = untag_ptr(this_ptr);
34196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34198         this_ptr_conv.is_owned = false;
34199         LDKClosingSignedFeeRange val_conv;
34200         val_conv.inner = untag_ptr(val);
34201         val_conv.is_owned = ptr_is_owned(val);
34202         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34203         val_conv = ClosingSignedFeeRange_clone(&val_conv);
34204         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
34205 }
34206
34207 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) {
34208         LDKThirtyTwoBytes channel_id_arg_ref;
34209         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34210         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34211         LDKSignature signature_arg_ref;
34212         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34213         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34214         LDKClosingSignedFeeRange fee_range_arg_conv;
34215         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
34216         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
34217         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
34218         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
34219         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
34220         int64_t ret_ref = 0;
34221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34223         return ret_ref;
34224 }
34225
34226 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
34227         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
34228         int64_t ret_ref = 0;
34229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34231         return ret_ref;
34232 }
34233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34234         LDKClosingSigned arg_conv;
34235         arg_conv.inner = untag_ptr(arg);
34236         arg_conv.is_owned = ptr_is_owned(arg);
34237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34238         arg_conv.is_owned = false;
34239         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
34240         return ret_conv;
34241 }
34242
34243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34244         LDKClosingSigned orig_conv;
34245         orig_conv.inner = untag_ptr(orig);
34246         orig_conv.is_owned = ptr_is_owned(orig);
34247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34248         orig_conv.is_owned = false;
34249         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
34250         int64_t ret_ref = 0;
34251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34253         return ret_ref;
34254 }
34255
34256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34257         LDKUpdateAddHTLC this_obj_conv;
34258         this_obj_conv.inner = untag_ptr(this_obj);
34259         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34261         UpdateAddHTLC_free(this_obj_conv);
34262 }
34263
34264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34265         LDKUpdateAddHTLC this_ptr_conv;
34266         this_ptr_conv.inner = untag_ptr(this_ptr);
34267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34269         this_ptr_conv.is_owned = false;
34270         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34271         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
34272         return ret_arr;
34273 }
34274
34275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34276         LDKUpdateAddHTLC this_ptr_conv;
34277         this_ptr_conv.inner = untag_ptr(this_ptr);
34278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34280         this_ptr_conv.is_owned = false;
34281         LDKThirtyTwoBytes val_ref;
34282         CHECK((*env)->GetArrayLength(env, val) == 32);
34283         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34284         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
34285 }
34286
34287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34288         LDKUpdateAddHTLC this_ptr_conv;
34289         this_ptr_conv.inner = untag_ptr(this_ptr);
34290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34292         this_ptr_conv.is_owned = false;
34293         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
34294         return ret_conv;
34295 }
34296
34297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34298         LDKUpdateAddHTLC this_ptr_conv;
34299         this_ptr_conv.inner = untag_ptr(this_ptr);
34300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34302         this_ptr_conv.is_owned = false;
34303         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
34304 }
34305
34306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34307         LDKUpdateAddHTLC this_ptr_conv;
34308         this_ptr_conv.inner = untag_ptr(this_ptr);
34309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34311         this_ptr_conv.is_owned = false;
34312         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
34313         return ret_conv;
34314 }
34315
34316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34317         LDKUpdateAddHTLC this_ptr_conv;
34318         this_ptr_conv.inner = untag_ptr(this_ptr);
34319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34321         this_ptr_conv.is_owned = false;
34322         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
34323 }
34324
34325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34326         LDKUpdateAddHTLC this_ptr_conv;
34327         this_ptr_conv.inner = untag_ptr(this_ptr);
34328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34330         this_ptr_conv.is_owned = false;
34331         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
34333         return ret_arr;
34334 }
34335
34336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34337         LDKUpdateAddHTLC this_ptr_conv;
34338         this_ptr_conv.inner = untag_ptr(this_ptr);
34339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34341         this_ptr_conv.is_owned = false;
34342         LDKThirtyTwoBytes val_ref;
34343         CHECK((*env)->GetArrayLength(env, val) == 32);
34344         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34345         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
34346 }
34347
34348 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
34349         LDKUpdateAddHTLC this_ptr_conv;
34350         this_ptr_conv.inner = untag_ptr(this_ptr);
34351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34353         this_ptr_conv.is_owned = false;
34354         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
34355         return ret_conv;
34356 }
34357
34358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34359         LDKUpdateAddHTLC this_ptr_conv;
34360         this_ptr_conv.inner = untag_ptr(this_ptr);
34361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34363         this_ptr_conv.is_owned = false;
34364         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
34365 }
34366
34367 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
34368         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
34369         int64_t ret_ref = 0;
34370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34372         return ret_ref;
34373 }
34374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34375         LDKUpdateAddHTLC arg_conv;
34376         arg_conv.inner = untag_ptr(arg);
34377         arg_conv.is_owned = ptr_is_owned(arg);
34378         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34379         arg_conv.is_owned = false;
34380         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
34381         return ret_conv;
34382 }
34383
34384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34385         LDKUpdateAddHTLC orig_conv;
34386         orig_conv.inner = untag_ptr(orig);
34387         orig_conv.is_owned = ptr_is_owned(orig);
34388         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34389         orig_conv.is_owned = false;
34390         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
34391         int64_t ret_ref = 0;
34392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34394         return ret_ref;
34395 }
34396
34397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34398         LDKOnionMessage this_obj_conv;
34399         this_obj_conv.inner = untag_ptr(this_obj);
34400         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34402         OnionMessage_free(this_obj_conv);
34403 }
34404
34405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34406         LDKOnionMessage this_ptr_conv;
34407         this_ptr_conv.inner = untag_ptr(this_ptr);
34408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34410         this_ptr_conv.is_owned = false;
34411         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34412         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
34413         return ret_arr;
34414 }
34415
34416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34417         LDKOnionMessage this_ptr_conv;
34418         this_ptr_conv.inner = untag_ptr(this_ptr);
34419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34421         this_ptr_conv.is_owned = false;
34422         LDKPublicKey val_ref;
34423         CHECK((*env)->GetArrayLength(env, val) == 33);
34424         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34425         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
34426 }
34427
34428 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
34429         LDKOnionMessage ret_var = OnionMessage_clone(arg);
34430         int64_t ret_ref = 0;
34431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34433         return ret_ref;
34434 }
34435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34436         LDKOnionMessage arg_conv;
34437         arg_conv.inner = untag_ptr(arg);
34438         arg_conv.is_owned = ptr_is_owned(arg);
34439         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34440         arg_conv.is_owned = false;
34441         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
34442         return ret_conv;
34443 }
34444
34445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34446         LDKOnionMessage orig_conv;
34447         orig_conv.inner = untag_ptr(orig);
34448         orig_conv.is_owned = ptr_is_owned(orig);
34449         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34450         orig_conv.is_owned = false;
34451         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
34452         int64_t ret_ref = 0;
34453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34455         return ret_ref;
34456 }
34457
34458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34459         LDKUpdateFulfillHTLC this_obj_conv;
34460         this_obj_conv.inner = untag_ptr(this_obj);
34461         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34463         UpdateFulfillHTLC_free(this_obj_conv);
34464 }
34465
34466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34467         LDKUpdateFulfillHTLC this_ptr_conv;
34468         this_ptr_conv.inner = untag_ptr(this_ptr);
34469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34471         this_ptr_conv.is_owned = false;
34472         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34473         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
34474         return ret_arr;
34475 }
34476
34477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34478         LDKUpdateFulfillHTLC this_ptr_conv;
34479         this_ptr_conv.inner = untag_ptr(this_ptr);
34480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34482         this_ptr_conv.is_owned = false;
34483         LDKThirtyTwoBytes val_ref;
34484         CHECK((*env)->GetArrayLength(env, val) == 32);
34485         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34486         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
34487 }
34488
34489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34490         LDKUpdateFulfillHTLC this_ptr_conv;
34491         this_ptr_conv.inner = untag_ptr(this_ptr);
34492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34494         this_ptr_conv.is_owned = false;
34495         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
34496         return ret_conv;
34497 }
34498
34499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34500         LDKUpdateFulfillHTLC this_ptr_conv;
34501         this_ptr_conv.inner = untag_ptr(this_ptr);
34502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34504         this_ptr_conv.is_owned = false;
34505         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
34506 }
34507
34508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
34509         LDKUpdateFulfillHTLC this_ptr_conv;
34510         this_ptr_conv.inner = untag_ptr(this_ptr);
34511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34513         this_ptr_conv.is_owned = false;
34514         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34515         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
34516         return ret_arr;
34517 }
34518
34519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34520         LDKUpdateFulfillHTLC this_ptr_conv;
34521         this_ptr_conv.inner = untag_ptr(this_ptr);
34522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34524         this_ptr_conv.is_owned = false;
34525         LDKThirtyTwoBytes val_ref;
34526         CHECK((*env)->GetArrayLength(env, val) == 32);
34527         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34528         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
34529 }
34530
34531 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) {
34532         LDKThirtyTwoBytes channel_id_arg_ref;
34533         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34534         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34535         LDKThirtyTwoBytes payment_preimage_arg_ref;
34536         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
34537         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
34538         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
34539         int64_t ret_ref = 0;
34540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34542         return ret_ref;
34543 }
34544
34545 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
34546         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
34547         int64_t ret_ref = 0;
34548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34550         return ret_ref;
34551 }
34552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34553         LDKUpdateFulfillHTLC arg_conv;
34554         arg_conv.inner = untag_ptr(arg);
34555         arg_conv.is_owned = ptr_is_owned(arg);
34556         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34557         arg_conv.is_owned = false;
34558         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
34559         return ret_conv;
34560 }
34561
34562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34563         LDKUpdateFulfillHTLC orig_conv;
34564         orig_conv.inner = untag_ptr(orig);
34565         orig_conv.is_owned = ptr_is_owned(orig);
34566         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34567         orig_conv.is_owned = false;
34568         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
34569         int64_t ret_ref = 0;
34570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34572         return ret_ref;
34573 }
34574
34575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34576         LDKUpdateFailHTLC this_obj_conv;
34577         this_obj_conv.inner = untag_ptr(this_obj);
34578         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34580         UpdateFailHTLC_free(this_obj_conv);
34581 }
34582
34583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34584         LDKUpdateFailHTLC this_ptr_conv;
34585         this_ptr_conv.inner = untag_ptr(this_ptr);
34586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34588         this_ptr_conv.is_owned = false;
34589         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34590         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
34591         return ret_arr;
34592 }
34593
34594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34595         LDKUpdateFailHTLC this_ptr_conv;
34596         this_ptr_conv.inner = untag_ptr(this_ptr);
34597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34599         this_ptr_conv.is_owned = false;
34600         LDKThirtyTwoBytes val_ref;
34601         CHECK((*env)->GetArrayLength(env, val) == 32);
34602         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34603         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
34604 }
34605
34606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34607         LDKUpdateFailHTLC this_ptr_conv;
34608         this_ptr_conv.inner = untag_ptr(this_ptr);
34609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34611         this_ptr_conv.is_owned = false;
34612         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
34613         return ret_conv;
34614 }
34615
34616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34617         LDKUpdateFailHTLC this_ptr_conv;
34618         this_ptr_conv.inner = untag_ptr(this_ptr);
34619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34621         this_ptr_conv.is_owned = false;
34622         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
34623 }
34624
34625 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
34626         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
34627         int64_t ret_ref = 0;
34628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34630         return ret_ref;
34631 }
34632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34633         LDKUpdateFailHTLC arg_conv;
34634         arg_conv.inner = untag_ptr(arg);
34635         arg_conv.is_owned = ptr_is_owned(arg);
34636         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34637         arg_conv.is_owned = false;
34638         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
34639         return ret_conv;
34640 }
34641
34642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34643         LDKUpdateFailHTLC orig_conv;
34644         orig_conv.inner = untag_ptr(orig);
34645         orig_conv.is_owned = ptr_is_owned(orig);
34646         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34647         orig_conv.is_owned = false;
34648         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
34649         int64_t ret_ref = 0;
34650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34652         return ret_ref;
34653 }
34654
34655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34656         LDKUpdateFailMalformedHTLC this_obj_conv;
34657         this_obj_conv.inner = untag_ptr(this_obj);
34658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34660         UpdateFailMalformedHTLC_free(this_obj_conv);
34661 }
34662
34663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34664         LDKUpdateFailMalformedHTLC this_ptr_conv;
34665         this_ptr_conv.inner = untag_ptr(this_ptr);
34666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34668         this_ptr_conv.is_owned = false;
34669         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34670         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
34671         return ret_arr;
34672 }
34673
34674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34675         LDKUpdateFailMalformedHTLC this_ptr_conv;
34676         this_ptr_conv.inner = untag_ptr(this_ptr);
34677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34679         this_ptr_conv.is_owned = false;
34680         LDKThirtyTwoBytes val_ref;
34681         CHECK((*env)->GetArrayLength(env, val) == 32);
34682         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34683         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
34684 }
34685
34686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34687         LDKUpdateFailMalformedHTLC this_ptr_conv;
34688         this_ptr_conv.inner = untag_ptr(this_ptr);
34689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34691         this_ptr_conv.is_owned = false;
34692         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
34693         return ret_conv;
34694 }
34695
34696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34697         LDKUpdateFailMalformedHTLC this_ptr_conv;
34698         this_ptr_conv.inner = untag_ptr(this_ptr);
34699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34701         this_ptr_conv.is_owned = false;
34702         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
34703 }
34704
34705 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
34706         LDKUpdateFailMalformedHTLC this_ptr_conv;
34707         this_ptr_conv.inner = untag_ptr(this_ptr);
34708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34710         this_ptr_conv.is_owned = false;
34711         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
34712         return ret_conv;
34713 }
34714
34715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34716         LDKUpdateFailMalformedHTLC this_ptr_conv;
34717         this_ptr_conv.inner = untag_ptr(this_ptr);
34718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34720         this_ptr_conv.is_owned = false;
34721         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
34722 }
34723
34724 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
34725         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
34726         int64_t ret_ref = 0;
34727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34729         return ret_ref;
34730 }
34731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34732         LDKUpdateFailMalformedHTLC arg_conv;
34733         arg_conv.inner = untag_ptr(arg);
34734         arg_conv.is_owned = ptr_is_owned(arg);
34735         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34736         arg_conv.is_owned = false;
34737         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
34738         return ret_conv;
34739 }
34740
34741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34742         LDKUpdateFailMalformedHTLC orig_conv;
34743         orig_conv.inner = untag_ptr(orig);
34744         orig_conv.is_owned = ptr_is_owned(orig);
34745         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34746         orig_conv.is_owned = false;
34747         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
34748         int64_t ret_ref = 0;
34749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34751         return ret_ref;
34752 }
34753
34754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34755         LDKCommitmentSigned this_obj_conv;
34756         this_obj_conv.inner = untag_ptr(this_obj);
34757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34759         CommitmentSigned_free(this_obj_conv);
34760 }
34761
34762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34763         LDKCommitmentSigned this_ptr_conv;
34764         this_ptr_conv.inner = untag_ptr(this_ptr);
34765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34767         this_ptr_conv.is_owned = false;
34768         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34769         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
34770         return ret_arr;
34771 }
34772
34773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34774         LDKCommitmentSigned this_ptr_conv;
34775         this_ptr_conv.inner = untag_ptr(this_ptr);
34776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34778         this_ptr_conv.is_owned = false;
34779         LDKThirtyTwoBytes val_ref;
34780         CHECK((*env)->GetArrayLength(env, val) == 32);
34781         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34782         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
34783 }
34784
34785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34786         LDKCommitmentSigned this_ptr_conv;
34787         this_ptr_conv.inner = untag_ptr(this_ptr);
34788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34790         this_ptr_conv.is_owned = false;
34791         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34792         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
34793         return ret_arr;
34794 }
34795
34796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34797         LDKCommitmentSigned this_ptr_conv;
34798         this_ptr_conv.inner = untag_ptr(this_ptr);
34799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34801         this_ptr_conv.is_owned = false;
34802         LDKSignature val_ref;
34803         CHECK((*env)->GetArrayLength(env, val) == 64);
34804         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34805         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
34806 }
34807
34808 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
34809         LDKCommitmentSigned this_ptr_conv;
34810         this_ptr_conv.inner = untag_ptr(this_ptr);
34811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34813         this_ptr_conv.is_owned = false;
34814         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
34815         jobjectArray ret_arr = NULL;
34816         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
34817         ;
34818         for (size_t i = 0; i < ret_var.datalen; i++) {
34819                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
34820                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
34821                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
34822         }
34823         
34824         FREE(ret_var.data);
34825         return ret_arr;
34826 }
34827
34828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
34829         LDKCommitmentSigned this_ptr_conv;
34830         this_ptr_conv.inner = untag_ptr(this_ptr);
34831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34833         this_ptr_conv.is_owned = false;
34834         LDKCVec_SignatureZ val_constr;
34835         val_constr.datalen = (*env)->GetArrayLength(env, val);
34836         if (val_constr.datalen > 0)
34837                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34838         else
34839                 val_constr.data = NULL;
34840         for (size_t i = 0; i < val_constr.datalen; i++) {
34841                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
34842                 LDKSignature val_conv_8_ref;
34843                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
34844                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
34845                 val_constr.data[i] = val_conv_8_ref;
34846         }
34847         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
34848 }
34849
34850 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) {
34851         LDKThirtyTwoBytes channel_id_arg_ref;
34852         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34853         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34854         LDKSignature signature_arg_ref;
34855         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34856         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34857         LDKCVec_SignatureZ htlc_signatures_arg_constr;
34858         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
34859         if (htlc_signatures_arg_constr.datalen > 0)
34860                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
34861         else
34862                 htlc_signatures_arg_constr.data = NULL;
34863         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
34864                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
34865                 LDKSignature htlc_signatures_arg_conv_8_ref;
34866                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
34867                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
34868                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
34869         }
34870         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
34871         int64_t ret_ref = 0;
34872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34874         return ret_ref;
34875 }
34876
34877 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
34878         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
34879         int64_t ret_ref = 0;
34880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34882         return ret_ref;
34883 }
34884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34885         LDKCommitmentSigned arg_conv;
34886         arg_conv.inner = untag_ptr(arg);
34887         arg_conv.is_owned = ptr_is_owned(arg);
34888         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34889         arg_conv.is_owned = false;
34890         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
34891         return ret_conv;
34892 }
34893
34894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34895         LDKCommitmentSigned orig_conv;
34896         orig_conv.inner = untag_ptr(orig);
34897         orig_conv.is_owned = ptr_is_owned(orig);
34898         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34899         orig_conv.is_owned = false;
34900         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
34901         int64_t ret_ref = 0;
34902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34904         return ret_ref;
34905 }
34906
34907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34908         LDKRevokeAndACK this_obj_conv;
34909         this_obj_conv.inner = untag_ptr(this_obj);
34910         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34912         RevokeAndACK_free(this_obj_conv);
34913 }
34914
34915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34916         LDKRevokeAndACK this_ptr_conv;
34917         this_ptr_conv.inner = untag_ptr(this_ptr);
34918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34920         this_ptr_conv.is_owned = false;
34921         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34922         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
34923         return ret_arr;
34924 }
34925
34926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34927         LDKRevokeAndACK this_ptr_conv;
34928         this_ptr_conv.inner = untag_ptr(this_ptr);
34929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34931         this_ptr_conv.is_owned = false;
34932         LDKThirtyTwoBytes val_ref;
34933         CHECK((*env)->GetArrayLength(env, val) == 32);
34934         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34935         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
34936 }
34937
34938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
34939         LDKRevokeAndACK this_ptr_conv;
34940         this_ptr_conv.inner = untag_ptr(this_ptr);
34941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34943         this_ptr_conv.is_owned = false;
34944         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34945         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
34946         return ret_arr;
34947 }
34948
34949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34950         LDKRevokeAndACK this_ptr_conv;
34951         this_ptr_conv.inner = untag_ptr(this_ptr);
34952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34954         this_ptr_conv.is_owned = false;
34955         LDKThirtyTwoBytes val_ref;
34956         CHECK((*env)->GetArrayLength(env, val) == 32);
34957         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34958         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
34959 }
34960
34961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34962         LDKRevokeAndACK this_ptr_conv;
34963         this_ptr_conv.inner = untag_ptr(this_ptr);
34964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34966         this_ptr_conv.is_owned = false;
34967         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34968         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
34969         return ret_arr;
34970 }
34971
34972 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) {
34973         LDKRevokeAndACK this_ptr_conv;
34974         this_ptr_conv.inner = untag_ptr(this_ptr);
34975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34977         this_ptr_conv.is_owned = false;
34978         LDKPublicKey val_ref;
34979         CHECK((*env)->GetArrayLength(env, val) == 33);
34980         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34981         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
34982 }
34983
34984 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) {
34985         LDKThirtyTwoBytes channel_id_arg_ref;
34986         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
34987         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
34988         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
34989         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
34990         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
34991         LDKPublicKey next_per_commitment_point_arg_ref;
34992         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
34993         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
34994         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
34995         int64_t ret_ref = 0;
34996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34998         return ret_ref;
34999 }
35000
35001 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
35002         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
35003         int64_t ret_ref = 0;
35004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35006         return ret_ref;
35007 }
35008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35009         LDKRevokeAndACK arg_conv;
35010         arg_conv.inner = untag_ptr(arg);
35011         arg_conv.is_owned = ptr_is_owned(arg);
35012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35013         arg_conv.is_owned = false;
35014         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
35015         return ret_conv;
35016 }
35017
35018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35019         LDKRevokeAndACK orig_conv;
35020         orig_conv.inner = untag_ptr(orig);
35021         orig_conv.is_owned = ptr_is_owned(orig);
35022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35023         orig_conv.is_owned = false;
35024         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
35025         int64_t ret_ref = 0;
35026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35028         return ret_ref;
35029 }
35030
35031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35032         LDKUpdateFee this_obj_conv;
35033         this_obj_conv.inner = untag_ptr(this_obj);
35034         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35036         UpdateFee_free(this_obj_conv);
35037 }
35038
35039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35040         LDKUpdateFee 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35046         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
35047         return ret_arr;
35048 }
35049
35050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35051         LDKUpdateFee this_ptr_conv;
35052         this_ptr_conv.inner = untag_ptr(this_ptr);
35053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35055         this_ptr_conv.is_owned = false;
35056         LDKThirtyTwoBytes val_ref;
35057         CHECK((*env)->GetArrayLength(env, val) == 32);
35058         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35059         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
35060 }
35061
35062 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
35063         LDKUpdateFee this_ptr_conv;
35064         this_ptr_conv.inner = untag_ptr(this_ptr);
35065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35067         this_ptr_conv.is_owned = false;
35068         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
35069         return ret_conv;
35070 }
35071
35072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35073         LDKUpdateFee this_ptr_conv;
35074         this_ptr_conv.inner = untag_ptr(this_ptr);
35075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35077         this_ptr_conv.is_owned = false;
35078         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
35079 }
35080
35081 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) {
35082         LDKThirtyTwoBytes channel_id_arg_ref;
35083         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
35084         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
35085         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
35086         int64_t ret_ref = 0;
35087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35089         return ret_ref;
35090 }
35091
35092 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
35093         LDKUpdateFee ret_var = UpdateFee_clone(arg);
35094         int64_t ret_ref = 0;
35095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35097         return ret_ref;
35098 }
35099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35100         LDKUpdateFee arg_conv;
35101         arg_conv.inner = untag_ptr(arg);
35102         arg_conv.is_owned = ptr_is_owned(arg);
35103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35104         arg_conv.is_owned = false;
35105         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
35106         return ret_conv;
35107 }
35108
35109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35110         LDKUpdateFee orig_conv;
35111         orig_conv.inner = untag_ptr(orig);
35112         orig_conv.is_owned = ptr_is_owned(orig);
35113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35114         orig_conv.is_owned = false;
35115         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
35116         int64_t ret_ref = 0;
35117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35119         return ret_ref;
35120 }
35121
35122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35123         LDKDataLossProtect this_obj_conv;
35124         this_obj_conv.inner = untag_ptr(this_obj);
35125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35127         DataLossProtect_free(this_obj_conv);
35128 }
35129
35130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
35131         LDKDataLossProtect this_ptr_conv;
35132         this_ptr_conv.inner = untag_ptr(this_ptr);
35133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35135         this_ptr_conv.is_owned = false;
35136         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35137         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
35138         return ret_arr;
35139 }
35140
35141 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) {
35142         LDKDataLossProtect this_ptr_conv;
35143         this_ptr_conv.inner = untag_ptr(this_ptr);
35144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35146         this_ptr_conv.is_owned = false;
35147         LDKThirtyTwoBytes val_ref;
35148         CHECK((*env)->GetArrayLength(env, val) == 32);
35149         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35150         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
35151 }
35152
35153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
35154         LDKDataLossProtect this_ptr_conv;
35155         this_ptr_conv.inner = untag_ptr(this_ptr);
35156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35158         this_ptr_conv.is_owned = false;
35159         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35160         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
35161         return ret_arr;
35162 }
35163
35164 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) {
35165         LDKDataLossProtect this_ptr_conv;
35166         this_ptr_conv.inner = untag_ptr(this_ptr);
35167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35169         this_ptr_conv.is_owned = false;
35170         LDKPublicKey val_ref;
35171         CHECK((*env)->GetArrayLength(env, val) == 33);
35172         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35173         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
35174 }
35175
35176 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) {
35177         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
35178         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
35179         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
35180         LDKPublicKey my_current_per_commitment_point_arg_ref;
35181         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
35182         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
35183         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
35184         int64_t ret_ref = 0;
35185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35187         return ret_ref;
35188 }
35189
35190 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
35191         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
35192         int64_t ret_ref = 0;
35193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35195         return ret_ref;
35196 }
35197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35198         LDKDataLossProtect arg_conv;
35199         arg_conv.inner = untag_ptr(arg);
35200         arg_conv.is_owned = ptr_is_owned(arg);
35201         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35202         arg_conv.is_owned = false;
35203         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
35204         return ret_conv;
35205 }
35206
35207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35208         LDKDataLossProtect orig_conv;
35209         orig_conv.inner = untag_ptr(orig);
35210         orig_conv.is_owned = ptr_is_owned(orig);
35211         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35212         orig_conv.is_owned = false;
35213         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
35214         int64_t ret_ref = 0;
35215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35217         return ret_ref;
35218 }
35219
35220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35221         LDKChannelReestablish this_obj_conv;
35222         this_obj_conv.inner = untag_ptr(this_obj);
35223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35225         ChannelReestablish_free(this_obj_conv);
35226 }
35227
35228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35229         LDKChannelReestablish this_ptr_conv;
35230         this_ptr_conv.inner = untag_ptr(this_ptr);
35231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35233         this_ptr_conv.is_owned = false;
35234         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35235         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
35236         return ret_arr;
35237 }
35238
35239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35240         LDKChannelReestablish this_ptr_conv;
35241         this_ptr_conv.inner = untag_ptr(this_ptr);
35242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35244         this_ptr_conv.is_owned = false;
35245         LDKThirtyTwoBytes val_ref;
35246         CHECK((*env)->GetArrayLength(env, val) == 32);
35247         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35248         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
35249 }
35250
35251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
35252         LDKChannelReestablish this_ptr_conv;
35253         this_ptr_conv.inner = untag_ptr(this_ptr);
35254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35256         this_ptr_conv.is_owned = false;
35257         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
35258         return ret_conv;
35259 }
35260
35261 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) {
35262         LDKChannelReestablish this_ptr_conv;
35263         this_ptr_conv.inner = untag_ptr(this_ptr);
35264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35266         this_ptr_conv.is_owned = false;
35267         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
35268 }
35269
35270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
35271         LDKChannelReestablish this_ptr_conv;
35272         this_ptr_conv.inner = untag_ptr(this_ptr);
35273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35275         this_ptr_conv.is_owned = false;
35276         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
35277         return ret_conv;
35278 }
35279
35280 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) {
35281         LDKChannelReestablish this_ptr_conv;
35282         this_ptr_conv.inner = untag_ptr(this_ptr);
35283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35285         this_ptr_conv.is_owned = false;
35286         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
35287 }
35288
35289 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
35290         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
35291         int64_t ret_ref = 0;
35292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35294         return ret_ref;
35295 }
35296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35297         LDKChannelReestablish arg_conv;
35298         arg_conv.inner = untag_ptr(arg);
35299         arg_conv.is_owned = ptr_is_owned(arg);
35300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35301         arg_conv.is_owned = false;
35302         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
35303         return ret_conv;
35304 }
35305
35306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35307         LDKChannelReestablish orig_conv;
35308         orig_conv.inner = untag_ptr(orig);
35309         orig_conv.is_owned = ptr_is_owned(orig);
35310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35311         orig_conv.is_owned = false;
35312         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
35313         int64_t ret_ref = 0;
35314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35316         return ret_ref;
35317 }
35318
35319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35320         LDKAnnouncementSignatures this_obj_conv;
35321         this_obj_conv.inner = untag_ptr(this_obj);
35322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35324         AnnouncementSignatures_free(this_obj_conv);
35325 }
35326
35327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35328         LDKAnnouncementSignatures this_ptr_conv;
35329         this_ptr_conv.inner = untag_ptr(this_ptr);
35330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35332         this_ptr_conv.is_owned = false;
35333         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35334         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
35335         return ret_arr;
35336 }
35337
35338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35339         LDKAnnouncementSignatures this_ptr_conv;
35340         this_ptr_conv.inner = untag_ptr(this_ptr);
35341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35343         this_ptr_conv.is_owned = false;
35344         LDKThirtyTwoBytes val_ref;
35345         CHECK((*env)->GetArrayLength(env, val) == 32);
35346         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35347         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
35348 }
35349
35350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35351         LDKAnnouncementSignatures this_ptr_conv;
35352         this_ptr_conv.inner = untag_ptr(this_ptr);
35353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35355         this_ptr_conv.is_owned = false;
35356         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
35357         return ret_conv;
35358 }
35359
35360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35361         LDKAnnouncementSignatures this_ptr_conv;
35362         this_ptr_conv.inner = untag_ptr(this_ptr);
35363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35365         this_ptr_conv.is_owned = false;
35366         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
35367 }
35368
35369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
35370         LDKAnnouncementSignatures this_ptr_conv;
35371         this_ptr_conv.inner = untag_ptr(this_ptr);
35372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35374         this_ptr_conv.is_owned = false;
35375         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35376         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
35377         return ret_arr;
35378 }
35379
35380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35381         LDKAnnouncementSignatures this_ptr_conv;
35382         this_ptr_conv.inner = untag_ptr(this_ptr);
35383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35385         this_ptr_conv.is_owned = false;
35386         LDKSignature val_ref;
35387         CHECK((*env)->GetArrayLength(env, val) == 64);
35388         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35389         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
35390 }
35391
35392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
35393         LDKAnnouncementSignatures this_ptr_conv;
35394         this_ptr_conv.inner = untag_ptr(this_ptr);
35395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35397         this_ptr_conv.is_owned = false;
35398         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35399         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
35400         return ret_arr;
35401 }
35402
35403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35404         LDKAnnouncementSignatures this_ptr_conv;
35405         this_ptr_conv.inner = untag_ptr(this_ptr);
35406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35408         this_ptr_conv.is_owned = false;
35409         LDKSignature val_ref;
35410         CHECK((*env)->GetArrayLength(env, val) == 64);
35411         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35412         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
35413 }
35414
35415 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) {
35416         LDKThirtyTwoBytes channel_id_arg_ref;
35417         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
35418         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
35419         LDKSignature node_signature_arg_ref;
35420         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
35421         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
35422         LDKSignature bitcoin_signature_arg_ref;
35423         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
35424         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
35425         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
35426         int64_t ret_ref = 0;
35427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35429         return ret_ref;
35430 }
35431
35432 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
35433         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
35434         int64_t ret_ref = 0;
35435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35437         return ret_ref;
35438 }
35439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35440         LDKAnnouncementSignatures arg_conv;
35441         arg_conv.inner = untag_ptr(arg);
35442         arg_conv.is_owned = ptr_is_owned(arg);
35443         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35444         arg_conv.is_owned = false;
35445         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
35446         return ret_conv;
35447 }
35448
35449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35450         LDKAnnouncementSignatures orig_conv;
35451         orig_conv.inner = untag_ptr(orig);
35452         orig_conv.is_owned = ptr_is_owned(orig);
35453         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35454         orig_conv.is_owned = false;
35455         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
35456         int64_t ret_ref = 0;
35457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35459         return ret_ref;
35460 }
35461
35462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35463         if (!ptr_is_owned(this_ptr)) return;
35464         void* this_ptr_ptr = untag_ptr(this_ptr);
35465         CHECK_ACCESS(this_ptr_ptr);
35466         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
35467         FREE(untag_ptr(this_ptr));
35468         NetAddress_free(this_ptr_conv);
35469 }
35470
35471 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
35472         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35473         *ret_copy = NetAddress_clone(arg);
35474         int64_t ret_ref = tag_ptr(ret_copy, true);
35475         return ret_ref;
35476 }
35477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35478         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
35479         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
35480         return ret_conv;
35481 }
35482
35483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35484         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
35485         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35486         *ret_copy = NetAddress_clone(orig_conv);
35487         int64_t ret_ref = tag_ptr(ret_copy, true);
35488         return ret_ref;
35489 }
35490
35491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
35492         LDKFourBytes addr_ref;
35493         CHECK((*env)->GetArrayLength(env, addr) == 4);
35494         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
35495         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35496         *ret_copy = NetAddress_ipv4(addr_ref, port);
35497         int64_t ret_ref = tag_ptr(ret_copy, true);
35498         return ret_ref;
35499 }
35500
35501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
35502         LDKSixteenBytes addr_ref;
35503         CHECK((*env)->GetArrayLength(env, addr) == 16);
35504         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
35505         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35506         *ret_copy = NetAddress_ipv6(addr_ref, port);
35507         int64_t ret_ref = tag_ptr(ret_copy, true);
35508         return ret_ref;
35509 }
35510
35511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
35512         LDKTwelveBytes a_ref;
35513         CHECK((*env)->GetArrayLength(env, a) == 12);
35514         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
35515         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35516         *ret_copy = NetAddress_onion_v2(a_ref);
35517         int64_t ret_ref = tag_ptr(ret_copy, true);
35518         return ret_ref;
35519 }
35520
35521 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) {
35522         LDKThirtyTwoBytes ed25519_pubkey_ref;
35523         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
35524         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
35525         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35526         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
35527         int64_t ret_ref = tag_ptr(ret_copy, true);
35528         return ret_ref;
35529 }
35530
35531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
35532         LDKHostname hostname_conv;
35533         hostname_conv.inner = untag_ptr(hostname);
35534         hostname_conv.is_owned = ptr_is_owned(hostname);
35535         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
35536         hostname_conv = Hostname_clone(&hostname_conv);
35537         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35538         *ret_copy = NetAddress_hostname(hostname_conv, port);
35539         int64_t ret_ref = tag_ptr(ret_copy, true);
35540         return ret_ref;
35541 }
35542
35543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
35544         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
35545         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
35546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35548         CVec_u8Z_free(ret_var);
35549         return ret_arr;
35550 }
35551
35552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35553         LDKu8slice ser_ref;
35554         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35555         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35556         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
35557         *ret_conv = NetAddress_read(ser_ref);
35558         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35559         return tag_ptr(ret_conv, true);
35560 }
35561
35562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35563         LDKUnsignedNodeAnnouncement this_obj_conv;
35564         this_obj_conv.inner = untag_ptr(this_obj);
35565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35567         UnsignedNodeAnnouncement_free(this_obj_conv);
35568 }
35569
35570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
35571         LDKUnsignedNodeAnnouncement this_ptr_conv;
35572         this_ptr_conv.inner = untag_ptr(this_ptr);
35573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35575         this_ptr_conv.is_owned = false;
35576         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
35577         int64_t ret_ref = 0;
35578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35580         return ret_ref;
35581 }
35582
35583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35584         LDKUnsignedNodeAnnouncement this_ptr_conv;
35585         this_ptr_conv.inner = untag_ptr(this_ptr);
35586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35588         this_ptr_conv.is_owned = false;
35589         LDKNodeFeatures val_conv;
35590         val_conv.inner = untag_ptr(val);
35591         val_conv.is_owned = ptr_is_owned(val);
35592         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35593         val_conv = NodeFeatures_clone(&val_conv);
35594         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
35595 }
35596
35597 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35598         LDKUnsignedNodeAnnouncement this_ptr_conv;
35599         this_ptr_conv.inner = untag_ptr(this_ptr);
35600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35602         this_ptr_conv.is_owned = false;
35603         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
35604         return ret_conv;
35605 }
35606
35607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35608         LDKUnsignedNodeAnnouncement this_ptr_conv;
35609         this_ptr_conv.inner = untag_ptr(this_ptr);
35610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35612         this_ptr_conv.is_owned = false;
35613         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
35614 }
35615
35616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35617         LDKUnsignedNodeAnnouncement this_ptr_conv;
35618         this_ptr_conv.inner = untag_ptr(this_ptr);
35619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35621         this_ptr_conv.is_owned = false;
35622         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35623         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
35624         return ret_arr;
35625 }
35626
35627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35628         LDKUnsignedNodeAnnouncement this_ptr_conv;
35629         this_ptr_conv.inner = untag_ptr(this_ptr);
35630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35632         this_ptr_conv.is_owned = false;
35633         LDKPublicKey val_ref;
35634         CHECK((*env)->GetArrayLength(env, val) == 33);
35635         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35636         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
35637 }
35638
35639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
35640         LDKUnsignedNodeAnnouncement this_ptr_conv;
35641         this_ptr_conv.inner = untag_ptr(this_ptr);
35642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35644         this_ptr_conv.is_owned = false;
35645         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
35646         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
35647         return ret_arr;
35648 }
35649
35650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35651         LDKUnsignedNodeAnnouncement this_ptr_conv;
35652         this_ptr_conv.inner = untag_ptr(this_ptr);
35653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35655         this_ptr_conv.is_owned = false;
35656         LDKThreeBytes val_ref;
35657         CHECK((*env)->GetArrayLength(env, val) == 3);
35658         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
35659         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
35660 }
35661
35662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
35663         LDKUnsignedNodeAnnouncement this_ptr_conv;
35664         this_ptr_conv.inner = untag_ptr(this_ptr);
35665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35667         this_ptr_conv.is_owned = false;
35668         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35669         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
35670         return ret_arr;
35671 }
35672
35673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35674         LDKUnsignedNodeAnnouncement this_ptr_conv;
35675         this_ptr_conv.inner = untag_ptr(this_ptr);
35676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35678         this_ptr_conv.is_owned = false;
35679         LDKThirtyTwoBytes val_ref;
35680         CHECK((*env)->GetArrayLength(env, val) == 32);
35681         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35682         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
35683 }
35684
35685 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
35686         LDKUnsignedNodeAnnouncement this_ptr_conv;
35687         this_ptr_conv.inner = untag_ptr(this_ptr);
35688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35690         this_ptr_conv.is_owned = false;
35691         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
35692         int64_tArray ret_arr = NULL;
35693         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35694         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35695         for (size_t m = 0; m < ret_var.datalen; m++) {
35696                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
35697                 *ret_conv_12_copy = ret_var.data[m];
35698                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
35699                 ret_arr_ptr[m] = ret_conv_12_ref;
35700         }
35701         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35702         FREE(ret_var.data);
35703         return ret_arr;
35704 }
35705
35706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35707         LDKUnsignedNodeAnnouncement this_ptr_conv;
35708         this_ptr_conv.inner = untag_ptr(this_ptr);
35709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35711         this_ptr_conv.is_owned = false;
35712         LDKCVec_NetAddressZ val_constr;
35713         val_constr.datalen = (*env)->GetArrayLength(env, val);
35714         if (val_constr.datalen > 0)
35715                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
35716         else
35717                 val_constr.data = NULL;
35718         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35719         for (size_t m = 0; m < val_constr.datalen; m++) {
35720                 int64_t val_conv_12 = val_vals[m];
35721                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
35722                 CHECK_ACCESS(val_conv_12_ptr);
35723                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
35724                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
35725                 val_constr.data[m] = val_conv_12_conv;
35726         }
35727         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35728         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
35729 }
35730
35731 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
35732         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
35733         int64_t ret_ref = 0;
35734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35736         return ret_ref;
35737 }
35738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35739         LDKUnsignedNodeAnnouncement arg_conv;
35740         arg_conv.inner = untag_ptr(arg);
35741         arg_conv.is_owned = ptr_is_owned(arg);
35742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35743         arg_conv.is_owned = false;
35744         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
35745         return ret_conv;
35746 }
35747
35748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35749         LDKUnsignedNodeAnnouncement orig_conv;
35750         orig_conv.inner = untag_ptr(orig);
35751         orig_conv.is_owned = ptr_is_owned(orig);
35752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35753         orig_conv.is_owned = false;
35754         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
35755         int64_t ret_ref = 0;
35756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35758         return ret_ref;
35759 }
35760
35761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35762         LDKNodeAnnouncement this_obj_conv;
35763         this_obj_conv.inner = untag_ptr(this_obj);
35764         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35766         NodeAnnouncement_free(this_obj_conv);
35767 }
35768
35769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
35770         LDKNodeAnnouncement this_ptr_conv;
35771         this_ptr_conv.inner = untag_ptr(this_ptr);
35772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35774         this_ptr_conv.is_owned = false;
35775         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35776         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
35777         return ret_arr;
35778 }
35779
35780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35781         LDKNodeAnnouncement this_ptr_conv;
35782         this_ptr_conv.inner = untag_ptr(this_ptr);
35783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35785         this_ptr_conv.is_owned = false;
35786         LDKSignature val_ref;
35787         CHECK((*env)->GetArrayLength(env, val) == 64);
35788         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35789         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
35790 }
35791
35792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
35793         LDKNodeAnnouncement this_ptr_conv;
35794         this_ptr_conv.inner = untag_ptr(this_ptr);
35795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35797         this_ptr_conv.is_owned = false;
35798         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
35799         int64_t ret_ref = 0;
35800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35802         return ret_ref;
35803 }
35804
35805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35806         LDKNodeAnnouncement this_ptr_conv;
35807         this_ptr_conv.inner = untag_ptr(this_ptr);
35808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35810         this_ptr_conv.is_owned = false;
35811         LDKUnsignedNodeAnnouncement val_conv;
35812         val_conv.inner = untag_ptr(val);
35813         val_conv.is_owned = ptr_is_owned(val);
35814         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35815         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
35816         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
35817 }
35818
35819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
35820         LDKSignature signature_arg_ref;
35821         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
35822         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
35823         LDKUnsignedNodeAnnouncement contents_arg_conv;
35824         contents_arg_conv.inner = untag_ptr(contents_arg);
35825         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
35826         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
35827         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
35828         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
35829         int64_t ret_ref = 0;
35830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35832         return ret_ref;
35833 }
35834
35835 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
35836         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
35837         int64_t ret_ref = 0;
35838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35840         return ret_ref;
35841 }
35842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35843         LDKNodeAnnouncement arg_conv;
35844         arg_conv.inner = untag_ptr(arg);
35845         arg_conv.is_owned = ptr_is_owned(arg);
35846         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35847         arg_conv.is_owned = false;
35848         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
35849         return ret_conv;
35850 }
35851
35852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35853         LDKNodeAnnouncement orig_conv;
35854         orig_conv.inner = untag_ptr(orig);
35855         orig_conv.is_owned = ptr_is_owned(orig);
35856         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35857         orig_conv.is_owned = false;
35858         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
35859         int64_t ret_ref = 0;
35860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35862         return ret_ref;
35863 }
35864
35865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35866         LDKUnsignedChannelAnnouncement this_obj_conv;
35867         this_obj_conv.inner = untag_ptr(this_obj);
35868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35870         UnsignedChannelAnnouncement_free(this_obj_conv);
35871 }
35872
35873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
35874         LDKUnsignedChannelAnnouncement this_ptr_conv;
35875         this_ptr_conv.inner = untag_ptr(this_ptr);
35876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35878         this_ptr_conv.is_owned = false;
35879         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
35880         int64_t ret_ref = 0;
35881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35883         return ret_ref;
35884 }
35885
35886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35887         LDKUnsignedChannelAnnouncement this_ptr_conv;
35888         this_ptr_conv.inner = untag_ptr(this_ptr);
35889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35891         this_ptr_conv.is_owned = false;
35892         LDKChannelFeatures val_conv;
35893         val_conv.inner = untag_ptr(val);
35894         val_conv.is_owned = ptr_is_owned(val);
35895         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35896         val_conv = ChannelFeatures_clone(&val_conv);
35897         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
35898 }
35899
35900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35901         LDKUnsignedChannelAnnouncement this_ptr_conv;
35902         this_ptr_conv.inner = untag_ptr(this_ptr);
35903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35905         this_ptr_conv.is_owned = false;
35906         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35907         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
35908         return ret_arr;
35909 }
35910
35911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35912         LDKUnsignedChannelAnnouncement this_ptr_conv;
35913         this_ptr_conv.inner = untag_ptr(this_ptr);
35914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35916         this_ptr_conv.is_owned = false;
35917         LDKThirtyTwoBytes val_ref;
35918         CHECK((*env)->GetArrayLength(env, val) == 32);
35919         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35920         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
35921 }
35922
35923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35924         LDKUnsignedChannelAnnouncement this_ptr_conv;
35925         this_ptr_conv.inner = untag_ptr(this_ptr);
35926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35928         this_ptr_conv.is_owned = false;
35929         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
35930         return ret_conv;
35931 }
35932
35933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35934         LDKUnsignedChannelAnnouncement this_ptr_conv;
35935         this_ptr_conv.inner = untag_ptr(this_ptr);
35936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35938         this_ptr_conv.is_owned = false;
35939         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
35940 }
35941
35942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35943         LDKUnsignedChannelAnnouncement this_ptr_conv;
35944         this_ptr_conv.inner = untag_ptr(this_ptr);
35945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35947         this_ptr_conv.is_owned = false;
35948         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35949         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
35950         return ret_arr;
35951 }
35952
35953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35954         LDKUnsignedChannelAnnouncement this_ptr_conv;
35955         this_ptr_conv.inner = untag_ptr(this_ptr);
35956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35958         this_ptr_conv.is_owned = false;
35959         LDKPublicKey val_ref;
35960         CHECK((*env)->GetArrayLength(env, val) == 33);
35961         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35962         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
35963 }
35964
35965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
35966         LDKUnsignedChannelAnnouncement this_ptr_conv;
35967         this_ptr_conv.inner = untag_ptr(this_ptr);
35968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35970         this_ptr_conv.is_owned = false;
35971         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35972         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
35973         return ret_arr;
35974 }
35975
35976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35977         LDKUnsignedChannelAnnouncement this_ptr_conv;
35978         this_ptr_conv.inner = untag_ptr(this_ptr);
35979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35981         this_ptr_conv.is_owned = false;
35982         LDKPublicKey val_ref;
35983         CHECK((*env)->GetArrayLength(env, val) == 33);
35984         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
35985         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
35986 }
35987
35988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
35989         LDKUnsignedChannelAnnouncement this_ptr_conv;
35990         this_ptr_conv.inner = untag_ptr(this_ptr);
35991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35993         this_ptr_conv.is_owned = false;
35994         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35995         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
35996         return ret_arr;
35997 }
35998
35999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36000         LDKUnsignedChannelAnnouncement this_ptr_conv;
36001         this_ptr_conv.inner = untag_ptr(this_ptr);
36002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36004         this_ptr_conv.is_owned = false;
36005         LDKPublicKey val_ref;
36006         CHECK((*env)->GetArrayLength(env, val) == 33);
36007         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36008         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
36009 }
36010
36011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
36012         LDKUnsignedChannelAnnouncement this_ptr_conv;
36013         this_ptr_conv.inner = untag_ptr(this_ptr);
36014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36016         this_ptr_conv.is_owned = false;
36017         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36018         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
36019         return ret_arr;
36020 }
36021
36022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36023         LDKUnsignedChannelAnnouncement this_ptr_conv;
36024         this_ptr_conv.inner = untag_ptr(this_ptr);
36025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36027         this_ptr_conv.is_owned = false;
36028         LDKPublicKey val_ref;
36029         CHECK((*env)->GetArrayLength(env, val) == 33);
36030         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36031         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
36032 }
36033
36034 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
36035         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
36036         int64_t ret_ref = 0;
36037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36039         return ret_ref;
36040 }
36041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36042         LDKUnsignedChannelAnnouncement arg_conv;
36043         arg_conv.inner = untag_ptr(arg);
36044         arg_conv.is_owned = ptr_is_owned(arg);
36045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36046         arg_conv.is_owned = false;
36047         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
36048         return ret_conv;
36049 }
36050
36051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36052         LDKUnsignedChannelAnnouncement orig_conv;
36053         orig_conv.inner = untag_ptr(orig);
36054         orig_conv.is_owned = ptr_is_owned(orig);
36055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36056         orig_conv.is_owned = false;
36057         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
36058         int64_t ret_ref = 0;
36059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36061         return ret_ref;
36062 }
36063
36064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36065         LDKChannelAnnouncement this_obj_conv;
36066         this_obj_conv.inner = untag_ptr(this_obj);
36067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36069         ChannelAnnouncement_free(this_obj_conv);
36070 }
36071
36072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
36073         LDKChannelAnnouncement this_ptr_conv;
36074         this_ptr_conv.inner = untag_ptr(this_ptr);
36075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36077         this_ptr_conv.is_owned = false;
36078         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36079         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
36080         return ret_arr;
36081 }
36082
36083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36084         LDKChannelAnnouncement this_ptr_conv;
36085         this_ptr_conv.inner = untag_ptr(this_ptr);
36086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36088         this_ptr_conv.is_owned = false;
36089         LDKSignature val_ref;
36090         CHECK((*env)->GetArrayLength(env, val) == 64);
36091         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36092         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
36093 }
36094
36095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
36096         LDKChannelAnnouncement this_ptr_conv;
36097         this_ptr_conv.inner = untag_ptr(this_ptr);
36098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36100         this_ptr_conv.is_owned = false;
36101         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
36103         return ret_arr;
36104 }
36105
36106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36107         LDKChannelAnnouncement this_ptr_conv;
36108         this_ptr_conv.inner = untag_ptr(this_ptr);
36109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36111         this_ptr_conv.is_owned = false;
36112         LDKSignature val_ref;
36113         CHECK((*env)->GetArrayLength(env, val) == 64);
36114         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36115         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
36116 }
36117
36118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
36119         LDKChannelAnnouncement this_ptr_conv;
36120         this_ptr_conv.inner = untag_ptr(this_ptr);
36121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36123         this_ptr_conv.is_owned = false;
36124         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36125         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
36126         return ret_arr;
36127 }
36128
36129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36130         LDKChannelAnnouncement this_ptr_conv;
36131         this_ptr_conv.inner = untag_ptr(this_ptr);
36132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36134         this_ptr_conv.is_owned = false;
36135         LDKSignature val_ref;
36136         CHECK((*env)->GetArrayLength(env, val) == 64);
36137         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36138         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
36139 }
36140
36141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
36142         LDKChannelAnnouncement this_ptr_conv;
36143         this_ptr_conv.inner = untag_ptr(this_ptr);
36144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36146         this_ptr_conv.is_owned = false;
36147         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36148         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
36149         return ret_arr;
36150 }
36151
36152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36153         LDKChannelAnnouncement this_ptr_conv;
36154         this_ptr_conv.inner = untag_ptr(this_ptr);
36155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36157         this_ptr_conv.is_owned = false;
36158         LDKSignature val_ref;
36159         CHECK((*env)->GetArrayLength(env, val) == 64);
36160         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36161         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
36162 }
36163
36164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
36165         LDKChannelAnnouncement this_ptr_conv;
36166         this_ptr_conv.inner = untag_ptr(this_ptr);
36167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36169         this_ptr_conv.is_owned = false;
36170         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
36171         int64_t ret_ref = 0;
36172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36174         return ret_ref;
36175 }
36176
36177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36178         LDKChannelAnnouncement this_ptr_conv;
36179         this_ptr_conv.inner = untag_ptr(this_ptr);
36180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36182         this_ptr_conv.is_owned = false;
36183         LDKUnsignedChannelAnnouncement val_conv;
36184         val_conv.inner = untag_ptr(val);
36185         val_conv.is_owned = ptr_is_owned(val);
36186         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36187         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
36188         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
36189 }
36190
36191 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) {
36192         LDKSignature node_signature_1_arg_ref;
36193         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
36194         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
36195         LDKSignature node_signature_2_arg_ref;
36196         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
36197         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
36198         LDKSignature bitcoin_signature_1_arg_ref;
36199         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
36200         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
36201         LDKSignature bitcoin_signature_2_arg_ref;
36202         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
36203         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
36204         LDKUnsignedChannelAnnouncement contents_arg_conv;
36205         contents_arg_conv.inner = untag_ptr(contents_arg);
36206         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
36207         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
36208         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
36209         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);
36210         int64_t ret_ref = 0;
36211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36213         return ret_ref;
36214 }
36215
36216 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
36217         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
36218         int64_t ret_ref = 0;
36219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36221         return ret_ref;
36222 }
36223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36224         LDKChannelAnnouncement arg_conv;
36225         arg_conv.inner = untag_ptr(arg);
36226         arg_conv.is_owned = ptr_is_owned(arg);
36227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36228         arg_conv.is_owned = false;
36229         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
36230         return ret_conv;
36231 }
36232
36233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36234         LDKChannelAnnouncement orig_conv;
36235         orig_conv.inner = untag_ptr(orig);
36236         orig_conv.is_owned = ptr_is_owned(orig);
36237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36238         orig_conv.is_owned = false;
36239         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
36240         int64_t ret_ref = 0;
36241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36243         return ret_ref;
36244 }
36245
36246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36247         LDKUnsignedChannelUpdate this_obj_conv;
36248         this_obj_conv.inner = untag_ptr(this_obj);
36249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36251         UnsignedChannelUpdate_free(this_obj_conv);
36252 }
36253
36254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36255         LDKUnsignedChannelUpdate this_ptr_conv;
36256         this_ptr_conv.inner = untag_ptr(this_ptr);
36257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36259         this_ptr_conv.is_owned = false;
36260         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36261         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
36262         return ret_arr;
36263 }
36264
36265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36266         LDKUnsignedChannelUpdate this_ptr_conv;
36267         this_ptr_conv.inner = untag_ptr(this_ptr);
36268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36270         this_ptr_conv.is_owned = false;
36271         LDKThirtyTwoBytes val_ref;
36272         CHECK((*env)->GetArrayLength(env, val) == 32);
36273         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36274         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
36275 }
36276
36277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36278         LDKUnsignedChannelUpdate this_ptr_conv;
36279         this_ptr_conv.inner = untag_ptr(this_ptr);
36280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36282         this_ptr_conv.is_owned = false;
36283         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
36284         return ret_conv;
36285 }
36286
36287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36288         LDKUnsignedChannelUpdate this_ptr_conv;
36289         this_ptr_conv.inner = untag_ptr(this_ptr);
36290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36292         this_ptr_conv.is_owned = false;
36293         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
36294 }
36295
36296 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
36297         LDKUnsignedChannelUpdate this_ptr_conv;
36298         this_ptr_conv.inner = untag_ptr(this_ptr);
36299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36301         this_ptr_conv.is_owned = false;
36302         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
36303         return ret_conv;
36304 }
36305
36306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36307         LDKUnsignedChannelUpdate this_ptr_conv;
36308         this_ptr_conv.inner = untag_ptr(this_ptr);
36309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36311         this_ptr_conv.is_owned = false;
36312         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
36313 }
36314
36315 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
36316         LDKUnsignedChannelUpdate this_ptr_conv;
36317         this_ptr_conv.inner = untag_ptr(this_ptr);
36318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36320         this_ptr_conv.is_owned = false;
36321         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
36322         return ret_conv;
36323 }
36324
36325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
36326         LDKUnsignedChannelUpdate this_ptr_conv;
36327         this_ptr_conv.inner = untag_ptr(this_ptr);
36328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36330         this_ptr_conv.is_owned = false;
36331         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
36332 }
36333
36334 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36335         LDKUnsignedChannelUpdate this_ptr_conv;
36336         this_ptr_conv.inner = untag_ptr(this_ptr);
36337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36339         this_ptr_conv.is_owned = false;
36340         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
36341         return ret_conv;
36342 }
36343
36344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36345         LDKUnsignedChannelUpdate this_ptr_conv;
36346         this_ptr_conv.inner = untag_ptr(this_ptr);
36347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36349         this_ptr_conv.is_owned = false;
36350         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
36351 }
36352
36353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36354         LDKUnsignedChannelUpdate this_ptr_conv;
36355         this_ptr_conv.inner = untag_ptr(this_ptr);
36356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36358         this_ptr_conv.is_owned = false;
36359         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
36360         return ret_conv;
36361 }
36362
36363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36364         LDKUnsignedChannelUpdate this_ptr_conv;
36365         this_ptr_conv.inner = untag_ptr(this_ptr);
36366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36368         this_ptr_conv.is_owned = false;
36369         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
36370 }
36371
36372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36373         LDKUnsignedChannelUpdate this_ptr_conv;
36374         this_ptr_conv.inner = untag_ptr(this_ptr);
36375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36377         this_ptr_conv.is_owned = false;
36378         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
36379         return ret_conv;
36380 }
36381
36382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36383         LDKUnsignedChannelUpdate this_ptr_conv;
36384         this_ptr_conv.inner = untag_ptr(this_ptr);
36385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36387         this_ptr_conv.is_owned = false;
36388         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
36389 }
36390
36391 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36392         LDKUnsignedChannelUpdate this_ptr_conv;
36393         this_ptr_conv.inner = untag_ptr(this_ptr);
36394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36396         this_ptr_conv.is_owned = false;
36397         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
36398         return ret_conv;
36399 }
36400
36401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36402         LDKUnsignedChannelUpdate this_ptr_conv;
36403         this_ptr_conv.inner = untag_ptr(this_ptr);
36404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36406         this_ptr_conv.is_owned = false;
36407         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
36408 }
36409
36410 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36411         LDKUnsignedChannelUpdate this_ptr_conv;
36412         this_ptr_conv.inner = untag_ptr(this_ptr);
36413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36415         this_ptr_conv.is_owned = false;
36416         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
36417         return ret_conv;
36418 }
36419
36420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36421         LDKUnsignedChannelUpdate this_ptr_conv;
36422         this_ptr_conv.inner = untag_ptr(this_ptr);
36423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36425         this_ptr_conv.is_owned = false;
36426         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
36427 }
36428
36429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
36430         LDKUnsignedChannelUpdate this_ptr_conv;
36431         this_ptr_conv.inner = untag_ptr(this_ptr);
36432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36434         this_ptr_conv.is_owned = false;
36435         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
36436         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36437         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36438         CVec_u8Z_free(ret_var);
36439         return ret_arr;
36440 }
36441
36442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36443         LDKUnsignedChannelUpdate this_ptr_conv;
36444         this_ptr_conv.inner = untag_ptr(this_ptr);
36445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36447         this_ptr_conv.is_owned = false;
36448         LDKCVec_u8Z val_ref;
36449         val_ref.datalen = (*env)->GetArrayLength(env, val);
36450         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36451         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
36452         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
36453 }
36454
36455 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) {
36456         LDKThirtyTwoBytes chain_hash_arg_ref;
36457         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36458         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36459         LDKCVec_u8Z excess_data_arg_ref;
36460         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
36461         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36462         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
36463         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);
36464         int64_t ret_ref = 0;
36465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36467         return ret_ref;
36468 }
36469
36470 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
36471         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
36472         int64_t ret_ref = 0;
36473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36475         return ret_ref;
36476 }
36477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36478         LDKUnsignedChannelUpdate arg_conv;
36479         arg_conv.inner = untag_ptr(arg);
36480         arg_conv.is_owned = ptr_is_owned(arg);
36481         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36482         arg_conv.is_owned = false;
36483         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
36484         return ret_conv;
36485 }
36486
36487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36488         LDKUnsignedChannelUpdate orig_conv;
36489         orig_conv.inner = untag_ptr(orig);
36490         orig_conv.is_owned = ptr_is_owned(orig);
36491         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36492         orig_conv.is_owned = false;
36493         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
36494         int64_t ret_ref = 0;
36495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36497         return ret_ref;
36498 }
36499
36500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36501         LDKChannelUpdate this_obj_conv;
36502         this_obj_conv.inner = untag_ptr(this_obj);
36503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36505         ChannelUpdate_free(this_obj_conv);
36506 }
36507
36508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
36509         LDKChannelUpdate this_ptr_conv;
36510         this_ptr_conv.inner = untag_ptr(this_ptr);
36511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36513         this_ptr_conv.is_owned = false;
36514         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
36515         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
36516         return ret_arr;
36517 }
36518
36519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36520         LDKChannelUpdate this_ptr_conv;
36521         this_ptr_conv.inner = untag_ptr(this_ptr);
36522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36524         this_ptr_conv.is_owned = false;
36525         LDKSignature val_ref;
36526         CHECK((*env)->GetArrayLength(env, val) == 64);
36527         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
36528         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
36529 }
36530
36531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
36532         LDKChannelUpdate this_ptr_conv;
36533         this_ptr_conv.inner = untag_ptr(this_ptr);
36534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36536         this_ptr_conv.is_owned = false;
36537         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
36538         int64_t ret_ref = 0;
36539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36541         return ret_ref;
36542 }
36543
36544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36545         LDKChannelUpdate this_ptr_conv;
36546         this_ptr_conv.inner = untag_ptr(this_ptr);
36547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36549         this_ptr_conv.is_owned = false;
36550         LDKUnsignedChannelUpdate val_conv;
36551         val_conv.inner = untag_ptr(val);
36552         val_conv.is_owned = ptr_is_owned(val);
36553         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36554         val_conv = UnsignedChannelUpdate_clone(&val_conv);
36555         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
36556 }
36557
36558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
36559         LDKSignature signature_arg_ref;
36560         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
36561         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
36562         LDKUnsignedChannelUpdate contents_arg_conv;
36563         contents_arg_conv.inner = untag_ptr(contents_arg);
36564         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
36565         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
36566         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
36567         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
36568         int64_t ret_ref = 0;
36569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36571         return ret_ref;
36572 }
36573
36574 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
36575         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
36576         int64_t ret_ref = 0;
36577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36579         return ret_ref;
36580 }
36581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36582         LDKChannelUpdate arg_conv;
36583         arg_conv.inner = untag_ptr(arg);
36584         arg_conv.is_owned = ptr_is_owned(arg);
36585         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36586         arg_conv.is_owned = false;
36587         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
36588         return ret_conv;
36589 }
36590
36591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36592         LDKChannelUpdate orig_conv;
36593         orig_conv.inner = untag_ptr(orig);
36594         orig_conv.is_owned = ptr_is_owned(orig);
36595         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36596         orig_conv.is_owned = false;
36597         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
36598         int64_t ret_ref = 0;
36599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36601         return ret_ref;
36602 }
36603
36604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36605         LDKQueryChannelRange this_obj_conv;
36606         this_obj_conv.inner = untag_ptr(this_obj);
36607         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36609         QueryChannelRange_free(this_obj_conv);
36610 }
36611
36612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36613         LDKQueryChannelRange this_ptr_conv;
36614         this_ptr_conv.inner = untag_ptr(this_ptr);
36615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36617         this_ptr_conv.is_owned = false;
36618         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36619         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
36620         return ret_arr;
36621 }
36622
36623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36624         LDKQueryChannelRange this_ptr_conv;
36625         this_ptr_conv.inner = untag_ptr(this_ptr);
36626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36628         this_ptr_conv.is_owned = false;
36629         LDKThirtyTwoBytes val_ref;
36630         CHECK((*env)->GetArrayLength(env, val) == 32);
36631         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36632         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
36633 }
36634
36635 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
36636         LDKQueryChannelRange this_ptr_conv;
36637         this_ptr_conv.inner = untag_ptr(this_ptr);
36638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36640         this_ptr_conv.is_owned = false;
36641         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
36642         return ret_conv;
36643 }
36644
36645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36646         LDKQueryChannelRange this_ptr_conv;
36647         this_ptr_conv.inner = untag_ptr(this_ptr);
36648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36650         this_ptr_conv.is_owned = false;
36651         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
36652 }
36653
36654 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
36655         LDKQueryChannelRange this_ptr_conv;
36656         this_ptr_conv.inner = untag_ptr(this_ptr);
36657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36659         this_ptr_conv.is_owned = false;
36660         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
36661         return ret_conv;
36662 }
36663
36664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36665         LDKQueryChannelRange this_ptr_conv;
36666         this_ptr_conv.inner = untag_ptr(this_ptr);
36667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36669         this_ptr_conv.is_owned = false;
36670         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
36671 }
36672
36673 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) {
36674         LDKThirtyTwoBytes chain_hash_arg_ref;
36675         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36676         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36677         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
36678         int64_t ret_ref = 0;
36679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36681         return ret_ref;
36682 }
36683
36684 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
36685         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
36686         int64_t ret_ref = 0;
36687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36689         return ret_ref;
36690 }
36691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36692         LDKQueryChannelRange arg_conv;
36693         arg_conv.inner = untag_ptr(arg);
36694         arg_conv.is_owned = ptr_is_owned(arg);
36695         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36696         arg_conv.is_owned = false;
36697         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
36698         return ret_conv;
36699 }
36700
36701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36702         LDKQueryChannelRange orig_conv;
36703         orig_conv.inner = untag_ptr(orig);
36704         orig_conv.is_owned = ptr_is_owned(orig);
36705         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36706         orig_conv.is_owned = false;
36707         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
36708         int64_t ret_ref = 0;
36709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36711         return ret_ref;
36712 }
36713
36714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36715         LDKReplyChannelRange this_obj_conv;
36716         this_obj_conv.inner = untag_ptr(this_obj);
36717         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36719         ReplyChannelRange_free(this_obj_conv);
36720 }
36721
36722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36723         LDKReplyChannelRange this_ptr_conv;
36724         this_ptr_conv.inner = untag_ptr(this_ptr);
36725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36727         this_ptr_conv.is_owned = false;
36728         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36729         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
36730         return ret_arr;
36731 }
36732
36733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36734         LDKReplyChannelRange this_ptr_conv;
36735         this_ptr_conv.inner = untag_ptr(this_ptr);
36736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36738         this_ptr_conv.is_owned = false;
36739         LDKThirtyTwoBytes val_ref;
36740         CHECK((*env)->GetArrayLength(env, val) == 32);
36741         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36742         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
36743 }
36744
36745 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
36746         LDKReplyChannelRange this_ptr_conv;
36747         this_ptr_conv.inner = untag_ptr(this_ptr);
36748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36750         this_ptr_conv.is_owned = false;
36751         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
36752         return ret_conv;
36753 }
36754
36755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36756         LDKReplyChannelRange this_ptr_conv;
36757         this_ptr_conv.inner = untag_ptr(this_ptr);
36758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36760         this_ptr_conv.is_owned = false;
36761         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
36762 }
36763
36764 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
36765         LDKReplyChannelRange this_ptr_conv;
36766         this_ptr_conv.inner = untag_ptr(this_ptr);
36767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36769         this_ptr_conv.is_owned = false;
36770         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
36771         return ret_conv;
36772 }
36773
36774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36775         LDKReplyChannelRange this_ptr_conv;
36776         this_ptr_conv.inner = untag_ptr(this_ptr);
36777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36779         this_ptr_conv.is_owned = false;
36780         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
36781 }
36782
36783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
36784         LDKReplyChannelRange this_ptr_conv;
36785         this_ptr_conv.inner = untag_ptr(this_ptr);
36786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36788         this_ptr_conv.is_owned = false;
36789         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
36790         return ret_conv;
36791 }
36792
36793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36794         LDKReplyChannelRange this_ptr_conv;
36795         this_ptr_conv.inner = untag_ptr(this_ptr);
36796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36798         this_ptr_conv.is_owned = false;
36799         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
36800 }
36801
36802 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
36803         LDKReplyChannelRange this_ptr_conv;
36804         this_ptr_conv.inner = untag_ptr(this_ptr);
36805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36807         this_ptr_conv.is_owned = false;
36808         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
36809         int64_tArray ret_arr = NULL;
36810         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36811         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36812         for (size_t g = 0; g < ret_var.datalen; g++) {
36813                 int64_t ret_conv_6_conv = ret_var.data[g];
36814                 ret_arr_ptr[g] = ret_conv_6_conv;
36815         }
36816         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36817         FREE(ret_var.data);
36818         return ret_arr;
36819 }
36820
36821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36822         LDKReplyChannelRange this_ptr_conv;
36823         this_ptr_conv.inner = untag_ptr(this_ptr);
36824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36826         this_ptr_conv.is_owned = false;
36827         LDKCVec_u64Z val_constr;
36828         val_constr.datalen = (*env)->GetArrayLength(env, val);
36829         if (val_constr.datalen > 0)
36830                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36831         else
36832                 val_constr.data = NULL;
36833         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36834         for (size_t g = 0; g < val_constr.datalen; g++) {
36835                 int64_t val_conv_6 = val_vals[g];
36836                 val_constr.data[g] = val_conv_6;
36837         }
36838         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36839         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
36840 }
36841
36842 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) {
36843         LDKThirtyTwoBytes chain_hash_arg_ref;
36844         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36845         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36846         LDKCVec_u64Z short_channel_ids_arg_constr;
36847         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
36848         if (short_channel_ids_arg_constr.datalen > 0)
36849                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36850         else
36851                 short_channel_ids_arg_constr.data = NULL;
36852         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
36853         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
36854                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
36855                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
36856         }
36857         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
36858         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
36859         int64_t ret_ref = 0;
36860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36862         return ret_ref;
36863 }
36864
36865 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
36866         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
36867         int64_t ret_ref = 0;
36868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36870         return ret_ref;
36871 }
36872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36873         LDKReplyChannelRange arg_conv;
36874         arg_conv.inner = untag_ptr(arg);
36875         arg_conv.is_owned = ptr_is_owned(arg);
36876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36877         arg_conv.is_owned = false;
36878         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
36879         return ret_conv;
36880 }
36881
36882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36883         LDKReplyChannelRange orig_conv;
36884         orig_conv.inner = untag_ptr(orig);
36885         orig_conv.is_owned = ptr_is_owned(orig);
36886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36887         orig_conv.is_owned = false;
36888         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
36889         int64_t ret_ref = 0;
36890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36892         return ret_ref;
36893 }
36894
36895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36896         LDKQueryShortChannelIds this_obj_conv;
36897         this_obj_conv.inner = untag_ptr(this_obj);
36898         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36900         QueryShortChannelIds_free(this_obj_conv);
36901 }
36902
36903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36904         LDKQueryShortChannelIds this_ptr_conv;
36905         this_ptr_conv.inner = untag_ptr(this_ptr);
36906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36908         this_ptr_conv.is_owned = false;
36909         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36910         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
36911         return ret_arr;
36912 }
36913
36914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36915         LDKQueryShortChannelIds this_ptr_conv;
36916         this_ptr_conv.inner = untag_ptr(this_ptr);
36917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36919         this_ptr_conv.is_owned = false;
36920         LDKThirtyTwoBytes val_ref;
36921         CHECK((*env)->GetArrayLength(env, val) == 32);
36922         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36923         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
36924 }
36925
36926 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
36927         LDKQueryShortChannelIds this_ptr_conv;
36928         this_ptr_conv.inner = untag_ptr(this_ptr);
36929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36931         this_ptr_conv.is_owned = false;
36932         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
36933         int64_tArray ret_arr = NULL;
36934         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36935         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36936         for (size_t g = 0; g < ret_var.datalen; g++) {
36937                 int64_t ret_conv_6_conv = ret_var.data[g];
36938                 ret_arr_ptr[g] = ret_conv_6_conv;
36939         }
36940         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36941         FREE(ret_var.data);
36942         return ret_arr;
36943 }
36944
36945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
36946         LDKQueryShortChannelIds 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         LDKCVec_u64Z val_constr;
36952         val_constr.datalen = (*env)->GetArrayLength(env, val);
36953         if (val_constr.datalen > 0)
36954                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36955         else
36956                 val_constr.data = NULL;
36957         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
36958         for (size_t g = 0; g < val_constr.datalen; g++) {
36959                 int64_t val_conv_6 = val_vals[g];
36960                 val_constr.data[g] = val_conv_6;
36961         }
36962         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
36963         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
36964 }
36965
36966 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) {
36967         LDKThirtyTwoBytes chain_hash_arg_ref;
36968         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
36969         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
36970         LDKCVec_u64Z short_channel_ids_arg_constr;
36971         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
36972         if (short_channel_ids_arg_constr.datalen > 0)
36973                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
36974         else
36975                 short_channel_ids_arg_constr.data = NULL;
36976         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
36977         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
36978                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
36979                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
36980         }
36981         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
36982         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
36983         int64_t ret_ref = 0;
36984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36986         return ret_ref;
36987 }
36988
36989 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
36990         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
36991         int64_t ret_ref = 0;
36992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36994         return ret_ref;
36995 }
36996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36997         LDKQueryShortChannelIds arg_conv;
36998         arg_conv.inner = untag_ptr(arg);
36999         arg_conv.is_owned = ptr_is_owned(arg);
37000         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37001         arg_conv.is_owned = false;
37002         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
37003         return ret_conv;
37004 }
37005
37006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37007         LDKQueryShortChannelIds orig_conv;
37008         orig_conv.inner = untag_ptr(orig);
37009         orig_conv.is_owned = ptr_is_owned(orig);
37010         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37011         orig_conv.is_owned = false;
37012         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
37013         int64_t ret_ref = 0;
37014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37016         return ret_ref;
37017 }
37018
37019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37020         LDKReplyShortChannelIdsEnd this_obj_conv;
37021         this_obj_conv.inner = untag_ptr(this_obj);
37022         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37024         ReplyShortChannelIdsEnd_free(this_obj_conv);
37025 }
37026
37027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
37028         LDKReplyShortChannelIdsEnd this_ptr_conv;
37029         this_ptr_conv.inner = untag_ptr(this_ptr);
37030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37032         this_ptr_conv.is_owned = false;
37033         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37034         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
37035         return ret_arr;
37036 }
37037
37038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37039         LDKReplyShortChannelIdsEnd this_ptr_conv;
37040         this_ptr_conv.inner = untag_ptr(this_ptr);
37041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37043         this_ptr_conv.is_owned = false;
37044         LDKThirtyTwoBytes val_ref;
37045         CHECK((*env)->GetArrayLength(env, val) == 32);
37046         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37047         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
37048 }
37049
37050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
37051         LDKReplyShortChannelIdsEnd this_ptr_conv;
37052         this_ptr_conv.inner = untag_ptr(this_ptr);
37053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37055         this_ptr_conv.is_owned = false;
37056         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
37057         return ret_conv;
37058 }
37059
37060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37061         LDKReplyShortChannelIdsEnd this_ptr_conv;
37062         this_ptr_conv.inner = untag_ptr(this_ptr);
37063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37065         this_ptr_conv.is_owned = false;
37066         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
37067 }
37068
37069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
37070         LDKThirtyTwoBytes chain_hash_arg_ref;
37071         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
37072         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
37073         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
37074         int64_t ret_ref = 0;
37075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37077         return ret_ref;
37078 }
37079
37080 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
37081         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
37082         int64_t ret_ref = 0;
37083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37085         return ret_ref;
37086 }
37087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37088         LDKReplyShortChannelIdsEnd arg_conv;
37089         arg_conv.inner = untag_ptr(arg);
37090         arg_conv.is_owned = ptr_is_owned(arg);
37091         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37092         arg_conv.is_owned = false;
37093         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
37094         return ret_conv;
37095 }
37096
37097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37098         LDKReplyShortChannelIdsEnd orig_conv;
37099         orig_conv.inner = untag_ptr(orig);
37100         orig_conv.is_owned = ptr_is_owned(orig);
37101         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37102         orig_conv.is_owned = false;
37103         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
37104         int64_t ret_ref = 0;
37105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37107         return ret_ref;
37108 }
37109
37110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37111         LDKGossipTimestampFilter this_obj_conv;
37112         this_obj_conv.inner = untag_ptr(this_obj);
37113         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37115         GossipTimestampFilter_free(this_obj_conv);
37116 }
37117
37118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
37119         LDKGossipTimestampFilter this_ptr_conv;
37120         this_ptr_conv.inner = untag_ptr(this_ptr);
37121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37123         this_ptr_conv.is_owned = false;
37124         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37125         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
37126         return ret_arr;
37127 }
37128
37129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37130         LDKGossipTimestampFilter this_ptr_conv;
37131         this_ptr_conv.inner = untag_ptr(this_ptr);
37132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37134         this_ptr_conv.is_owned = false;
37135         LDKThirtyTwoBytes val_ref;
37136         CHECK((*env)->GetArrayLength(env, val) == 32);
37137         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37138         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
37139 }
37140
37141 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
37142         LDKGossipTimestampFilter this_ptr_conv;
37143         this_ptr_conv.inner = untag_ptr(this_ptr);
37144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37146         this_ptr_conv.is_owned = false;
37147         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
37148         return ret_conv;
37149 }
37150
37151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37152         LDKGossipTimestampFilter this_ptr_conv;
37153         this_ptr_conv.inner = untag_ptr(this_ptr);
37154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37156         this_ptr_conv.is_owned = false;
37157         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
37158 }
37159
37160 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
37161         LDKGossipTimestampFilter this_ptr_conv;
37162         this_ptr_conv.inner = untag_ptr(this_ptr);
37163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37165         this_ptr_conv.is_owned = false;
37166         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
37167         return ret_conv;
37168 }
37169
37170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37171         LDKGossipTimestampFilter this_ptr_conv;
37172         this_ptr_conv.inner = untag_ptr(this_ptr);
37173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37175         this_ptr_conv.is_owned = false;
37176         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
37177 }
37178
37179 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) {
37180         LDKThirtyTwoBytes chain_hash_arg_ref;
37181         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
37182         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
37183         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
37184         int64_t ret_ref = 0;
37185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37187         return ret_ref;
37188 }
37189
37190 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
37191         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
37192         int64_t ret_ref = 0;
37193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37195         return ret_ref;
37196 }
37197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37198         LDKGossipTimestampFilter arg_conv;
37199         arg_conv.inner = untag_ptr(arg);
37200         arg_conv.is_owned = ptr_is_owned(arg);
37201         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37202         arg_conv.is_owned = false;
37203         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
37204         return ret_conv;
37205 }
37206
37207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37208         LDKGossipTimestampFilter orig_conv;
37209         orig_conv.inner = untag_ptr(orig);
37210         orig_conv.is_owned = ptr_is_owned(orig);
37211         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37212         orig_conv.is_owned = false;
37213         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
37214         int64_t ret_ref = 0;
37215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37217         return ret_ref;
37218 }
37219
37220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37221         if (!ptr_is_owned(this_ptr)) return;
37222         void* this_ptr_ptr = untag_ptr(this_ptr);
37223         CHECK_ACCESS(this_ptr_ptr);
37224         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
37225         FREE(untag_ptr(this_ptr));
37226         ErrorAction_free(this_ptr_conv);
37227 }
37228
37229 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
37230         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37231         *ret_copy = ErrorAction_clone(arg);
37232         int64_t ret_ref = tag_ptr(ret_copy, true);
37233         return ret_ref;
37234 }
37235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37236         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
37237         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
37238         return ret_conv;
37239 }
37240
37241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37242         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
37243         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37244         *ret_copy = ErrorAction_clone(orig_conv);
37245         int64_t ret_ref = tag_ptr(ret_copy, true);
37246         return ret_ref;
37247 }
37248
37249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
37250         LDKErrorMessage msg_conv;
37251         msg_conv.inner = untag_ptr(msg);
37252         msg_conv.is_owned = ptr_is_owned(msg);
37253         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37254         msg_conv = ErrorMessage_clone(&msg_conv);
37255         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37256         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
37257         int64_t ret_ref = tag_ptr(ret_copy, true);
37258         return ret_ref;
37259 }
37260
37261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
37262         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37263         *ret_copy = ErrorAction_ignore_error();
37264         int64_t ret_ref = tag_ptr(ret_copy, true);
37265         return ret_ref;
37266 }
37267
37268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
37269         LDKLevel a_conv = LDKLevel_from_java(env, a);
37270         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37271         *ret_copy = ErrorAction_ignore_and_log(a_conv);
37272         int64_t ret_ref = tag_ptr(ret_copy, true);
37273         return ret_ref;
37274 }
37275
37276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
37277         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37278         *ret_copy = ErrorAction_ignore_duplicate_gossip();
37279         int64_t ret_ref = tag_ptr(ret_copy, true);
37280         return ret_ref;
37281 }
37282
37283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
37284         LDKErrorMessage msg_conv;
37285         msg_conv.inner = untag_ptr(msg);
37286         msg_conv.is_owned = ptr_is_owned(msg);
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37288         msg_conv = ErrorMessage_clone(&msg_conv);
37289         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37290         *ret_copy = ErrorAction_send_error_message(msg_conv);
37291         int64_t ret_ref = tag_ptr(ret_copy, true);
37292         return ret_ref;
37293 }
37294
37295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
37296         LDKWarningMessage msg_conv;
37297         msg_conv.inner = untag_ptr(msg);
37298         msg_conv.is_owned = ptr_is_owned(msg);
37299         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37300         msg_conv = WarningMessage_clone(&msg_conv);
37301         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
37302         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37303         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
37304         int64_t ret_ref = tag_ptr(ret_copy, true);
37305         return ret_ref;
37306 }
37307
37308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37309         LDKLightningError this_obj_conv;
37310         this_obj_conv.inner = untag_ptr(this_obj);
37311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37313         LightningError_free(this_obj_conv);
37314 }
37315
37316 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
37317         LDKLightningError this_ptr_conv;
37318         this_ptr_conv.inner = untag_ptr(this_ptr);
37319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37321         this_ptr_conv.is_owned = false;
37322         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
37323         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
37324         Str_free(ret_str);
37325         return ret_conv;
37326 }
37327
37328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
37329         LDKLightningError this_ptr_conv;
37330         this_ptr_conv.inner = untag_ptr(this_ptr);
37331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37333         this_ptr_conv.is_owned = false;
37334         LDKStr val_conv = java_to_owned_str(env, val);
37335         LightningError_set_err(&this_ptr_conv, val_conv);
37336 }
37337
37338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
37339         LDKLightningError this_ptr_conv;
37340         this_ptr_conv.inner = untag_ptr(this_ptr);
37341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37343         this_ptr_conv.is_owned = false;
37344         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
37345         *ret_copy = LightningError_get_action(&this_ptr_conv);
37346         int64_t ret_ref = tag_ptr(ret_copy, true);
37347         return ret_ref;
37348 }
37349
37350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37351         LDKLightningError this_ptr_conv;
37352         this_ptr_conv.inner = untag_ptr(this_ptr);
37353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37355         this_ptr_conv.is_owned = false;
37356         void* val_ptr = untag_ptr(val);
37357         CHECK_ACCESS(val_ptr);
37358         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
37359         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
37360         LightningError_set_action(&this_ptr_conv, val_conv);
37361 }
37362
37363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
37364         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
37365         void* action_arg_ptr = untag_ptr(action_arg);
37366         CHECK_ACCESS(action_arg_ptr);
37367         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
37368         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
37369         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_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 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
37377         LDKLightningError ret_var = LightningError_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37384         LDKLightningError arg_conv;
37385         arg_conv.inner = untag_ptr(arg);
37386         arg_conv.is_owned = ptr_is_owned(arg);
37387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37388         arg_conv.is_owned = false;
37389         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
37390         return ret_conv;
37391 }
37392
37393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37394         LDKLightningError orig_conv;
37395         orig_conv.inner = untag_ptr(orig);
37396         orig_conv.is_owned = ptr_is_owned(orig);
37397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37398         orig_conv.is_owned = false;
37399         LDKLightningError ret_var = LightningError_clone(&orig_conv);
37400         int64_t ret_ref = 0;
37401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37403         return ret_ref;
37404 }
37405
37406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37407         LDKCommitmentUpdate this_obj_conv;
37408         this_obj_conv.inner = untag_ptr(this_obj);
37409         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37411         CommitmentUpdate_free(this_obj_conv);
37412 }
37413
37414 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37415         LDKCommitmentUpdate this_ptr_conv;
37416         this_ptr_conv.inner = untag_ptr(this_ptr);
37417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37419         this_ptr_conv.is_owned = false;
37420         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
37421         int64_tArray ret_arr = NULL;
37422         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37423         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37424         for (size_t p = 0; p < ret_var.datalen; p++) {
37425                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
37426                 int64_t ret_conv_15_ref = 0;
37427                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
37428                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
37429                 ret_arr_ptr[p] = ret_conv_15_ref;
37430         }
37431         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37432         FREE(ret_var.data);
37433         return ret_arr;
37434 }
37435
37436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37437         LDKCommitmentUpdate this_ptr_conv;
37438         this_ptr_conv.inner = untag_ptr(this_ptr);
37439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37441         this_ptr_conv.is_owned = false;
37442         LDKCVec_UpdateAddHTLCZ val_constr;
37443         val_constr.datalen = (*env)->GetArrayLength(env, val);
37444         if (val_constr.datalen > 0)
37445                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
37446         else
37447                 val_constr.data = NULL;
37448         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37449         for (size_t p = 0; p < val_constr.datalen; p++) {
37450                 int64_t val_conv_15 = val_vals[p];
37451                 LDKUpdateAddHTLC val_conv_15_conv;
37452                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
37453                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
37454                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
37455                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
37456                 val_constr.data[p] = val_conv_15_conv;
37457         }
37458         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37459         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
37460 }
37461
37462 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37463         LDKCommitmentUpdate this_ptr_conv;
37464         this_ptr_conv.inner = untag_ptr(this_ptr);
37465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37467         this_ptr_conv.is_owned = false;
37468         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
37469         int64_tArray ret_arr = NULL;
37470         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37471         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37472         for (size_t t = 0; t < ret_var.datalen; t++) {
37473                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
37474                 int64_t ret_conv_19_ref = 0;
37475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
37476                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
37477                 ret_arr_ptr[t] = ret_conv_19_ref;
37478         }
37479         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37480         FREE(ret_var.data);
37481         return ret_arr;
37482 }
37483
37484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37485         LDKCommitmentUpdate this_ptr_conv;
37486         this_ptr_conv.inner = untag_ptr(this_ptr);
37487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37489         this_ptr_conv.is_owned = false;
37490         LDKCVec_UpdateFulfillHTLCZ val_constr;
37491         val_constr.datalen = (*env)->GetArrayLength(env, val);
37492         if (val_constr.datalen > 0)
37493                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
37494         else
37495                 val_constr.data = NULL;
37496         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37497         for (size_t t = 0; t < val_constr.datalen; t++) {
37498                 int64_t val_conv_19 = val_vals[t];
37499                 LDKUpdateFulfillHTLC val_conv_19_conv;
37500                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
37501                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
37502                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
37503                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
37504                 val_constr.data[t] = val_conv_19_conv;
37505         }
37506         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37507         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
37508 }
37509
37510 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37511         LDKCommitmentUpdate this_ptr_conv;
37512         this_ptr_conv.inner = untag_ptr(this_ptr);
37513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37515         this_ptr_conv.is_owned = false;
37516         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
37517         int64_tArray ret_arr = NULL;
37518         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37519         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37520         for (size_t q = 0; q < ret_var.datalen; q++) {
37521                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
37522                 int64_t ret_conv_16_ref = 0;
37523                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
37524                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
37525                 ret_arr_ptr[q] = ret_conv_16_ref;
37526         }
37527         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37528         FREE(ret_var.data);
37529         return ret_arr;
37530 }
37531
37532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37533         LDKCommitmentUpdate this_ptr_conv;
37534         this_ptr_conv.inner = untag_ptr(this_ptr);
37535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37537         this_ptr_conv.is_owned = false;
37538         LDKCVec_UpdateFailHTLCZ val_constr;
37539         val_constr.datalen = (*env)->GetArrayLength(env, val);
37540         if (val_constr.datalen > 0)
37541                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
37542         else
37543                 val_constr.data = NULL;
37544         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37545         for (size_t q = 0; q < val_constr.datalen; q++) {
37546                 int64_t val_conv_16 = val_vals[q];
37547                 LDKUpdateFailHTLC val_conv_16_conv;
37548                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
37549                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
37550                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
37551                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
37552                 val_constr.data[q] = val_conv_16_conv;
37553         }
37554         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37555         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
37556 }
37557
37558 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
37559         LDKCommitmentUpdate 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         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
37565         int64_tArray ret_arr = NULL;
37566         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37567         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37568         for (size_t z = 0; z < ret_var.datalen; z++) {
37569                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
37570                 int64_t ret_conv_25_ref = 0;
37571                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
37572                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
37573                 ret_arr_ptr[z] = ret_conv_25_ref;
37574         }
37575         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37576         FREE(ret_var.data);
37577         return ret_arr;
37578 }
37579
37580 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) {
37581         LDKCommitmentUpdate this_ptr_conv;
37582         this_ptr_conv.inner = untag_ptr(this_ptr);
37583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37585         this_ptr_conv.is_owned = false;
37586         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
37587         val_constr.datalen = (*env)->GetArrayLength(env, val);
37588         if (val_constr.datalen > 0)
37589                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
37590         else
37591                 val_constr.data = NULL;
37592         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37593         for (size_t z = 0; z < val_constr.datalen; z++) {
37594                 int64_t val_conv_25 = val_vals[z];
37595                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
37596                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
37597                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
37598                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
37599                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
37600                 val_constr.data[z] = val_conv_25_conv;
37601         }
37602         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37603         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
37604 }
37605
37606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
37607         LDKCommitmentUpdate this_ptr_conv;
37608         this_ptr_conv.inner = untag_ptr(this_ptr);
37609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37611         this_ptr_conv.is_owned = false;
37612         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
37613         int64_t ret_ref = 0;
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37616         return ret_ref;
37617 }
37618
37619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37620         LDKCommitmentUpdate this_ptr_conv;
37621         this_ptr_conv.inner = untag_ptr(this_ptr);
37622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37624         this_ptr_conv.is_owned = false;
37625         LDKUpdateFee val_conv;
37626         val_conv.inner = untag_ptr(val);
37627         val_conv.is_owned = ptr_is_owned(val);
37628         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37629         val_conv = UpdateFee_clone(&val_conv);
37630         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
37631 }
37632
37633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
37634         LDKCommitmentUpdate this_ptr_conv;
37635         this_ptr_conv.inner = untag_ptr(this_ptr);
37636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37638         this_ptr_conv.is_owned = false;
37639         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
37640         int64_t ret_ref = 0;
37641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37643         return ret_ref;
37644 }
37645
37646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37647         LDKCommitmentUpdate this_ptr_conv;
37648         this_ptr_conv.inner = untag_ptr(this_ptr);
37649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37651         this_ptr_conv.is_owned = false;
37652         LDKCommitmentSigned val_conv;
37653         val_conv.inner = untag_ptr(val);
37654         val_conv.is_owned = ptr_is_owned(val);
37655         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37656         val_conv = CommitmentSigned_clone(&val_conv);
37657         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
37658 }
37659
37660 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) {
37661         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
37662         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
37663         if (update_add_htlcs_arg_constr.datalen > 0)
37664                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
37665         else
37666                 update_add_htlcs_arg_constr.data = NULL;
37667         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
37668         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
37669                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
37670                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
37671                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
37672                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
37673                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
37674                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
37675                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
37676         }
37677         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
37678         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
37679         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
37680         if (update_fulfill_htlcs_arg_constr.datalen > 0)
37681                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
37682         else
37683                 update_fulfill_htlcs_arg_constr.data = NULL;
37684         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
37685         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
37686                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
37687                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
37688                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
37689                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
37690                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
37691                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
37692                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
37693         }
37694         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
37695         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
37696         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
37697         if (update_fail_htlcs_arg_constr.datalen > 0)
37698                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
37699         else
37700                 update_fail_htlcs_arg_constr.data = NULL;
37701         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
37702         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
37703                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
37704                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
37705                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
37706                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
37707                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
37708                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
37709                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
37710         }
37711         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
37712         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
37713         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
37714         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
37715                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
37716         else
37717                 update_fail_malformed_htlcs_arg_constr.data = NULL;
37718         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
37719         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
37720                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
37721                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
37722                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
37723                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
37724                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
37725                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
37726                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
37727         }
37728         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
37729         LDKUpdateFee update_fee_arg_conv;
37730         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
37731         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
37732         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
37733         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
37734         LDKCommitmentSigned commitment_signed_arg_conv;
37735         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
37736         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
37737         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
37738         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
37739         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);
37740         int64_t ret_ref = 0;
37741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37743         return ret_ref;
37744 }
37745
37746 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
37747         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
37748         int64_t ret_ref = 0;
37749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37751         return ret_ref;
37752 }
37753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37754         LDKCommitmentUpdate arg_conv;
37755         arg_conv.inner = untag_ptr(arg);
37756         arg_conv.is_owned = ptr_is_owned(arg);
37757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37758         arg_conv.is_owned = false;
37759         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
37760         return ret_conv;
37761 }
37762
37763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37764         LDKCommitmentUpdate orig_conv;
37765         orig_conv.inner = untag_ptr(orig);
37766         orig_conv.is_owned = ptr_is_owned(orig);
37767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37768         orig_conv.is_owned = false;
37769         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
37770         int64_t ret_ref = 0;
37771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37773         return ret_ref;
37774 }
37775
37776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37777         if (!ptr_is_owned(this_ptr)) return;
37778         void* this_ptr_ptr = untag_ptr(this_ptr);
37779         CHECK_ACCESS(this_ptr_ptr);
37780         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
37781         FREE(untag_ptr(this_ptr));
37782         ChannelMessageHandler_free(this_ptr_conv);
37783 }
37784
37785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37786         if (!ptr_is_owned(this_ptr)) return;
37787         void* this_ptr_ptr = untag_ptr(this_ptr);
37788         CHECK_ACCESS(this_ptr_ptr);
37789         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
37790         FREE(untag_ptr(this_ptr));
37791         RoutingMessageHandler_free(this_ptr_conv);
37792 }
37793
37794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37795         if (!ptr_is_owned(this_ptr)) return;
37796         void* this_ptr_ptr = untag_ptr(this_ptr);
37797         CHECK_ACCESS(this_ptr_ptr);
37798         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
37799         FREE(untag_ptr(this_ptr));
37800         OnionMessageHandler_free(this_ptr_conv);
37801 }
37802
37803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
37804         LDKAcceptChannel obj_conv;
37805         obj_conv.inner = untag_ptr(obj);
37806         obj_conv.is_owned = ptr_is_owned(obj);
37807         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37808         obj_conv.is_owned = false;
37809         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
37810         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37811         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37812         CVec_u8Z_free(ret_var);
37813         return ret_arr;
37814 }
37815
37816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37817         LDKu8slice ser_ref;
37818         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37819         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37820         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
37821         *ret_conv = AcceptChannel_read(ser_ref);
37822         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37823         return tag_ptr(ret_conv, true);
37824 }
37825
37826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
37827         LDKAnnouncementSignatures obj_conv;
37828         obj_conv.inner = untag_ptr(obj);
37829         obj_conv.is_owned = ptr_is_owned(obj);
37830         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37831         obj_conv.is_owned = false;
37832         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
37833         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37834         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37835         CVec_u8Z_free(ret_var);
37836         return ret_arr;
37837 }
37838
37839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37840         LDKu8slice ser_ref;
37841         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37842         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37843         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
37844         *ret_conv = AnnouncementSignatures_read(ser_ref);
37845         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37846         return tag_ptr(ret_conv, true);
37847 }
37848
37849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
37850         LDKChannelReestablish obj_conv;
37851         obj_conv.inner = untag_ptr(obj);
37852         obj_conv.is_owned = ptr_is_owned(obj);
37853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37854         obj_conv.is_owned = false;
37855         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
37856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37858         CVec_u8Z_free(ret_var);
37859         return ret_arr;
37860 }
37861
37862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37863         LDKu8slice ser_ref;
37864         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37865         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37866         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
37867         *ret_conv = ChannelReestablish_read(ser_ref);
37868         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37869         return tag_ptr(ret_conv, true);
37870 }
37871
37872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37873         LDKClosingSigned obj_conv;
37874         obj_conv.inner = untag_ptr(obj);
37875         obj_conv.is_owned = ptr_is_owned(obj);
37876         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37877         obj_conv.is_owned = false;
37878         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
37879         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37880         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37881         CVec_u8Z_free(ret_var);
37882         return ret_arr;
37883 }
37884
37885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37886         LDKu8slice ser_ref;
37887         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37888         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37889         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
37890         *ret_conv = ClosingSigned_read(ser_ref);
37891         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37892         return tag_ptr(ret_conv, true);
37893 }
37894
37895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
37896         LDKClosingSignedFeeRange obj_conv;
37897         obj_conv.inner = untag_ptr(obj);
37898         obj_conv.is_owned = ptr_is_owned(obj);
37899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37900         obj_conv.is_owned = false;
37901         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
37902         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37903         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37904         CVec_u8Z_free(ret_var);
37905         return ret_arr;
37906 }
37907
37908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37909         LDKu8slice ser_ref;
37910         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37911         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37912         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
37913         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
37914         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37915         return tag_ptr(ret_conv, true);
37916 }
37917
37918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37919         LDKCommitmentSigned obj_conv;
37920         obj_conv.inner = untag_ptr(obj);
37921         obj_conv.is_owned = ptr_is_owned(obj);
37922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37923         obj_conv.is_owned = false;
37924         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
37925         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37926         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37927         CVec_u8Z_free(ret_var);
37928         return ret_arr;
37929 }
37930
37931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37932         LDKu8slice ser_ref;
37933         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37934         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37935         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
37936         *ret_conv = CommitmentSigned_read(ser_ref);
37937         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37938         return tag_ptr(ret_conv, true);
37939 }
37940
37941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
37942         LDKFundingCreated obj_conv;
37943         obj_conv.inner = untag_ptr(obj);
37944         obj_conv.is_owned = ptr_is_owned(obj);
37945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37946         obj_conv.is_owned = false;
37947         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
37948         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37949         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37950         CVec_u8Z_free(ret_var);
37951         return ret_arr;
37952 }
37953
37954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37955         LDKu8slice ser_ref;
37956         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37957         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37958         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
37959         *ret_conv = FundingCreated_read(ser_ref);
37960         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37961         return tag_ptr(ret_conv, true);
37962 }
37963
37964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
37965         LDKFundingSigned obj_conv;
37966         obj_conv.inner = untag_ptr(obj);
37967         obj_conv.is_owned = ptr_is_owned(obj);
37968         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37969         obj_conv.is_owned = false;
37970         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
37971         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37972         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37973         CVec_u8Z_free(ret_var);
37974         return ret_arr;
37975 }
37976
37977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37978         LDKu8slice ser_ref;
37979         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37980         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37981         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
37982         *ret_conv = FundingSigned_read(ser_ref);
37983         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37984         return tag_ptr(ret_conv, true);
37985 }
37986
37987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
37988         LDKChannelReady obj_conv;
37989         obj_conv.inner = untag_ptr(obj);
37990         obj_conv.is_owned = ptr_is_owned(obj);
37991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37992         obj_conv.is_owned = false;
37993         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
37994         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37995         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37996         CVec_u8Z_free(ret_var);
37997         return ret_arr;
37998 }
37999
38000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38001         LDKu8slice ser_ref;
38002         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38003         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38004         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
38005         *ret_conv = ChannelReady_read(ser_ref);
38006         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38007         return tag_ptr(ret_conv, true);
38008 }
38009
38010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
38011         LDKInit obj_conv;
38012         obj_conv.inner = untag_ptr(obj);
38013         obj_conv.is_owned = ptr_is_owned(obj);
38014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38015         obj_conv.is_owned = false;
38016         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
38017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38019         CVec_u8Z_free(ret_var);
38020         return ret_arr;
38021 }
38022
38023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38024         LDKu8slice ser_ref;
38025         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38026         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38027         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
38028         *ret_conv = Init_read(ser_ref);
38029         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38030         return tag_ptr(ret_conv, true);
38031 }
38032
38033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
38034         LDKOpenChannel obj_conv;
38035         obj_conv.inner = untag_ptr(obj);
38036         obj_conv.is_owned = ptr_is_owned(obj);
38037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38038         obj_conv.is_owned = false;
38039         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
38040         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38041         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38042         CVec_u8Z_free(ret_var);
38043         return ret_arr;
38044 }
38045
38046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38047         LDKu8slice ser_ref;
38048         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38049         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38050         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
38051         *ret_conv = OpenChannel_read(ser_ref);
38052         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38053         return tag_ptr(ret_conv, true);
38054 }
38055
38056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
38057         LDKRevokeAndACK obj_conv;
38058         obj_conv.inner = untag_ptr(obj);
38059         obj_conv.is_owned = ptr_is_owned(obj);
38060         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38061         obj_conv.is_owned = false;
38062         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
38063         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38064         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38065         CVec_u8Z_free(ret_var);
38066         return ret_arr;
38067 }
38068
38069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38070         LDKu8slice ser_ref;
38071         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38072         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38073         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
38074         *ret_conv = RevokeAndACK_read(ser_ref);
38075         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38076         return tag_ptr(ret_conv, true);
38077 }
38078
38079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
38080         LDKShutdown obj_conv;
38081         obj_conv.inner = untag_ptr(obj);
38082         obj_conv.is_owned = ptr_is_owned(obj);
38083         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38084         obj_conv.is_owned = false;
38085         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
38086         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38087         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38088         CVec_u8Z_free(ret_var);
38089         return ret_arr;
38090 }
38091
38092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38093         LDKu8slice ser_ref;
38094         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38095         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38096         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
38097         *ret_conv = Shutdown_read(ser_ref);
38098         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38099         return tag_ptr(ret_conv, true);
38100 }
38101
38102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
38103         LDKUpdateFailHTLC obj_conv;
38104         obj_conv.inner = untag_ptr(obj);
38105         obj_conv.is_owned = ptr_is_owned(obj);
38106         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38107         obj_conv.is_owned = false;
38108         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
38109         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38110         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38111         CVec_u8Z_free(ret_var);
38112         return ret_arr;
38113 }
38114
38115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38116         LDKu8slice ser_ref;
38117         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38118         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38119         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
38120         *ret_conv = UpdateFailHTLC_read(ser_ref);
38121         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38122         return tag_ptr(ret_conv, true);
38123 }
38124
38125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
38126         LDKUpdateFailMalformedHTLC obj_conv;
38127         obj_conv.inner = untag_ptr(obj);
38128         obj_conv.is_owned = ptr_is_owned(obj);
38129         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38130         obj_conv.is_owned = false;
38131         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
38132         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38133         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38134         CVec_u8Z_free(ret_var);
38135         return ret_arr;
38136 }
38137
38138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38139         LDKu8slice ser_ref;
38140         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38141         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38142         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
38143         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
38144         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38145         return tag_ptr(ret_conv, true);
38146 }
38147
38148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
38149         LDKUpdateFee obj_conv;
38150         obj_conv.inner = untag_ptr(obj);
38151         obj_conv.is_owned = ptr_is_owned(obj);
38152         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38153         obj_conv.is_owned = false;
38154         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
38155         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38156         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38157         CVec_u8Z_free(ret_var);
38158         return ret_arr;
38159 }
38160
38161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38162         LDKu8slice ser_ref;
38163         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38164         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38165         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
38166         *ret_conv = UpdateFee_read(ser_ref);
38167         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38168         return tag_ptr(ret_conv, true);
38169 }
38170
38171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
38172         LDKUpdateFulfillHTLC obj_conv;
38173         obj_conv.inner = untag_ptr(obj);
38174         obj_conv.is_owned = ptr_is_owned(obj);
38175         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38176         obj_conv.is_owned = false;
38177         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
38178         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38179         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38180         CVec_u8Z_free(ret_var);
38181         return ret_arr;
38182 }
38183
38184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38185         LDKu8slice ser_ref;
38186         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38187         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38188         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
38189         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
38190         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38191         return tag_ptr(ret_conv, true);
38192 }
38193
38194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
38195         LDKUpdateAddHTLC obj_conv;
38196         obj_conv.inner = untag_ptr(obj);
38197         obj_conv.is_owned = ptr_is_owned(obj);
38198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38199         obj_conv.is_owned = false;
38200         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
38201         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38202         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38203         CVec_u8Z_free(ret_var);
38204         return ret_arr;
38205 }
38206
38207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38208         LDKu8slice ser_ref;
38209         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38210         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38211         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
38212         *ret_conv = UpdateAddHTLC_read(ser_ref);
38213         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38214         return tag_ptr(ret_conv, true);
38215 }
38216
38217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38218         LDKu8slice ser_ref;
38219         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38220         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38221         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
38222         *ret_conv = OnionMessage_read(ser_ref);
38223         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38224         return tag_ptr(ret_conv, true);
38225 }
38226
38227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38228         LDKOnionMessage obj_conv;
38229         obj_conv.inner = untag_ptr(obj);
38230         obj_conv.is_owned = ptr_is_owned(obj);
38231         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38232         obj_conv.is_owned = false;
38233         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
38234         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38235         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38236         CVec_u8Z_free(ret_var);
38237         return ret_arr;
38238 }
38239
38240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
38241         LDKPing obj_conv;
38242         obj_conv.inner = untag_ptr(obj);
38243         obj_conv.is_owned = ptr_is_owned(obj);
38244         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38245         obj_conv.is_owned = false;
38246         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
38247         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38248         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38249         CVec_u8Z_free(ret_var);
38250         return ret_arr;
38251 }
38252
38253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38254         LDKu8slice ser_ref;
38255         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38256         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38257         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
38258         *ret_conv = Ping_read(ser_ref);
38259         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38260         return tag_ptr(ret_conv, true);
38261 }
38262
38263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
38264         LDKPong obj_conv;
38265         obj_conv.inner = untag_ptr(obj);
38266         obj_conv.is_owned = ptr_is_owned(obj);
38267         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38268         obj_conv.is_owned = false;
38269         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
38270         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38271         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38272         CVec_u8Z_free(ret_var);
38273         return ret_arr;
38274 }
38275
38276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38277         LDKu8slice ser_ref;
38278         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38279         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38280         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
38281         *ret_conv = Pong_read(ser_ref);
38282         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38283         return tag_ptr(ret_conv, true);
38284 }
38285
38286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38287         LDKUnsignedChannelAnnouncement obj_conv;
38288         obj_conv.inner = untag_ptr(obj);
38289         obj_conv.is_owned = ptr_is_owned(obj);
38290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38291         obj_conv.is_owned = false;
38292         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
38293         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38294         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38295         CVec_u8Z_free(ret_var);
38296         return ret_arr;
38297 }
38298
38299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38300         LDKu8slice ser_ref;
38301         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38302         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38303         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
38304         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
38305         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38306         return tag_ptr(ret_conv, true);
38307 }
38308
38309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38310         LDKChannelAnnouncement obj_conv;
38311         obj_conv.inner = untag_ptr(obj);
38312         obj_conv.is_owned = ptr_is_owned(obj);
38313         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38314         obj_conv.is_owned = false;
38315         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
38316         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38317         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38318         CVec_u8Z_free(ret_var);
38319         return ret_arr;
38320 }
38321
38322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38323         LDKu8slice ser_ref;
38324         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38325         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38326         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
38327         *ret_conv = ChannelAnnouncement_read(ser_ref);
38328         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38329         return tag_ptr(ret_conv, true);
38330 }
38331
38332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38333         LDKUnsignedChannelUpdate obj_conv;
38334         obj_conv.inner = untag_ptr(obj);
38335         obj_conv.is_owned = ptr_is_owned(obj);
38336         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38337         obj_conv.is_owned = false;
38338         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
38339         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38340         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38341         CVec_u8Z_free(ret_var);
38342         return ret_arr;
38343 }
38344
38345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38346         LDKu8slice ser_ref;
38347         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38348         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38349         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
38350         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
38351         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38352         return tag_ptr(ret_conv, true);
38353 }
38354
38355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
38356         LDKChannelUpdate obj_conv;
38357         obj_conv.inner = untag_ptr(obj);
38358         obj_conv.is_owned = ptr_is_owned(obj);
38359         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38360         obj_conv.is_owned = false;
38361         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
38362         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38363         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38364         CVec_u8Z_free(ret_var);
38365         return ret_arr;
38366 }
38367
38368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38369         LDKu8slice ser_ref;
38370         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38371         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38372         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
38373         *ret_conv = ChannelUpdate_read(ser_ref);
38374         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38375         return tag_ptr(ret_conv, true);
38376 }
38377
38378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38379         LDKErrorMessage obj_conv;
38380         obj_conv.inner = untag_ptr(obj);
38381         obj_conv.is_owned = ptr_is_owned(obj);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38383         obj_conv.is_owned = false;
38384         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
38385         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38386         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38387         CVec_u8Z_free(ret_var);
38388         return ret_arr;
38389 }
38390
38391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38392         LDKu8slice ser_ref;
38393         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38394         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38395         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
38396         *ret_conv = ErrorMessage_read(ser_ref);
38397         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38398         return tag_ptr(ret_conv, true);
38399 }
38400
38401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
38402         LDKWarningMessage obj_conv;
38403         obj_conv.inner = untag_ptr(obj);
38404         obj_conv.is_owned = ptr_is_owned(obj);
38405         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38406         obj_conv.is_owned = false;
38407         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
38408         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38409         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38410         CVec_u8Z_free(ret_var);
38411         return ret_arr;
38412 }
38413
38414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38415         LDKu8slice ser_ref;
38416         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38417         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38418         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
38419         *ret_conv = WarningMessage_read(ser_ref);
38420         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38421         return tag_ptr(ret_conv, true);
38422 }
38423
38424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38425         LDKUnsignedNodeAnnouncement obj_conv;
38426         obj_conv.inner = untag_ptr(obj);
38427         obj_conv.is_owned = ptr_is_owned(obj);
38428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38429         obj_conv.is_owned = false;
38430         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
38431         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38432         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38433         CVec_u8Z_free(ret_var);
38434         return ret_arr;
38435 }
38436
38437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38438         LDKu8slice ser_ref;
38439         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38440         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38441         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
38442         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
38443         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38444         return tag_ptr(ret_conv, true);
38445 }
38446
38447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
38448         LDKNodeAnnouncement obj_conv;
38449         obj_conv.inner = untag_ptr(obj);
38450         obj_conv.is_owned = ptr_is_owned(obj);
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38452         obj_conv.is_owned = false;
38453         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
38454         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38455         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38456         CVec_u8Z_free(ret_var);
38457         return ret_arr;
38458 }
38459
38460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38461         LDKu8slice ser_ref;
38462         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38463         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38464         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
38465         *ret_conv = NodeAnnouncement_read(ser_ref);
38466         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38467         return tag_ptr(ret_conv, true);
38468 }
38469
38470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38471         LDKu8slice ser_ref;
38472         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38473         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38474         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
38475         *ret_conv = QueryShortChannelIds_read(ser_ref);
38476         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38477         return tag_ptr(ret_conv, true);
38478 }
38479
38480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
38481         LDKQueryShortChannelIds obj_conv;
38482         obj_conv.inner = untag_ptr(obj);
38483         obj_conv.is_owned = ptr_is_owned(obj);
38484         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38485         obj_conv.is_owned = false;
38486         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
38487         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38488         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38489         CVec_u8Z_free(ret_var);
38490         return ret_arr;
38491 }
38492
38493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
38494         LDKReplyShortChannelIdsEnd obj_conv;
38495         obj_conv.inner = untag_ptr(obj);
38496         obj_conv.is_owned = ptr_is_owned(obj);
38497         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38498         obj_conv.is_owned = false;
38499         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
38500         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38501         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38502         CVec_u8Z_free(ret_var);
38503         return ret_arr;
38504 }
38505
38506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38507         LDKu8slice ser_ref;
38508         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38509         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38510         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
38511         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
38512         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38513         return tag_ptr(ret_conv, true);
38514 }
38515
38516 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
38517         LDKQueryChannelRange this_arg_conv;
38518         this_arg_conv.inner = untag_ptr(this_arg);
38519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38521         this_arg_conv.is_owned = false;
38522         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
38523         return ret_conv;
38524 }
38525
38526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
38527         LDKQueryChannelRange 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 = QueryChannelRange_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_QueryChannelRange_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_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
38544         *ret_conv = QueryChannelRange_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 int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38550         LDKu8slice ser_ref;
38551         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38552         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38553         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
38554         *ret_conv = ReplyChannelRange_read(ser_ref);
38555         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38556         return tag_ptr(ret_conv, true);
38557 }
38558
38559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
38560         LDKReplyChannelRange obj_conv;
38561         obj_conv.inner = untag_ptr(obj);
38562         obj_conv.is_owned = ptr_is_owned(obj);
38563         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38564         obj_conv.is_owned = false;
38565         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
38566         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38567         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38568         CVec_u8Z_free(ret_var);
38569         return ret_arr;
38570 }
38571
38572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
38573         LDKGossipTimestampFilter obj_conv;
38574         obj_conv.inner = untag_ptr(obj);
38575         obj_conv.is_owned = ptr_is_owned(obj);
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38577         obj_conv.is_owned = false;
38578         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
38579         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38580         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38581         CVec_u8Z_free(ret_var);
38582         return ret_arr;
38583 }
38584
38585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38586         LDKu8slice ser_ref;
38587         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38588         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38589         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
38590         *ret_conv = GossipTimestampFilter_read(ser_ref);
38591         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38592         return tag_ptr(ret_conv, true);
38593 }
38594
38595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38596         if (!ptr_is_owned(this_ptr)) return;
38597         void* this_ptr_ptr = untag_ptr(this_ptr);
38598         CHECK_ACCESS(this_ptr_ptr);
38599         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
38600         FREE(untag_ptr(this_ptr));
38601         CustomMessageHandler_free(this_ptr_conv);
38602 }
38603
38604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38605         LDKIgnoringMessageHandler this_obj_conv;
38606         this_obj_conv.inner = untag_ptr(this_obj);
38607         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38609         IgnoringMessageHandler_free(this_obj_conv);
38610 }
38611
38612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
38613         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
38614         int64_t ret_ref = 0;
38615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38617         return ret_ref;
38618 }
38619
38620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38621         LDKIgnoringMessageHandler this_arg_conv;
38622         this_arg_conv.inner = untag_ptr(this_arg);
38623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38625         this_arg_conv.is_owned = false;
38626         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38627         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
38628         return tag_ptr(ret_ret, true);
38629 }
38630
38631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38632         LDKIgnoringMessageHandler this_arg_conv;
38633         this_arg_conv.inner = untag_ptr(this_arg);
38634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38636         this_arg_conv.is_owned = false;
38637         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
38638         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
38639         return tag_ptr(ret_ret, true);
38640 }
38641
38642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38643         LDKIgnoringMessageHandler this_arg_conv;
38644         this_arg_conv.inner = untag_ptr(this_arg);
38645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38647         this_arg_conv.is_owned = false;
38648         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
38649         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
38650         return tag_ptr(ret_ret, true);
38651 }
38652
38653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38654         LDKIgnoringMessageHandler this_arg_conv;
38655         this_arg_conv.inner = untag_ptr(this_arg);
38656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38658         this_arg_conv.is_owned = false;
38659         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
38660         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
38661         return tag_ptr(ret_ret, true);
38662 }
38663
38664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
38665         LDKIgnoringMessageHandler this_arg_conv;
38666         this_arg_conv.inner = untag_ptr(this_arg);
38667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38669         this_arg_conv.is_owned = false;
38670         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
38671         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
38672         return tag_ptr(ret_ret, true);
38673 }
38674
38675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38676         LDKIgnoringMessageHandler this_arg_conv;
38677         this_arg_conv.inner = untag_ptr(this_arg);
38678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38680         this_arg_conv.is_owned = false;
38681         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
38682         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
38683         return tag_ptr(ret_ret, true);
38684 }
38685
38686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38687         LDKErroringMessageHandler this_obj_conv;
38688         this_obj_conv.inner = untag_ptr(this_obj);
38689         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38691         ErroringMessageHandler_free(this_obj_conv);
38692 }
38693
38694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
38695         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
38696         int64_t ret_ref = 0;
38697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38699         return ret_ref;
38700 }
38701
38702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38703         LDKErroringMessageHandler this_arg_conv;
38704         this_arg_conv.inner = untag_ptr(this_arg);
38705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38707         this_arg_conv.is_owned = false;
38708         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38709         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
38710         return tag_ptr(ret_ret, true);
38711 }
38712
38713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38714         LDKErroringMessageHandler this_arg_conv;
38715         this_arg_conv.inner = untag_ptr(this_arg);
38716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38718         this_arg_conv.is_owned = false;
38719         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
38720         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
38721         return tag_ptr(ret_ret, true);
38722 }
38723
38724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38725         LDKMessageHandler this_obj_conv;
38726         this_obj_conv.inner = untag_ptr(this_obj);
38727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38729         MessageHandler_free(this_obj_conv);
38730 }
38731
38732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
38733         LDKMessageHandler this_ptr_conv;
38734         this_ptr_conv.inner = untag_ptr(this_ptr);
38735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38737         this_ptr_conv.is_owned = false;
38738         // WARNING: This object doesn't live past this scope, needs clone!
38739         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
38740         return ret_ret;
38741 }
38742
38743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38744         LDKMessageHandler this_ptr_conv;
38745         this_ptr_conv.inner = untag_ptr(this_ptr);
38746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38748         this_ptr_conv.is_owned = false;
38749         void* val_ptr = untag_ptr(val);
38750         CHECK_ACCESS(val_ptr);
38751         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
38752         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
38753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38754                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
38755         }
38756         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
38757 }
38758
38759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
38760         LDKMessageHandler this_ptr_conv;
38761         this_ptr_conv.inner = untag_ptr(this_ptr);
38762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38764         this_ptr_conv.is_owned = false;
38765         // WARNING: This object doesn't live past this scope, needs clone!
38766         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
38767         return ret_ret;
38768 }
38769
38770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38771         LDKMessageHandler this_ptr_conv;
38772         this_ptr_conv.inner = untag_ptr(this_ptr);
38773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38775         this_ptr_conv.is_owned = false;
38776         void* val_ptr = untag_ptr(val);
38777         CHECK_ACCESS(val_ptr);
38778         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
38779         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
38780                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38781                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
38782         }
38783         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
38784 }
38785
38786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
38787         LDKMessageHandler this_ptr_conv;
38788         this_ptr_conv.inner = untag_ptr(this_ptr);
38789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38791         this_ptr_conv.is_owned = false;
38792         // WARNING: This object doesn't live past this scope, needs clone!
38793         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
38794         return ret_ret;
38795 }
38796
38797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38798         LDKMessageHandler this_ptr_conv;
38799         this_ptr_conv.inner = untag_ptr(this_ptr);
38800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38802         this_ptr_conv.is_owned = false;
38803         void* val_ptr = untag_ptr(val);
38804         CHECK_ACCESS(val_ptr);
38805         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
38806         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
38807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38808                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
38809         }
38810         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
38811 }
38812
38813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv *env, jclass clz, int64_t chan_handler_arg, int64_t route_handler_arg, int64_t onion_message_handler_arg) {
38814         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
38815         CHECK_ACCESS(chan_handler_arg_ptr);
38816         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
38817         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
38818                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38819                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
38820         }
38821         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
38822         CHECK_ACCESS(route_handler_arg_ptr);
38823         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
38824         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
38825                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38826                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
38827         }
38828         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
38829         CHECK_ACCESS(onion_message_handler_arg_ptr);
38830         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
38831         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
38832                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38833                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
38834         }
38835         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
38836         int64_t ret_ref = 0;
38837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38839         return ret_ref;
38840 }
38841
38842 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
38843         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
38844         *ret_ret = SocketDescriptor_clone(arg);
38845         return tag_ptr(ret_ret, true);
38846 }
38847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38848         void* arg_ptr = untag_ptr(arg);
38849         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
38850         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
38851         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
38852         return ret_conv;
38853 }
38854
38855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38856         void* orig_ptr = untag_ptr(orig);
38857         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
38858         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
38859         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
38860         *ret_ret = SocketDescriptor_clone(orig_conv);
38861         return tag_ptr(ret_ret, true);
38862 }
38863
38864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
38865         if (!ptr_is_owned(this_ptr)) return;
38866         void* this_ptr_ptr = untag_ptr(this_ptr);
38867         CHECK_ACCESS(this_ptr_ptr);
38868         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
38869         FREE(untag_ptr(this_ptr));
38870         SocketDescriptor_free(this_ptr_conv);
38871 }
38872
38873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38874         LDKPeerHandleError this_obj_conv;
38875         this_obj_conv.inner = untag_ptr(this_obj);
38876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38878         PeerHandleError_free(this_obj_conv);
38879 }
38880
38881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
38882         LDKPeerHandleError this_ptr_conv;
38883         this_ptr_conv.inner = untag_ptr(this_ptr);
38884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38886         this_ptr_conv.is_owned = false;
38887         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
38888         return ret_conv;
38889 }
38890
38891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38892         LDKPeerHandleError this_ptr_conv;
38893         this_ptr_conv.inner = untag_ptr(this_ptr);
38894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38896         this_ptr_conv.is_owned = false;
38897         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
38898 }
38899
38900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
38901         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
38902         int64_t ret_ref = 0;
38903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38905         return ret_ref;
38906 }
38907
38908 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
38909         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
38910         int64_t ret_ref = 0;
38911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38913         return ret_ref;
38914 }
38915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38916         LDKPeerHandleError arg_conv;
38917         arg_conv.inner = untag_ptr(arg);
38918         arg_conv.is_owned = ptr_is_owned(arg);
38919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38920         arg_conv.is_owned = false;
38921         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
38922         return ret_conv;
38923 }
38924
38925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38926         LDKPeerHandleError orig_conv;
38927         orig_conv.inner = untag_ptr(orig);
38928         orig_conv.is_owned = ptr_is_owned(orig);
38929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38930         orig_conv.is_owned = false;
38931         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
38932         int64_t ret_ref = 0;
38933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38935         return ret_ref;
38936 }
38937
38938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38939         LDKPeerManager this_obj_conv;
38940         this_obj_conv.inner = untag_ptr(this_obj);
38941         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38943         PeerManager_free(this_obj_conv);
38944 }
38945
38946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int64_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
38947         LDKMessageHandler message_handler_conv;
38948         message_handler_conv.inner = untag_ptr(message_handler);
38949         message_handler_conv.is_owned = ptr_is_owned(message_handler);
38950         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
38951         // WARNING: we need a move here but no clone is available for LDKMessageHandler
38952         
38953         LDKSecretKey our_node_secret_ref;
38954         CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
38955         (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
38956         unsigned char ephemeral_random_data_arr[32];
38957         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
38958         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
38959         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
38960         void* logger_ptr = untag_ptr(logger);
38961         CHECK_ACCESS(logger_ptr);
38962         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
38963         if (logger_conv.free == LDKLogger_JCalls_free) {
38964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38965                 LDKLogger_JCalls_cloned(&logger_conv);
38966         }
38967         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
38968         CHECK_ACCESS(custom_message_handler_ptr);
38969         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
38970         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
38971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38972                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
38973         }
38974         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
38975         int64_t ret_ref = 0;
38976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38978         return ret_ref;
38979 }
38980
38981 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
38982         LDKPeerManager this_arg_conv;
38983         this_arg_conv.inner = untag_ptr(this_arg);
38984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38986         this_arg_conv.is_owned = false;
38987         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
38988         jobjectArray ret_arr = NULL;
38989         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38990         ;
38991         for (size_t i = 0; i < ret_var.datalen; i++) {
38992                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
38993                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
38994                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38995         }
38996         
38997         FREE(ret_var.data);
38998         return ret_arr;
38999 }
39000
39001 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) {
39002         LDKPeerManager this_arg_conv;
39003         this_arg_conv.inner = untag_ptr(this_arg);
39004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39006         this_arg_conv.is_owned = false;
39007         LDKPublicKey their_node_id_ref;
39008         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
39009         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
39010         void* descriptor_ptr = untag_ptr(descriptor);
39011         CHECK_ACCESS(descriptor_ptr);
39012         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
39013         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
39014                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39015                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
39016         }
39017         void* remote_network_address_ptr = untag_ptr(remote_network_address);
39018         CHECK_ACCESS(remote_network_address_ptr);
39019         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
39020         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
39021         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
39022         return tag_ptr(ret_conv, true);
39023 }
39024
39025 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) {
39026         LDKPeerManager this_arg_conv;
39027         this_arg_conv.inner = untag_ptr(this_arg);
39028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39030         this_arg_conv.is_owned = false;
39031         void* descriptor_ptr = untag_ptr(descriptor);
39032         CHECK_ACCESS(descriptor_ptr);
39033         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
39034         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
39035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39036                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
39037         }
39038         void* remote_network_address_ptr = untag_ptr(remote_network_address);
39039         CHECK_ACCESS(remote_network_address_ptr);
39040         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
39041         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
39042         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
39043         return tag_ptr(ret_conv, true);
39044 }
39045
39046 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) {
39047         LDKPeerManager this_arg_conv;
39048         this_arg_conv.inner = untag_ptr(this_arg);
39049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39051         this_arg_conv.is_owned = false;
39052         void* descriptor_ptr = untag_ptr(descriptor);
39053         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
39054         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
39055         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
39056         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
39057         return tag_ptr(ret_conv, true);
39058 }
39059
39060 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) {
39061         LDKPeerManager this_arg_conv;
39062         this_arg_conv.inner = untag_ptr(this_arg);
39063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39065         this_arg_conv.is_owned = false;
39066         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
39067         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
39068         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
39069         LDKu8slice data_ref;
39070         data_ref.datalen = (*env)->GetArrayLength(env, data);
39071         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
39072         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
39073         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
39074         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
39075         return tag_ptr(ret_conv, true);
39076 }
39077
39078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
39079         LDKPeerManager this_arg_conv;
39080         this_arg_conv.inner = untag_ptr(this_arg);
39081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39083         this_arg_conv.is_owned = false;
39084         PeerManager_process_events(&this_arg_conv);
39085 }
39086
39087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
39088         LDKPeerManager this_arg_conv;
39089         this_arg_conv.inner = untag_ptr(this_arg);
39090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39092         this_arg_conv.is_owned = false;
39093         void* descriptor_ptr = untag_ptr(descriptor);
39094         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
39095         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
39096         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
39097 }
39098
39099 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) {
39100         LDKPeerManager this_arg_conv;
39101         this_arg_conv.inner = untag_ptr(this_arg);
39102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39104         this_arg_conv.is_owned = false;
39105         LDKPublicKey node_id_ref;
39106         CHECK((*env)->GetArrayLength(env, node_id) == 33);
39107         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
39108         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
39109 }
39110
39111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
39112         LDKPeerManager this_arg_conv;
39113         this_arg_conv.inner = untag_ptr(this_arg);
39114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39116         this_arg_conv.is_owned = false;
39117         PeerManager_disconnect_all_peers(&this_arg_conv);
39118 }
39119
39120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
39121         LDKPeerManager this_arg_conv;
39122         this_arg_conv.inner = untag_ptr(this_arg);
39123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39125         this_arg_conv.is_owned = false;
39126         PeerManager_timer_tick_occurred(&this_arg_conv);
39127 }
39128
39129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
39130         LDKPeerManager this_arg_conv;
39131         this_arg_conv.inner = untag_ptr(this_arg);
39132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39134         this_arg_conv.is_owned = false;
39135         LDKThreeBytes rgb_ref;
39136         CHECK((*env)->GetArrayLength(env, rgb) == 3);
39137         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
39138         LDKThirtyTwoBytes alias_ref;
39139         CHECK((*env)->GetArrayLength(env, alias) == 32);
39140         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
39141         LDKCVec_NetAddressZ addresses_constr;
39142         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
39143         if (addresses_constr.datalen > 0)
39144                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
39145         else
39146                 addresses_constr.data = NULL;
39147         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
39148         for (size_t m = 0; m < addresses_constr.datalen; m++) {
39149                 int64_t addresses_conv_12 = addresses_vals[m];
39150                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
39151                 CHECK_ACCESS(addresses_conv_12_ptr);
39152                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
39153                 addresses_constr.data[m] = addresses_conv_12_conv;
39154         }
39155         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
39156         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
39157 }
39158
39159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
39160         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
39161         return ret_conv;
39162 }
39163
39164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
39165         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
39166         return ret_conv;
39167 }
39168
39169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
39170         unsigned char commitment_seed_arr[32];
39171         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
39172         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
39173         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
39174         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39175         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
39176         return ret_arr;
39177 }
39178
39179 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) {
39180         LDKCVec_u8Z to_holder_script_ref;
39181         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
39182         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39183         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
39184         LDKCVec_u8Z to_counterparty_script_ref;
39185         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
39186         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39187         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
39188         LDKOutPoint funding_outpoint_conv;
39189         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39190         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39191         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39192         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39193         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);
39194         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39195         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39196         Transaction_free(ret_var);
39197         return ret_arr;
39198 }
39199
39200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39201         LDKCounterpartyCommitmentSecrets this_obj_conv;
39202         this_obj_conv.inner = untag_ptr(this_obj);
39203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39205         CounterpartyCommitmentSecrets_free(this_obj_conv);
39206 }
39207
39208 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
39209         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
39210         int64_t ret_ref = 0;
39211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39213         return ret_ref;
39214 }
39215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39216         LDKCounterpartyCommitmentSecrets arg_conv;
39217         arg_conv.inner = untag_ptr(arg);
39218         arg_conv.is_owned = ptr_is_owned(arg);
39219         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39220         arg_conv.is_owned = false;
39221         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
39222         return ret_conv;
39223 }
39224
39225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39226         LDKCounterpartyCommitmentSecrets orig_conv;
39227         orig_conv.inner = untag_ptr(orig);
39228         orig_conv.is_owned = ptr_is_owned(orig);
39229         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39230         orig_conv.is_owned = false;
39231         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
39232         int64_t ret_ref = 0;
39233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39235         return ret_ref;
39236 }
39237
39238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
39239         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
39240         int64_t ret_ref = 0;
39241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39243         return ret_ref;
39244 }
39245
39246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
39247         LDKCounterpartyCommitmentSecrets this_arg_conv;
39248         this_arg_conv.inner = untag_ptr(this_arg);
39249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39251         this_arg_conv.is_owned = false;
39252         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
39253         return ret_conv;
39254 }
39255
39256 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) {
39257         LDKCounterpartyCommitmentSecrets this_arg_conv;
39258         this_arg_conv.inner = untag_ptr(this_arg);
39259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39261         this_arg_conv.is_owned = false;
39262         LDKThirtyTwoBytes secret_ref;
39263         CHECK((*env)->GetArrayLength(env, secret) == 32);
39264         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
39265         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
39266         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
39267         return tag_ptr(ret_conv, true);
39268 }
39269
39270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
39271         LDKCounterpartyCommitmentSecrets this_arg_conv;
39272         this_arg_conv.inner = untag_ptr(this_arg);
39273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39275         this_arg_conv.is_owned = false;
39276         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39277         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
39278         return ret_arr;
39279 }
39280
39281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
39282         LDKCounterpartyCommitmentSecrets obj_conv;
39283         obj_conv.inner = untag_ptr(obj);
39284         obj_conv.is_owned = ptr_is_owned(obj);
39285         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39286         obj_conv.is_owned = false;
39287         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
39288         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39289         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39290         CVec_u8Z_free(ret_var);
39291         return ret_arr;
39292 }
39293
39294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39295         LDKu8slice ser_ref;
39296         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39297         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39298         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
39299         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
39300         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39301         return tag_ptr(ret_conv, true);
39302 }
39303
39304 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) {
39305         LDKPublicKey per_commitment_point_ref;
39306         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39307         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39308         unsigned char base_secret_arr[32];
39309         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
39310         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
39311         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
39312         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
39313         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
39314         return tag_ptr(ret_conv, true);
39315 }
39316
39317 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) {
39318         LDKPublicKey per_commitment_point_ref;
39319         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39320         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39321         LDKPublicKey base_point_ref;
39322         CHECK((*env)->GetArrayLength(env, base_point) == 33);
39323         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
39324         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
39325         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
39326         return tag_ptr(ret_conv, true);
39327 }
39328
39329 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) {
39330         unsigned char per_commitment_secret_arr[32];
39331         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
39332         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
39333         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
39334         unsigned char countersignatory_revocation_base_secret_arr[32];
39335         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
39336         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
39337         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
39338         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
39339         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
39340         return tag_ptr(ret_conv, true);
39341 }
39342
39343 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) {
39344         LDKPublicKey per_commitment_point_ref;
39345         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39346         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39347         LDKPublicKey countersignatory_revocation_base_point_ref;
39348         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
39349         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
39350         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
39351         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
39352         return tag_ptr(ret_conv, true);
39353 }
39354
39355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39356         LDKTxCreationKeys this_obj_conv;
39357         this_obj_conv.inner = untag_ptr(this_obj);
39358         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39360         TxCreationKeys_free(this_obj_conv);
39361 }
39362
39363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
39364         LDKTxCreationKeys this_ptr_conv;
39365         this_ptr_conv.inner = untag_ptr(this_ptr);
39366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39368         this_ptr_conv.is_owned = false;
39369         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39370         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
39371         return ret_arr;
39372 }
39373
39374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39375         LDKTxCreationKeys this_ptr_conv;
39376         this_ptr_conv.inner = untag_ptr(this_ptr);
39377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39379         this_ptr_conv.is_owned = false;
39380         LDKPublicKey val_ref;
39381         CHECK((*env)->GetArrayLength(env, val) == 33);
39382         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39383         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
39384 }
39385
39386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
39387         LDKTxCreationKeys this_ptr_conv;
39388         this_ptr_conv.inner = untag_ptr(this_ptr);
39389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39391         this_ptr_conv.is_owned = false;
39392         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39393         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
39394         return ret_arr;
39395 }
39396
39397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39398         LDKTxCreationKeys this_ptr_conv;
39399         this_ptr_conv.inner = untag_ptr(this_ptr);
39400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39402         this_ptr_conv.is_owned = false;
39403         LDKPublicKey val_ref;
39404         CHECK((*env)->GetArrayLength(env, val) == 33);
39405         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39406         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
39407 }
39408
39409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
39410         LDKTxCreationKeys this_ptr_conv;
39411         this_ptr_conv.inner = untag_ptr(this_ptr);
39412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39414         this_ptr_conv.is_owned = false;
39415         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39416         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
39417         return ret_arr;
39418 }
39419
39420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39421         LDKTxCreationKeys this_ptr_conv;
39422         this_ptr_conv.inner = untag_ptr(this_ptr);
39423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39425         this_ptr_conv.is_owned = false;
39426         LDKPublicKey val_ref;
39427         CHECK((*env)->GetArrayLength(env, val) == 33);
39428         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39429         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
39430 }
39431
39432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
39433         LDKTxCreationKeys this_ptr_conv;
39434         this_ptr_conv.inner = untag_ptr(this_ptr);
39435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39437         this_ptr_conv.is_owned = false;
39438         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39439         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
39440         return ret_arr;
39441 }
39442
39443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39444         LDKTxCreationKeys this_ptr_conv;
39445         this_ptr_conv.inner = untag_ptr(this_ptr);
39446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39448         this_ptr_conv.is_owned = false;
39449         LDKPublicKey val_ref;
39450         CHECK((*env)->GetArrayLength(env, val) == 33);
39451         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39452         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
39453 }
39454
39455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
39456         LDKTxCreationKeys this_ptr_conv;
39457         this_ptr_conv.inner = untag_ptr(this_ptr);
39458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39460         this_ptr_conv.is_owned = false;
39461         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39462         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
39463         return ret_arr;
39464 }
39465
39466 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) {
39467         LDKTxCreationKeys this_ptr_conv;
39468         this_ptr_conv.inner = untag_ptr(this_ptr);
39469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39471         this_ptr_conv.is_owned = false;
39472         LDKPublicKey val_ref;
39473         CHECK((*env)->GetArrayLength(env, val) == 33);
39474         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39475         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
39476 }
39477
39478 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) {
39479         LDKPublicKey per_commitment_point_arg_ref;
39480         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
39481         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
39482         LDKPublicKey revocation_key_arg_ref;
39483         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
39484         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
39485         LDKPublicKey broadcaster_htlc_key_arg_ref;
39486         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
39487         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
39488         LDKPublicKey countersignatory_htlc_key_arg_ref;
39489         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
39490         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
39491         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
39492         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
39493         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
39494         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);
39495         int64_t ret_ref = 0;
39496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39498         return ret_ref;
39499 }
39500
39501 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
39502         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
39503         int64_t ret_ref = 0;
39504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39506         return ret_ref;
39507 }
39508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39509         LDKTxCreationKeys arg_conv;
39510         arg_conv.inner = untag_ptr(arg);
39511         arg_conv.is_owned = ptr_is_owned(arg);
39512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39513         arg_conv.is_owned = false;
39514         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
39515         return ret_conv;
39516 }
39517
39518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39519         LDKTxCreationKeys orig_conv;
39520         orig_conv.inner = untag_ptr(orig);
39521         orig_conv.is_owned = ptr_is_owned(orig);
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39523         orig_conv.is_owned = false;
39524         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
39525         int64_t ret_ref = 0;
39526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39528         return ret_ref;
39529 }
39530
39531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
39532         LDKTxCreationKeys obj_conv;
39533         obj_conv.inner = untag_ptr(obj);
39534         obj_conv.is_owned = ptr_is_owned(obj);
39535         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39536         obj_conv.is_owned = false;
39537         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
39538         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39539         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39540         CVec_u8Z_free(ret_var);
39541         return ret_arr;
39542 }
39543
39544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39545         LDKu8slice ser_ref;
39546         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39547         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39548         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
39549         *ret_conv = TxCreationKeys_read(ser_ref);
39550         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39551         return tag_ptr(ret_conv, true);
39552 }
39553
39554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39555         LDKChannelPublicKeys this_obj_conv;
39556         this_obj_conv.inner = untag_ptr(this_obj);
39557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39559         ChannelPublicKeys_free(this_obj_conv);
39560 }
39561
39562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39563         LDKChannelPublicKeys this_ptr_conv;
39564         this_ptr_conv.inner = untag_ptr(this_ptr);
39565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39567         this_ptr_conv.is_owned = false;
39568         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39569         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
39570         return ret_arr;
39571 }
39572
39573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39574         LDKChannelPublicKeys this_ptr_conv;
39575         this_ptr_conv.inner = untag_ptr(this_ptr);
39576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39578         this_ptr_conv.is_owned = false;
39579         LDKPublicKey val_ref;
39580         CHECK((*env)->GetArrayLength(env, val) == 33);
39581         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39582         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
39583 }
39584
39585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39586         LDKChannelPublicKeys this_ptr_conv;
39587         this_ptr_conv.inner = untag_ptr(this_ptr);
39588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39590         this_ptr_conv.is_owned = false;
39591         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39592         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
39593         return ret_arr;
39594 }
39595
39596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39597         LDKChannelPublicKeys this_ptr_conv;
39598         this_ptr_conv.inner = untag_ptr(this_ptr);
39599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39601         this_ptr_conv.is_owned = false;
39602         LDKPublicKey val_ref;
39603         CHECK((*env)->GetArrayLength(env, val) == 33);
39604         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39605         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
39606 }
39607
39608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
39609         LDKChannelPublicKeys this_ptr_conv;
39610         this_ptr_conv.inner = untag_ptr(this_ptr);
39611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39613         this_ptr_conv.is_owned = false;
39614         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39615         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
39616         return ret_arr;
39617 }
39618
39619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39620         LDKChannelPublicKeys this_ptr_conv;
39621         this_ptr_conv.inner = untag_ptr(this_ptr);
39622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39624         this_ptr_conv.is_owned = false;
39625         LDKPublicKey val_ref;
39626         CHECK((*env)->GetArrayLength(env, val) == 33);
39627         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39628         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
39629 }
39630
39631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39632         LDKChannelPublicKeys this_ptr_conv;
39633         this_ptr_conv.inner = untag_ptr(this_ptr);
39634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39636         this_ptr_conv.is_owned = false;
39637         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39638         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
39639         return ret_arr;
39640 }
39641
39642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39643         LDKChannelPublicKeys this_ptr_conv;
39644         this_ptr_conv.inner = untag_ptr(this_ptr);
39645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39647         this_ptr_conv.is_owned = false;
39648         LDKPublicKey val_ref;
39649         CHECK((*env)->GetArrayLength(env, val) == 33);
39650         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39651         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
39652 }
39653
39654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
39655         LDKChannelPublicKeys this_ptr_conv;
39656         this_ptr_conv.inner = untag_ptr(this_ptr);
39657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39659         this_ptr_conv.is_owned = false;
39660         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39661         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
39662         return ret_arr;
39663 }
39664
39665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39666         LDKChannelPublicKeys this_ptr_conv;
39667         this_ptr_conv.inner = untag_ptr(this_ptr);
39668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39670         this_ptr_conv.is_owned = false;
39671         LDKPublicKey val_ref;
39672         CHECK((*env)->GetArrayLength(env, val) == 33);
39673         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39674         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
39675 }
39676
39677 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) {
39678         LDKPublicKey funding_pubkey_arg_ref;
39679         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
39680         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
39681         LDKPublicKey revocation_basepoint_arg_ref;
39682         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
39683         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
39684         LDKPublicKey payment_point_arg_ref;
39685         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
39686         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
39687         LDKPublicKey delayed_payment_basepoint_arg_ref;
39688         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
39689         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
39690         LDKPublicKey htlc_basepoint_arg_ref;
39691         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
39692         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
39693         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);
39694         int64_t ret_ref = 0;
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39697         return ret_ref;
39698 }
39699
39700 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
39701         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
39702         int64_t ret_ref = 0;
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39705         return ret_ref;
39706 }
39707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39708         LDKChannelPublicKeys arg_conv;
39709         arg_conv.inner = untag_ptr(arg);
39710         arg_conv.is_owned = ptr_is_owned(arg);
39711         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39712         arg_conv.is_owned = false;
39713         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
39714         return ret_conv;
39715 }
39716
39717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39718         LDKChannelPublicKeys orig_conv;
39719         orig_conv.inner = untag_ptr(orig);
39720         orig_conv.is_owned = ptr_is_owned(orig);
39721         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39722         orig_conv.is_owned = false;
39723         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
39724         int64_t ret_ref = 0;
39725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39727         return ret_ref;
39728 }
39729
39730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
39731         LDKChannelPublicKeys obj_conv;
39732         obj_conv.inner = untag_ptr(obj);
39733         obj_conv.is_owned = ptr_is_owned(obj);
39734         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39735         obj_conv.is_owned = false;
39736         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
39737         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39738         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39739         CVec_u8Z_free(ret_var);
39740         return ret_arr;
39741 }
39742
39743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39744         LDKu8slice ser_ref;
39745         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39746         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39747         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
39748         *ret_conv = ChannelPublicKeys_read(ser_ref);
39749         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39750         return tag_ptr(ret_conv, true);
39751 }
39752
39753 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) {
39754         LDKPublicKey per_commitment_point_ref;
39755         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39756         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39757         LDKPublicKey broadcaster_delayed_payment_base_ref;
39758         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
39759         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
39760         LDKPublicKey broadcaster_htlc_base_ref;
39761         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
39762         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
39763         LDKPublicKey countersignatory_revocation_base_ref;
39764         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
39765         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
39766         LDKPublicKey countersignatory_htlc_base_ref;
39767         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
39768         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
39769         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
39770         *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);
39771         return tag_ptr(ret_conv, true);
39772 }
39773
39774 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) {
39775         LDKPublicKey per_commitment_point_ref;
39776         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
39777         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
39778         LDKChannelPublicKeys broadcaster_keys_conv;
39779         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39780         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39781         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39782         broadcaster_keys_conv.is_owned = false;
39783         LDKChannelPublicKeys countersignatory_keys_conv;
39784         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39785         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39786         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39787         countersignatory_keys_conv.is_owned = false;
39788         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
39789         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
39790         return tag_ptr(ret_conv, true);
39791 }
39792
39793 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) {
39794         LDKPublicKey revocation_key_ref;
39795         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
39796         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
39797         LDKPublicKey broadcaster_delayed_payment_key_ref;
39798         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
39799         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
39800         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
39801         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39802         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39803         CVec_u8Z_free(ret_var);
39804         return ret_arr;
39805 }
39806
39807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39808         LDKHTLCOutputInCommitment this_obj_conv;
39809         this_obj_conv.inner = untag_ptr(this_obj);
39810         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39812         HTLCOutputInCommitment_free(this_obj_conv);
39813 }
39814
39815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
39816         LDKHTLCOutputInCommitment this_ptr_conv;
39817         this_ptr_conv.inner = untag_ptr(this_ptr);
39818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39820         this_ptr_conv.is_owned = false;
39821         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
39822         return ret_conv;
39823 }
39824
39825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39826         LDKHTLCOutputInCommitment this_ptr_conv;
39827         this_ptr_conv.inner = untag_ptr(this_ptr);
39828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39830         this_ptr_conv.is_owned = false;
39831         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
39832 }
39833
39834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39835         LDKHTLCOutputInCommitment this_ptr_conv;
39836         this_ptr_conv.inner = untag_ptr(this_ptr);
39837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39839         this_ptr_conv.is_owned = false;
39840         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
39841         return ret_conv;
39842 }
39843
39844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39845         LDKHTLCOutputInCommitment this_ptr_conv;
39846         this_ptr_conv.inner = untag_ptr(this_ptr);
39847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39849         this_ptr_conv.is_owned = false;
39850         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
39851 }
39852
39853 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
39854         LDKHTLCOutputInCommitment this_ptr_conv;
39855         this_ptr_conv.inner = untag_ptr(this_ptr);
39856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39858         this_ptr_conv.is_owned = false;
39859         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
39860         return ret_conv;
39861 }
39862
39863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39864         LDKHTLCOutputInCommitment this_ptr_conv;
39865         this_ptr_conv.inner = untag_ptr(this_ptr);
39866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39868         this_ptr_conv.is_owned = false;
39869         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
39870 }
39871
39872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
39873         LDKHTLCOutputInCommitment this_ptr_conv;
39874         this_ptr_conv.inner = untag_ptr(this_ptr);
39875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39877         this_ptr_conv.is_owned = false;
39878         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39879         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
39880         return ret_arr;
39881 }
39882
39883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39884         LDKHTLCOutputInCommitment this_ptr_conv;
39885         this_ptr_conv.inner = untag_ptr(this_ptr);
39886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39888         this_ptr_conv.is_owned = false;
39889         LDKThirtyTwoBytes val_ref;
39890         CHECK((*env)->GetArrayLength(env, val) == 32);
39891         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39892         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
39893 }
39894
39895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
39896         LDKHTLCOutputInCommitment this_ptr_conv;
39897         this_ptr_conv.inner = untag_ptr(this_ptr);
39898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39900         this_ptr_conv.is_owned = false;
39901         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
39902         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
39903         int64_t ret_ref = tag_ptr(ret_copy, true);
39904         return ret_ref;
39905 }
39906
39907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39908         LDKHTLCOutputInCommitment this_ptr_conv;
39909         this_ptr_conv.inner = untag_ptr(this_ptr);
39910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39912         this_ptr_conv.is_owned = false;
39913         void* val_ptr = untag_ptr(val);
39914         CHECK_ACCESS(val_ptr);
39915         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
39916         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
39917         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
39918 }
39919
39920 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) {
39921         LDKThirtyTwoBytes payment_hash_arg_ref;
39922         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
39923         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
39924         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
39925         CHECK_ACCESS(transaction_output_index_arg_ptr);
39926         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
39927         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
39928         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
39929         int64_t ret_ref = 0;
39930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39932         return ret_ref;
39933 }
39934
39935 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
39936         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
39937         int64_t ret_ref = 0;
39938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39940         return ret_ref;
39941 }
39942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39943         LDKHTLCOutputInCommitment arg_conv;
39944         arg_conv.inner = untag_ptr(arg);
39945         arg_conv.is_owned = ptr_is_owned(arg);
39946         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39947         arg_conv.is_owned = false;
39948         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
39949         return ret_conv;
39950 }
39951
39952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39953         LDKHTLCOutputInCommitment orig_conv;
39954         orig_conv.inner = untag_ptr(orig);
39955         orig_conv.is_owned = ptr_is_owned(orig);
39956         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39957         orig_conv.is_owned = false;
39958         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
39959         int64_t ret_ref = 0;
39960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39962         return ret_ref;
39963 }
39964
39965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
39966         LDKHTLCOutputInCommitment obj_conv;
39967         obj_conv.inner = untag_ptr(obj);
39968         obj_conv.is_owned = ptr_is_owned(obj);
39969         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39970         obj_conv.is_owned = false;
39971         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
39972         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39973         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39974         CVec_u8Z_free(ret_var);
39975         return ret_arr;
39976 }
39977
39978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39979         LDKu8slice ser_ref;
39980         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39981         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39982         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
39983         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
39984         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39985         return tag_ptr(ret_conv, true);
39986 }
39987
39988 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) {
39989         LDKHTLCOutputInCommitment htlc_conv;
39990         htlc_conv.inner = untag_ptr(htlc);
39991         htlc_conv.is_owned = ptr_is_owned(htlc);
39992         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
39993         htlc_conv.is_owned = false;
39994         LDKTxCreationKeys keys_conv;
39995         keys_conv.inner = untag_ptr(keys);
39996         keys_conv.is_owned = ptr_is_owned(keys);
39997         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
39998         keys_conv.is_owned = false;
39999         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
40000         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40001         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40002         CVec_u8Z_free(ret_var);
40003         return ret_arr;
40004 }
40005
40006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
40007         LDKPublicKey broadcaster_ref;
40008         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
40009         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
40010         LDKPublicKey countersignatory_ref;
40011         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
40012         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
40013         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
40014         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40015         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40016         CVec_u8Z_free(ret_var);
40017         return ret_arr;
40018 }
40019
40020 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) {
40021         unsigned char commitment_txid_arr[32];
40022         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
40023         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
40024         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
40025         LDKHTLCOutputInCommitment htlc_conv;
40026         htlc_conv.inner = untag_ptr(htlc);
40027         htlc_conv.is_owned = ptr_is_owned(htlc);
40028         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
40029         htlc_conv.is_owned = false;
40030         LDKPublicKey broadcaster_delayed_payment_key_ref;
40031         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
40032         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
40033         LDKPublicKey revocation_key_ref;
40034         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
40035         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
40036         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);
40037         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40038         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40039         Transaction_free(ret_var);
40040         return ret_arr;
40041 }
40042
40043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
40044         LDKPublicKey funding_pubkey_ref;
40045         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
40046         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
40047         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
40048         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40049         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40050         CVec_u8Z_free(ret_var);
40051         return ret_arr;
40052 }
40053
40054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40055         LDKChannelTransactionParameters this_obj_conv;
40056         this_obj_conv.inner = untag_ptr(this_obj);
40057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40059         ChannelTransactionParameters_free(this_obj_conv);
40060 }
40061
40062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
40063         LDKChannelTransactionParameters this_ptr_conv;
40064         this_ptr_conv.inner = untag_ptr(this_ptr);
40065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40067         this_ptr_conv.is_owned = false;
40068         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
40069         int64_t ret_ref = 0;
40070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40072         return ret_ref;
40073 }
40074
40075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40076         LDKChannelTransactionParameters this_ptr_conv;
40077         this_ptr_conv.inner = untag_ptr(this_ptr);
40078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40080         this_ptr_conv.is_owned = false;
40081         LDKChannelPublicKeys val_conv;
40082         val_conv.inner = untag_ptr(val);
40083         val_conv.is_owned = ptr_is_owned(val);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40085         val_conv = ChannelPublicKeys_clone(&val_conv);
40086         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
40087 }
40088
40089 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
40090         LDKChannelTransactionParameters this_ptr_conv;
40091         this_ptr_conv.inner = untag_ptr(this_ptr);
40092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40094         this_ptr_conv.is_owned = false;
40095         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
40096         return ret_conv;
40097 }
40098
40099 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) {
40100         LDKChannelTransactionParameters this_ptr_conv;
40101         this_ptr_conv.inner = untag_ptr(this_ptr);
40102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40104         this_ptr_conv.is_owned = false;
40105         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
40106 }
40107
40108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
40109         LDKChannelTransactionParameters this_ptr_conv;
40110         this_ptr_conv.inner = untag_ptr(this_ptr);
40111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40113         this_ptr_conv.is_owned = false;
40114         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
40115         return ret_conv;
40116 }
40117
40118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40119         LDKChannelTransactionParameters this_ptr_conv;
40120         this_ptr_conv.inner = untag_ptr(this_ptr);
40121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40123         this_ptr_conv.is_owned = false;
40124         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
40125 }
40126
40127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
40128         LDKChannelTransactionParameters this_ptr_conv;
40129         this_ptr_conv.inner = untag_ptr(this_ptr);
40130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40132         this_ptr_conv.is_owned = false;
40133         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
40134         int64_t ret_ref = 0;
40135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40137         return ret_ref;
40138 }
40139
40140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40141         LDKChannelTransactionParameters this_ptr_conv;
40142         this_ptr_conv.inner = untag_ptr(this_ptr);
40143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40145         this_ptr_conv.is_owned = false;
40146         LDKCounterpartyChannelTransactionParameters val_conv;
40147         val_conv.inner = untag_ptr(val);
40148         val_conv.is_owned = ptr_is_owned(val);
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40150         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
40151         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
40152 }
40153
40154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40155         LDKChannelTransactionParameters this_ptr_conv;
40156         this_ptr_conv.inner = untag_ptr(this_ptr);
40157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40159         this_ptr_conv.is_owned = false;
40160         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
40161         int64_t ret_ref = 0;
40162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40164         return ret_ref;
40165 }
40166
40167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40168         LDKChannelTransactionParameters this_ptr_conv;
40169         this_ptr_conv.inner = untag_ptr(this_ptr);
40170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40172         this_ptr_conv.is_owned = false;
40173         LDKOutPoint val_conv;
40174         val_conv.inner = untag_ptr(val);
40175         val_conv.is_owned = ptr_is_owned(val);
40176         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40177         val_conv = OutPoint_clone(&val_conv);
40178         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
40179 }
40180
40181 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
40182         LDKChannelTransactionParameters this_ptr_conv;
40183         this_ptr_conv.inner = untag_ptr(this_ptr);
40184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40186         this_ptr_conv.is_owned = false;
40187         jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
40188         return ret_conv;
40189 }
40190
40191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
40192         LDKChannelTransactionParameters this_ptr_conv;
40193         this_ptr_conv.inner = untag_ptr(this_ptr);
40194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40196         this_ptr_conv.is_owned = false;
40197         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
40198         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
40199 }
40200
40201 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) {
40202         LDKChannelPublicKeys holder_pubkeys_arg_conv;
40203         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
40204         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
40205         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
40206         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
40207         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
40208         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
40209         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
40210         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
40211         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
40212         LDKOutPoint funding_outpoint_arg_conv;
40213         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
40214         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
40215         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
40216         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
40217         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
40218         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);
40219         int64_t ret_ref = 0;
40220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40222         return ret_ref;
40223 }
40224
40225 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
40226         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
40227         int64_t ret_ref = 0;
40228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40230         return ret_ref;
40231 }
40232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40233         LDKChannelTransactionParameters arg_conv;
40234         arg_conv.inner = untag_ptr(arg);
40235         arg_conv.is_owned = ptr_is_owned(arg);
40236         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40237         arg_conv.is_owned = false;
40238         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
40239         return ret_conv;
40240 }
40241
40242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40243         LDKChannelTransactionParameters orig_conv;
40244         orig_conv.inner = untag_ptr(orig);
40245         orig_conv.is_owned = ptr_is_owned(orig);
40246         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40247         orig_conv.is_owned = false;
40248         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
40249         int64_t ret_ref = 0;
40250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40252         return ret_ref;
40253 }
40254
40255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40256         LDKCounterpartyChannelTransactionParameters this_obj_conv;
40257         this_obj_conv.inner = untag_ptr(this_obj);
40258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40260         CounterpartyChannelTransactionParameters_free(this_obj_conv);
40261 }
40262
40263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
40264         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
40265         this_ptr_conv.inner = untag_ptr(this_ptr);
40266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40268         this_ptr_conv.is_owned = false;
40269         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
40270         int64_t ret_ref = 0;
40271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40273         return ret_ref;
40274 }
40275
40276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40277         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
40278         this_ptr_conv.inner = untag_ptr(this_ptr);
40279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40281         this_ptr_conv.is_owned = false;
40282         LDKChannelPublicKeys val_conv;
40283         val_conv.inner = untag_ptr(val);
40284         val_conv.is_owned = ptr_is_owned(val);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40286         val_conv = ChannelPublicKeys_clone(&val_conv);
40287         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
40288 }
40289
40290 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
40291         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
40292         this_ptr_conv.inner = untag_ptr(this_ptr);
40293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40295         this_ptr_conv.is_owned = false;
40296         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
40297         return ret_conv;
40298 }
40299
40300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40301         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
40302         this_ptr_conv.inner = untag_ptr(this_ptr);
40303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40305         this_ptr_conv.is_owned = false;
40306         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
40307 }
40308
40309 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) {
40310         LDKChannelPublicKeys pubkeys_arg_conv;
40311         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
40312         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
40313         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
40314         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
40315         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
40316         int64_t ret_ref = 0;
40317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40319         return ret_ref;
40320 }
40321
40322 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
40323         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
40324         int64_t ret_ref = 0;
40325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40327         return ret_ref;
40328 }
40329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40330         LDKCounterpartyChannelTransactionParameters arg_conv;
40331         arg_conv.inner = untag_ptr(arg);
40332         arg_conv.is_owned = ptr_is_owned(arg);
40333         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40334         arg_conv.is_owned = false;
40335         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
40336         return ret_conv;
40337 }
40338
40339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40340         LDKCounterpartyChannelTransactionParameters orig_conv;
40341         orig_conv.inner = untag_ptr(orig);
40342         orig_conv.is_owned = ptr_is_owned(orig);
40343         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40344         orig_conv.is_owned = false;
40345         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
40346         int64_t ret_ref = 0;
40347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40349         return ret_ref;
40350 }
40351
40352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
40353         LDKChannelTransactionParameters this_arg_conv;
40354         this_arg_conv.inner = untag_ptr(this_arg);
40355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40357         this_arg_conv.is_owned = false;
40358         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
40359         return ret_conv;
40360 }
40361
40362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
40363         LDKChannelTransactionParameters this_arg_conv;
40364         this_arg_conv.inner = untag_ptr(this_arg);
40365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40367         this_arg_conv.is_owned = false;
40368         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
40369         int64_t ret_ref = 0;
40370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40372         return ret_ref;
40373 }
40374
40375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
40376         LDKChannelTransactionParameters this_arg_conv;
40377         this_arg_conv.inner = untag_ptr(this_arg);
40378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40380         this_arg_conv.is_owned = false;
40381         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
40382         int64_t ret_ref = 0;
40383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40385         return ret_ref;
40386 }
40387
40388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
40389         LDKCounterpartyChannelTransactionParameters obj_conv;
40390         obj_conv.inner = untag_ptr(obj);
40391         obj_conv.is_owned = ptr_is_owned(obj);
40392         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40393         obj_conv.is_owned = false;
40394         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
40395         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40396         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40397         CVec_u8Z_free(ret_var);
40398         return ret_arr;
40399 }
40400
40401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40402         LDKu8slice ser_ref;
40403         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40404         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40405         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
40406         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
40407         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40408         return tag_ptr(ret_conv, true);
40409 }
40410
40411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
40412         LDKChannelTransactionParameters obj_conv;
40413         obj_conv.inner = untag_ptr(obj);
40414         obj_conv.is_owned = ptr_is_owned(obj);
40415         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40416         obj_conv.is_owned = false;
40417         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
40418         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40419         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40420         CVec_u8Z_free(ret_var);
40421         return ret_arr;
40422 }
40423
40424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40425         LDKu8slice ser_ref;
40426         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40427         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40428         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
40429         *ret_conv = ChannelTransactionParameters_read(ser_ref);
40430         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40431         return tag_ptr(ret_conv, true);
40432 }
40433
40434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40435         LDKDirectedChannelTransactionParameters this_obj_conv;
40436         this_obj_conv.inner = untag_ptr(this_obj);
40437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40439         DirectedChannelTransactionParameters_free(this_obj_conv);
40440 }
40441
40442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
40443         LDKDirectedChannelTransactionParameters this_arg_conv;
40444         this_arg_conv.inner = untag_ptr(this_arg);
40445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40447         this_arg_conv.is_owned = false;
40448         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
40449         int64_t ret_ref = 0;
40450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40452         return ret_ref;
40453 }
40454
40455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
40456         LDKDirectedChannelTransactionParameters this_arg_conv;
40457         this_arg_conv.inner = untag_ptr(this_arg);
40458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40460         this_arg_conv.is_owned = false;
40461         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
40462         int64_t ret_ref = 0;
40463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40465         return ret_ref;
40466 }
40467
40468 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
40469         LDKDirectedChannelTransactionParameters this_arg_conv;
40470         this_arg_conv.inner = untag_ptr(this_arg);
40471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40473         this_arg_conv.is_owned = false;
40474         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
40475         return ret_conv;
40476 }
40477
40478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
40479         LDKDirectedChannelTransactionParameters this_arg_conv;
40480         this_arg_conv.inner = untag_ptr(this_arg);
40481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40483         this_arg_conv.is_owned = false;
40484         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
40485         return ret_conv;
40486 }
40487
40488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
40489         LDKDirectedChannelTransactionParameters this_arg_conv;
40490         this_arg_conv.inner = untag_ptr(this_arg);
40491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40493         this_arg_conv.is_owned = false;
40494         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
40495         int64_t ret_ref = 0;
40496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40498         return ret_ref;
40499 }
40500
40501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
40502         LDKDirectedChannelTransactionParameters this_arg_conv;
40503         this_arg_conv.inner = untag_ptr(this_arg);
40504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40506         this_arg_conv.is_owned = false;
40507         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
40508         return ret_conv;
40509 }
40510
40511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40512         LDKHolderCommitmentTransaction this_obj_conv;
40513         this_obj_conv.inner = untag_ptr(this_obj);
40514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40516         HolderCommitmentTransaction_free(this_obj_conv);
40517 }
40518
40519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
40520         LDKHolderCommitmentTransaction this_ptr_conv;
40521         this_ptr_conv.inner = untag_ptr(this_ptr);
40522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40524         this_ptr_conv.is_owned = false;
40525         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40526         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
40527         return ret_arr;
40528 }
40529
40530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40531         LDKHolderCommitmentTransaction this_ptr_conv;
40532         this_ptr_conv.inner = untag_ptr(this_ptr);
40533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40535         this_ptr_conv.is_owned = false;
40536         LDKSignature val_ref;
40537         CHECK((*env)->GetArrayLength(env, val) == 64);
40538         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
40539         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
40540 }
40541
40542 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40543         LDKHolderCommitmentTransaction this_ptr_conv;
40544         this_ptr_conv.inner = untag_ptr(this_ptr);
40545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40547         this_ptr_conv.is_owned = false;
40548         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
40549         jobjectArray ret_arr = NULL;
40550         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
40551         ;
40552         for (size_t i = 0; i < ret_var.datalen; i++) {
40553                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
40554                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
40555                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
40556         }
40557         
40558         FREE(ret_var.data);
40559         return ret_arr;
40560 }
40561
40562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
40563         LDKHolderCommitmentTransaction this_ptr_conv;
40564         this_ptr_conv.inner = untag_ptr(this_ptr);
40565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40567         this_ptr_conv.is_owned = false;
40568         LDKCVec_SignatureZ val_constr;
40569         val_constr.datalen = (*env)->GetArrayLength(env, val);
40570         if (val_constr.datalen > 0)
40571                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
40572         else
40573                 val_constr.data = NULL;
40574         for (size_t i = 0; i < val_constr.datalen; i++) {
40575                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
40576                 LDKSignature val_conv_8_ref;
40577                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
40578                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
40579                 val_constr.data[i] = val_conv_8_ref;
40580         }
40581         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
40582 }
40583
40584 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
40585         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
40586         int64_t ret_ref = 0;
40587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40589         return ret_ref;
40590 }
40591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40592         LDKHolderCommitmentTransaction arg_conv;
40593         arg_conv.inner = untag_ptr(arg);
40594         arg_conv.is_owned = ptr_is_owned(arg);
40595         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40596         arg_conv.is_owned = false;
40597         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
40598         return ret_conv;
40599 }
40600
40601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40602         LDKHolderCommitmentTransaction orig_conv;
40603         orig_conv.inner = untag_ptr(orig);
40604         orig_conv.is_owned = ptr_is_owned(orig);
40605         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40606         orig_conv.is_owned = false;
40607         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
40608         int64_t ret_ref = 0;
40609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40611         return ret_ref;
40612 }
40613
40614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40615         LDKHolderCommitmentTransaction obj_conv;
40616         obj_conv.inner = untag_ptr(obj);
40617         obj_conv.is_owned = ptr_is_owned(obj);
40618         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40619         obj_conv.is_owned = false;
40620         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
40621         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40622         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40623         CVec_u8Z_free(ret_var);
40624         return ret_arr;
40625 }
40626
40627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40628         LDKu8slice ser_ref;
40629         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40630         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40631         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
40632         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
40633         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40634         return tag_ptr(ret_conv, true);
40635 }
40636
40637 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) {
40638         LDKCommitmentTransaction commitment_tx_conv;
40639         commitment_tx_conv.inner = untag_ptr(commitment_tx);
40640         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
40641         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
40642         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
40643         LDKSignature counterparty_sig_ref;
40644         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
40645         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
40646         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
40647         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
40648         if (counterparty_htlc_sigs_constr.datalen > 0)
40649                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
40650         else
40651                 counterparty_htlc_sigs_constr.data = NULL;
40652         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
40653                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
40654                 LDKSignature counterparty_htlc_sigs_conv_8_ref;
40655                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
40656                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
40657                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
40658         }
40659         LDKPublicKey holder_funding_key_ref;
40660         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
40661         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
40662         LDKPublicKey counterparty_funding_key_ref;
40663         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
40664         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
40665         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
40666         int64_t ret_ref = 0;
40667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40669         return ret_ref;
40670 }
40671
40672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40673         LDKBuiltCommitmentTransaction this_obj_conv;
40674         this_obj_conv.inner = untag_ptr(this_obj);
40675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40677         BuiltCommitmentTransaction_free(this_obj_conv);
40678 }
40679
40680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
40681         LDKBuiltCommitmentTransaction this_ptr_conv;
40682         this_ptr_conv.inner = untag_ptr(this_ptr);
40683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40685         this_ptr_conv.is_owned = false;
40686         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
40687         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40688         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40689         Transaction_free(ret_var);
40690         return ret_arr;
40691 }
40692
40693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40694         LDKBuiltCommitmentTransaction this_ptr_conv;
40695         this_ptr_conv.inner = untag_ptr(this_ptr);
40696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40698         this_ptr_conv.is_owned = false;
40699         LDKTransaction val_ref;
40700         val_ref.datalen = (*env)->GetArrayLength(env, val);
40701         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
40702         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
40703         val_ref.data_is_owned = true;
40704         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
40705 }
40706
40707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
40708         LDKBuiltCommitmentTransaction this_ptr_conv;
40709         this_ptr_conv.inner = untag_ptr(this_ptr);
40710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40712         this_ptr_conv.is_owned = false;
40713         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40714         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
40715         return ret_arr;
40716 }
40717
40718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40719         LDKBuiltCommitmentTransaction this_ptr_conv;
40720         this_ptr_conv.inner = untag_ptr(this_ptr);
40721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40723         this_ptr_conv.is_owned = false;
40724         LDKThirtyTwoBytes val_ref;
40725         CHECK((*env)->GetArrayLength(env, val) == 32);
40726         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40727         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
40728 }
40729
40730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
40731         LDKTransaction transaction_arg_ref;
40732         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
40733         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
40734         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
40735         transaction_arg_ref.data_is_owned = true;
40736         LDKThirtyTwoBytes txid_arg_ref;
40737         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
40738         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
40739         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
40740         int64_t ret_ref = 0;
40741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40743         return ret_ref;
40744 }
40745
40746 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
40747         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
40748         int64_t ret_ref = 0;
40749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40751         return ret_ref;
40752 }
40753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40754         LDKBuiltCommitmentTransaction arg_conv;
40755         arg_conv.inner = untag_ptr(arg);
40756         arg_conv.is_owned = ptr_is_owned(arg);
40757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40758         arg_conv.is_owned = false;
40759         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
40760         return ret_conv;
40761 }
40762
40763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40764         LDKBuiltCommitmentTransaction orig_conv;
40765         orig_conv.inner = untag_ptr(orig);
40766         orig_conv.is_owned = ptr_is_owned(orig);
40767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40768         orig_conv.is_owned = false;
40769         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
40770         int64_t ret_ref = 0;
40771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40773         return ret_ref;
40774 }
40775
40776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
40777         LDKBuiltCommitmentTransaction obj_conv;
40778         obj_conv.inner = untag_ptr(obj);
40779         obj_conv.is_owned = ptr_is_owned(obj);
40780         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40781         obj_conv.is_owned = false;
40782         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
40783         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40784         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40785         CVec_u8Z_free(ret_var);
40786         return ret_arr;
40787 }
40788
40789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40790         LDKu8slice ser_ref;
40791         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40792         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40793         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
40794         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
40795         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40796         return tag_ptr(ret_conv, true);
40797 }
40798
40799 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) {
40800         LDKBuiltCommitmentTransaction this_arg_conv;
40801         this_arg_conv.inner = untag_ptr(this_arg);
40802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40804         this_arg_conv.is_owned = false;
40805         LDKu8slice funding_redeemscript_ref;
40806         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40807         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40808         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40809         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
40810         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40811         return ret_arr;
40812 }
40813
40814 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) {
40815         LDKBuiltCommitmentTransaction 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         unsigned char funding_key_arr[32];
40821         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
40822         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
40823         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
40824         LDKu8slice funding_redeemscript_ref;
40825         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
40826         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
40827         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
40828         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
40829         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
40830         return ret_arr;
40831 }
40832
40833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40834         LDKClosingTransaction this_obj_conv;
40835         this_obj_conv.inner = untag_ptr(this_obj);
40836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40838         ClosingTransaction_free(this_obj_conv);
40839 }
40840
40841 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
40842         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
40843         int64_t ret_ref = 0;
40844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40846         return ret_ref;
40847 }
40848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40849         LDKClosingTransaction arg_conv;
40850         arg_conv.inner = untag_ptr(arg);
40851         arg_conv.is_owned = ptr_is_owned(arg);
40852         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40853         arg_conv.is_owned = false;
40854         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
40855         return ret_conv;
40856 }
40857
40858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40859         LDKClosingTransaction orig_conv;
40860         orig_conv.inner = untag_ptr(orig);
40861         orig_conv.is_owned = ptr_is_owned(orig);
40862         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40863         orig_conv.is_owned = false;
40864         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
40865         int64_t ret_ref = 0;
40866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40868         return ret_ref;
40869 }
40870
40871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
40872         LDKClosingTransaction o_conv;
40873         o_conv.inner = untag_ptr(o);
40874         o_conv.is_owned = ptr_is_owned(o);
40875         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40876         o_conv.is_owned = false;
40877         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
40878         return ret_conv;
40879 }
40880
40881 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) {
40882         LDKCVec_u8Z to_holder_script_ref;
40883         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
40884         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
40885         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
40886         LDKCVec_u8Z to_counterparty_script_ref;
40887         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
40888         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
40889         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
40890         LDKOutPoint funding_outpoint_conv;
40891         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
40892         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
40893         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
40894         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
40895         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
40896         int64_t ret_ref = 0;
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40899         return ret_ref;
40900 }
40901
40902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
40903         LDKClosingTransaction this_arg_conv;
40904         this_arg_conv.inner = untag_ptr(this_arg);
40905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40907         this_arg_conv.is_owned = false;
40908         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
40909         int64_t ret_ref = 0;
40910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40912         return ret_ref;
40913 }
40914
40915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
40916         LDKClosingTransaction this_arg_conv;
40917         this_arg_conv.inner = untag_ptr(this_arg);
40918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40920         this_arg_conv.is_owned = false;
40921         LDKOutPoint funding_outpoint_conv;
40922         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
40923         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
40924         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
40925         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
40926         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
40927         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
40928         return tag_ptr(ret_conv, true);
40929 }
40930
40931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40932         LDKClosingTransaction this_arg_conv;
40933         this_arg_conv.inner = untag_ptr(this_arg);
40934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40936         this_arg_conv.is_owned = false;
40937         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
40938         return ret_conv;
40939 }
40940
40941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
40942         LDKClosingTransaction this_arg_conv;
40943         this_arg_conv.inner = untag_ptr(this_arg);
40944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40946         this_arg_conv.is_owned = false;
40947         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
40948         return ret_conv;
40949 }
40950
40951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40952         LDKClosingTransaction this_arg_conv;
40953         this_arg_conv.inner = untag_ptr(this_arg);
40954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40956         this_arg_conv.is_owned = false;
40957         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
40958         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40959         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40960         return ret_arr;
40961 }
40962
40963 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40964         LDKClosingTransaction this_arg_conv;
40965         this_arg_conv.inner = untag_ptr(this_arg);
40966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40968         this_arg_conv.is_owned = false;
40969         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
40970         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40971         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40972         return ret_arr;
40973 }
40974
40975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40976         LDKTrustedClosingTransaction this_obj_conv;
40977         this_obj_conv.inner = untag_ptr(this_obj);
40978         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40980         TrustedClosingTransaction_free(this_obj_conv);
40981 }
40982
40983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
40984         LDKTrustedClosingTransaction this_arg_conv;
40985         this_arg_conv.inner = untag_ptr(this_arg);
40986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40988         this_arg_conv.is_owned = false;
40989         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
40990         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40991         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40992         Transaction_free(ret_var);
40993         return ret_arr;
40994 }
40995
40996 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) {
40997         LDKTrustedClosingTransaction this_arg_conv;
40998         this_arg_conv.inner = untag_ptr(this_arg);
40999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41001         this_arg_conv.is_owned = false;
41002         LDKu8slice funding_redeemscript_ref;
41003         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
41004         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
41005         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41006         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
41007         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
41008         return ret_arr;
41009 }
41010
41011 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) {
41012         LDKTrustedClosingTransaction this_arg_conv;
41013         this_arg_conv.inner = untag_ptr(this_arg);
41014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41016         this_arg_conv.is_owned = false;
41017         unsigned char funding_key_arr[32];
41018         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
41019         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
41020         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
41021         LDKu8slice funding_redeemscript_ref;
41022         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
41023         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
41024         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
41025         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
41026         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
41027         return ret_arr;
41028 }
41029
41030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41031         LDKCommitmentTransaction this_obj_conv;
41032         this_obj_conv.inner = untag_ptr(this_obj);
41033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41035         CommitmentTransaction_free(this_obj_conv);
41036 }
41037
41038 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
41039         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
41040         int64_t ret_ref = 0;
41041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41043         return ret_ref;
41044 }
41045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41046         LDKCommitmentTransaction arg_conv;
41047         arg_conv.inner = untag_ptr(arg);
41048         arg_conv.is_owned = ptr_is_owned(arg);
41049         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41050         arg_conv.is_owned = false;
41051         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
41052         return ret_conv;
41053 }
41054
41055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41056         LDKCommitmentTransaction orig_conv;
41057         orig_conv.inner = untag_ptr(orig);
41058         orig_conv.is_owned = ptr_is_owned(orig);
41059         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41060         orig_conv.is_owned = false;
41061         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
41062         int64_t ret_ref = 0;
41063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41065         return ret_ref;
41066 }
41067
41068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
41069         LDKCommitmentTransaction obj_conv;
41070         obj_conv.inner = untag_ptr(obj);
41071         obj_conv.is_owned = ptr_is_owned(obj);
41072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41073         obj_conv.is_owned = false;
41074         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
41075         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41076         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41077         CVec_u8Z_free(ret_var);
41078         return ret_arr;
41079 }
41080
41081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41082         LDKu8slice ser_ref;
41083         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41084         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41085         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
41086         *ret_conv = CommitmentTransaction_read(ser_ref);
41087         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41088         return tag_ptr(ret_conv, true);
41089 }
41090
41091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
41092         LDKCommitmentTransaction this_arg_conv;
41093         this_arg_conv.inner = untag_ptr(this_arg);
41094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41096         this_arg_conv.is_owned = false;
41097         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
41098         return ret_conv;
41099 }
41100
41101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
41102         LDKCommitmentTransaction this_arg_conv;
41103         this_arg_conv.inner = untag_ptr(this_arg);
41104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41106         this_arg_conv.is_owned = false;
41107         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
41108         return ret_conv;
41109 }
41110
41111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
41112         LDKCommitmentTransaction this_arg_conv;
41113         this_arg_conv.inner = untag_ptr(this_arg);
41114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41116         this_arg_conv.is_owned = false;
41117         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
41118         return ret_conv;
41119 }
41120
41121 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
41122         LDKCommitmentTransaction this_arg_conv;
41123         this_arg_conv.inner = untag_ptr(this_arg);
41124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41126         this_arg_conv.is_owned = false;
41127         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
41128         return ret_conv;
41129 }
41130
41131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
41132         LDKCommitmentTransaction this_arg_conv;
41133         this_arg_conv.inner = untag_ptr(this_arg);
41134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41136         this_arg_conv.is_owned = false;
41137         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
41138         int64_t ret_ref = 0;
41139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41141         return ret_ref;
41142 }
41143
41144 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) {
41145         LDKCommitmentTransaction this_arg_conv;
41146         this_arg_conv.inner = untag_ptr(this_arg);
41147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41149         this_arg_conv.is_owned = false;
41150         LDKDirectedChannelTransactionParameters channel_parameters_conv;
41151         channel_parameters_conv.inner = untag_ptr(channel_parameters);
41152         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
41153         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
41154         channel_parameters_conv.is_owned = false;
41155         LDKChannelPublicKeys broadcaster_keys_conv;
41156         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
41157         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
41158         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
41159         broadcaster_keys_conv.is_owned = false;
41160         LDKChannelPublicKeys countersignatory_keys_conv;
41161         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
41162         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
41163         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
41164         countersignatory_keys_conv.is_owned = false;
41165         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
41166         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
41167         return tag_ptr(ret_conv, true);
41168 }
41169
41170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41171         LDKTrustedCommitmentTransaction this_obj_conv;
41172         this_obj_conv.inner = untag_ptr(this_obj);
41173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41175         TrustedCommitmentTransaction_free(this_obj_conv);
41176 }
41177
41178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
41179         LDKTrustedCommitmentTransaction this_arg_conv;
41180         this_arg_conv.inner = untag_ptr(this_arg);
41181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41183         this_arg_conv.is_owned = false;
41184         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41185         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
41186         return ret_arr;
41187 }
41188
41189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
41190         LDKTrustedCommitmentTransaction this_arg_conv;
41191         this_arg_conv.inner = untag_ptr(this_arg);
41192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41194         this_arg_conv.is_owned = false;
41195         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
41196         int64_t ret_ref = 0;
41197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41199         return ret_ref;
41200 }
41201
41202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
41203         LDKTrustedCommitmentTransaction this_arg_conv;
41204         this_arg_conv.inner = untag_ptr(this_arg);
41205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41207         this_arg_conv.is_owned = false;
41208         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
41209         int64_t ret_ref = 0;
41210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41212         return ret_ref;
41213 }
41214
41215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
41216         LDKTrustedCommitmentTransaction this_arg_conv;
41217         this_arg_conv.inner = untag_ptr(this_arg);
41218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41220         this_arg_conv.is_owned = false;
41221         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
41222         return ret_conv;
41223 }
41224
41225 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) {
41226         LDKTrustedCommitmentTransaction this_arg_conv;
41227         this_arg_conv.inner = untag_ptr(this_arg);
41228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41230         this_arg_conv.is_owned = false;
41231         unsigned char htlc_base_key_arr[32];
41232         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
41233         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
41234         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
41235         LDKDirectedChannelTransactionParameters channel_parameters_conv;
41236         channel_parameters_conv.inner = untag_ptr(channel_parameters);
41237         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
41238         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
41239         channel_parameters_conv.is_owned = false;
41240         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
41241         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
41242         return tag_ptr(ret_conv, true);
41243 }
41244
41245 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) {
41246         LDKPublicKey broadcaster_payment_basepoint_ref;
41247         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
41248         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
41249         LDKPublicKey countersignatory_payment_basepoint_ref;
41250         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
41251         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
41252         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
41253         return ret_conv;
41254 }
41255
41256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41257         LDKInitFeatures a_conv;
41258         a_conv.inner = untag_ptr(a);
41259         a_conv.is_owned = ptr_is_owned(a);
41260         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41261         a_conv.is_owned = false;
41262         LDKInitFeatures b_conv;
41263         b_conv.inner = untag_ptr(b);
41264         b_conv.is_owned = ptr_is_owned(b);
41265         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41266         b_conv.is_owned = false;
41267         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
41268         return ret_conv;
41269 }
41270
41271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41272         LDKNodeFeatures a_conv;
41273         a_conv.inner = untag_ptr(a);
41274         a_conv.is_owned = ptr_is_owned(a);
41275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41276         a_conv.is_owned = false;
41277         LDKNodeFeatures b_conv;
41278         b_conv.inner = untag_ptr(b);
41279         b_conv.is_owned = ptr_is_owned(b);
41280         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41281         b_conv.is_owned = false;
41282         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
41283         return ret_conv;
41284 }
41285
41286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41287         LDKChannelFeatures a_conv;
41288         a_conv.inner = untag_ptr(a);
41289         a_conv.is_owned = ptr_is_owned(a);
41290         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41291         a_conv.is_owned = false;
41292         LDKChannelFeatures b_conv;
41293         b_conv.inner = untag_ptr(b);
41294         b_conv.is_owned = ptr_is_owned(b);
41295         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41296         b_conv.is_owned = false;
41297         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
41298         return ret_conv;
41299 }
41300
41301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41302         LDKInvoiceFeatures a_conv;
41303         a_conv.inner = untag_ptr(a);
41304         a_conv.is_owned = ptr_is_owned(a);
41305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41306         a_conv.is_owned = false;
41307         LDKInvoiceFeatures b_conv;
41308         b_conv.inner = untag_ptr(b);
41309         b_conv.is_owned = ptr_is_owned(b);
41310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41311         b_conv.is_owned = false;
41312         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
41313         return ret_conv;
41314 }
41315
41316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41317         LDKChannelTypeFeatures a_conv;
41318         a_conv.inner = untag_ptr(a);
41319         a_conv.is_owned = ptr_is_owned(a);
41320         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41321         a_conv.is_owned = false;
41322         LDKChannelTypeFeatures b_conv;
41323         b_conv.inner = untag_ptr(b);
41324         b_conv.is_owned = ptr_is_owned(b);
41325         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41326         b_conv.is_owned = false;
41327         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
41328         return ret_conv;
41329 }
41330
41331 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
41332         LDKInitFeatures ret_var = InitFeatures_clone(arg);
41333         int64_t ret_ref = 0;
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41336         return ret_ref;
41337 }
41338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41339         LDKInitFeatures arg_conv;
41340         arg_conv.inner = untag_ptr(arg);
41341         arg_conv.is_owned = ptr_is_owned(arg);
41342         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41343         arg_conv.is_owned = false;
41344         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
41345         return ret_conv;
41346 }
41347
41348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41349         LDKInitFeatures orig_conv;
41350         orig_conv.inner = untag_ptr(orig);
41351         orig_conv.is_owned = ptr_is_owned(orig);
41352         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41353         orig_conv.is_owned = false;
41354         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
41355         int64_t ret_ref = 0;
41356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41358         return ret_ref;
41359 }
41360
41361 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
41362         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
41363         int64_t ret_ref = 0;
41364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41366         return ret_ref;
41367 }
41368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41369         LDKNodeFeatures arg_conv;
41370         arg_conv.inner = untag_ptr(arg);
41371         arg_conv.is_owned = ptr_is_owned(arg);
41372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41373         arg_conv.is_owned = false;
41374         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
41375         return ret_conv;
41376 }
41377
41378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41379         LDKNodeFeatures orig_conv;
41380         orig_conv.inner = untag_ptr(orig);
41381         orig_conv.is_owned = ptr_is_owned(orig);
41382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41383         orig_conv.is_owned = false;
41384         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
41385         int64_t ret_ref = 0;
41386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41388         return ret_ref;
41389 }
41390
41391 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
41392         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
41393         int64_t ret_ref = 0;
41394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41396         return ret_ref;
41397 }
41398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41399         LDKChannelFeatures arg_conv;
41400         arg_conv.inner = untag_ptr(arg);
41401         arg_conv.is_owned = ptr_is_owned(arg);
41402         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41403         arg_conv.is_owned = false;
41404         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
41405         return ret_conv;
41406 }
41407
41408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41409         LDKChannelFeatures orig_conv;
41410         orig_conv.inner = untag_ptr(orig);
41411         orig_conv.is_owned = ptr_is_owned(orig);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41413         orig_conv.is_owned = false;
41414         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
41415         int64_t ret_ref = 0;
41416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41418         return ret_ref;
41419 }
41420
41421 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
41422         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
41423         int64_t ret_ref = 0;
41424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41426         return ret_ref;
41427 }
41428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41429         LDKInvoiceFeatures arg_conv;
41430         arg_conv.inner = untag_ptr(arg);
41431         arg_conv.is_owned = ptr_is_owned(arg);
41432         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41433         arg_conv.is_owned = false;
41434         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
41435         return ret_conv;
41436 }
41437
41438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41439         LDKInvoiceFeatures orig_conv;
41440         orig_conv.inner = untag_ptr(orig);
41441         orig_conv.is_owned = ptr_is_owned(orig);
41442         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41443         orig_conv.is_owned = false;
41444         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
41445         int64_t ret_ref = 0;
41446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41448         return ret_ref;
41449 }
41450
41451 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
41452         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
41453         int64_t ret_ref = 0;
41454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41456         return ret_ref;
41457 }
41458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41459         LDKChannelTypeFeatures arg_conv;
41460         arg_conv.inner = untag_ptr(arg);
41461         arg_conv.is_owned = ptr_is_owned(arg);
41462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41463         arg_conv.is_owned = false;
41464         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
41465         return ret_conv;
41466 }
41467
41468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41469         LDKChannelTypeFeatures orig_conv;
41470         orig_conv.inner = untag_ptr(orig);
41471         orig_conv.is_owned = ptr_is_owned(orig);
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41473         orig_conv.is_owned = false;
41474         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
41475         int64_t ret_ref = 0;
41476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41478         return ret_ref;
41479 }
41480
41481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41482         LDKInitFeatures this_obj_conv;
41483         this_obj_conv.inner = untag_ptr(this_obj);
41484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41486         InitFeatures_free(this_obj_conv);
41487 }
41488
41489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41490         LDKNodeFeatures this_obj_conv;
41491         this_obj_conv.inner = untag_ptr(this_obj);
41492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41494         NodeFeatures_free(this_obj_conv);
41495 }
41496
41497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41498         LDKChannelFeatures this_obj_conv;
41499         this_obj_conv.inner = untag_ptr(this_obj);
41500         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41502         ChannelFeatures_free(this_obj_conv);
41503 }
41504
41505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41506         LDKInvoiceFeatures this_obj_conv;
41507         this_obj_conv.inner = untag_ptr(this_obj);
41508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41510         InvoiceFeatures_free(this_obj_conv);
41511 }
41512
41513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41514         LDKChannelTypeFeatures this_obj_conv;
41515         this_obj_conv.inner = untag_ptr(this_obj);
41516         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41518         ChannelTypeFeatures_free(this_obj_conv);
41519 }
41520
41521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known_1channel_1features(JNIEnv *env, jclass clz) {
41522         LDKInitFeatures ret_var = InitFeatures_known_channel_features();
41523         int64_t ret_ref = 0;
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41526         return ret_ref;
41527 }
41528
41529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known_1channel_1features(JNIEnv *env, jclass clz) {
41530         LDKNodeFeatures ret_var = NodeFeatures_known_channel_features();
41531         int64_t ret_ref = 0;
41532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41534         return ret_ref;
41535 }
41536
41537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
41538         LDKInitFeatures ret_var = InitFeatures_empty();
41539         int64_t ret_ref = 0;
41540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41542         return ret_ref;
41543 }
41544
41545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
41546         LDKInitFeatures ret_var = InitFeatures_known();
41547         int64_t ret_ref = 0;
41548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41550         return ret_ref;
41551 }
41552
41553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41554         LDKInitFeatures this_arg_conv;
41555         this_arg_conv.inner = untag_ptr(this_arg);
41556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41558         this_arg_conv.is_owned = false;
41559         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
41560         return ret_conv;
41561 }
41562
41563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
41564         LDKNodeFeatures ret_var = NodeFeatures_empty();
41565         int64_t ret_ref = 0;
41566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41568         return ret_ref;
41569 }
41570
41571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
41572         LDKNodeFeatures ret_var = NodeFeatures_known();
41573         int64_t ret_ref = 0;
41574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41576         return ret_ref;
41577 }
41578
41579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41580         LDKNodeFeatures this_arg_conv;
41581         this_arg_conv.inner = untag_ptr(this_arg);
41582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41584         this_arg_conv.is_owned = false;
41585         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
41586         return ret_conv;
41587 }
41588
41589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
41590         LDKChannelFeatures ret_var = ChannelFeatures_empty();
41591         int64_t ret_ref = 0;
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41594         return ret_ref;
41595 }
41596
41597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
41598         LDKChannelFeatures ret_var = ChannelFeatures_known();
41599         int64_t ret_ref = 0;
41600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41602         return ret_ref;
41603 }
41604
41605 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41606         LDKChannelFeatures this_arg_conv;
41607         this_arg_conv.inner = untag_ptr(this_arg);
41608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41610         this_arg_conv.is_owned = false;
41611         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
41612         return ret_conv;
41613 }
41614
41615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
41616         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
41617         int64_t ret_ref = 0;
41618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41620         return ret_ref;
41621 }
41622
41623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
41624         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
41625         int64_t ret_ref = 0;
41626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41628         return ret_ref;
41629 }
41630
41631 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41632         LDKInvoiceFeatures this_arg_conv;
41633         this_arg_conv.inner = untag_ptr(this_arg);
41634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41636         this_arg_conv.is_owned = false;
41637         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
41638         return ret_conv;
41639 }
41640
41641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
41642         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
41643         int64_t ret_ref = 0;
41644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41646         return ret_ref;
41647 }
41648
41649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
41650         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
41651         int64_t ret_ref = 0;
41652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41654         return ret_ref;
41655 }
41656
41657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
41658         LDKChannelTypeFeatures this_arg_conv;
41659         this_arg_conv.inner = untag_ptr(this_arg);
41660         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41662         this_arg_conv.is_owned = false;
41663         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
41664         return ret_conv;
41665 }
41666
41667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41668         LDKInitFeatures obj_conv;
41669         obj_conv.inner = untag_ptr(obj);
41670         obj_conv.is_owned = ptr_is_owned(obj);
41671         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41672         obj_conv.is_owned = false;
41673         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
41674         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41675         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41676         CVec_u8Z_free(ret_var);
41677         return ret_arr;
41678 }
41679
41680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41681         LDKu8slice ser_ref;
41682         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41683         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41684         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
41685         *ret_conv = InitFeatures_read(ser_ref);
41686         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41687         return tag_ptr(ret_conv, true);
41688 }
41689
41690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41691         LDKChannelFeatures obj_conv;
41692         obj_conv.inner = untag_ptr(obj);
41693         obj_conv.is_owned = ptr_is_owned(obj);
41694         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41695         obj_conv.is_owned = false;
41696         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
41697         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41698         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41699         CVec_u8Z_free(ret_var);
41700         return ret_arr;
41701 }
41702
41703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41704         LDKu8slice ser_ref;
41705         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41706         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41707         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
41708         *ret_conv = ChannelFeatures_read(ser_ref);
41709         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41710         return tag_ptr(ret_conv, true);
41711 }
41712
41713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41714         LDKNodeFeatures obj_conv;
41715         obj_conv.inner = untag_ptr(obj);
41716         obj_conv.is_owned = ptr_is_owned(obj);
41717         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41718         obj_conv.is_owned = false;
41719         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
41720         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41721         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41722         CVec_u8Z_free(ret_var);
41723         return ret_arr;
41724 }
41725
41726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41727         LDKu8slice ser_ref;
41728         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41729         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41730         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
41731         *ret_conv = NodeFeatures_read(ser_ref);
41732         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41733         return tag_ptr(ret_conv, true);
41734 }
41735
41736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41737         LDKInvoiceFeatures obj_conv;
41738         obj_conv.inner = untag_ptr(obj);
41739         obj_conv.is_owned = ptr_is_owned(obj);
41740         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41741         obj_conv.is_owned = false;
41742         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
41743         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41744         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41745         CVec_u8Z_free(ret_var);
41746         return ret_arr;
41747 }
41748
41749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41750         LDKu8slice ser_ref;
41751         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41752         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41753         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
41754         *ret_conv = InvoiceFeatures_read(ser_ref);
41755         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41756         return tag_ptr(ret_conv, true);
41757 }
41758
41759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
41760         LDKChannelTypeFeatures obj_conv;
41761         obj_conv.inner = untag_ptr(obj);
41762         obj_conv.is_owned = ptr_is_owned(obj);
41763         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41764         obj_conv.is_owned = false;
41765         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
41766         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41767         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41768         CVec_u8Z_free(ret_var);
41769         return ret_arr;
41770 }
41771
41772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41773         LDKu8slice ser_ref;
41774         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41775         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41776         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
41777         *ret_conv = ChannelTypeFeatures_read(ser_ref);
41778         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41779         return tag_ptr(ret_conv, true);
41780 }
41781
41782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41783         LDKInitFeatures this_arg_conv;
41784         this_arg_conv.inner = untag_ptr(this_arg);
41785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41787         this_arg_conv.is_owned = false;
41788         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
41789 }
41790
41791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41792         LDKInitFeatures this_arg_conv;
41793         this_arg_conv.inner = untag_ptr(this_arg);
41794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41796         this_arg_conv.is_owned = false;
41797         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
41798 }
41799
41800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41801         LDKInitFeatures this_arg_conv;
41802         this_arg_conv.inner = untag_ptr(this_arg);
41803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41805         this_arg_conv.is_owned = false;
41806         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
41807         return ret_conv;
41808 }
41809
41810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41811         LDKNodeFeatures this_arg_conv;
41812         this_arg_conv.inner = untag_ptr(this_arg);
41813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41815         this_arg_conv.is_owned = false;
41816         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
41817 }
41818
41819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41820         LDKNodeFeatures this_arg_conv;
41821         this_arg_conv.inner = untag_ptr(this_arg);
41822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41824         this_arg_conv.is_owned = false;
41825         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
41826 }
41827
41828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41829         LDKNodeFeatures this_arg_conv;
41830         this_arg_conv.inner = untag_ptr(this_arg);
41831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41833         this_arg_conv.is_owned = false;
41834         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
41835         return ret_conv;
41836 }
41837
41838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41839         LDKInitFeatures this_arg_conv;
41840         this_arg_conv.inner = untag_ptr(this_arg);
41841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41843         this_arg_conv.is_owned = false;
41844         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
41845         return ret_conv;
41846 }
41847
41848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
41849         LDKNodeFeatures this_arg_conv;
41850         this_arg_conv.inner = untag_ptr(this_arg);
41851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41853         this_arg_conv.is_owned = false;
41854         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
41855         return ret_conv;
41856 }
41857
41858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41859         LDKInitFeatures this_arg_conv;
41860         this_arg_conv.inner = untag_ptr(this_arg);
41861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41863         this_arg_conv.is_owned = false;
41864         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
41865 }
41866
41867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41868         LDKInitFeatures this_arg_conv;
41869         this_arg_conv.inner = untag_ptr(this_arg);
41870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41872         this_arg_conv.is_owned = false;
41873         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
41874 }
41875
41876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
41877         LDKInitFeatures this_arg_conv;
41878         this_arg_conv.inner = untag_ptr(this_arg);
41879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41881         this_arg_conv.is_owned = false;
41882         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
41883         return ret_conv;
41884 }
41885
41886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41887         LDKInitFeatures this_arg_conv;
41888         this_arg_conv.inner = untag_ptr(this_arg);
41889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41891         this_arg_conv.is_owned = false;
41892         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41893 }
41894
41895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41896         LDKInitFeatures this_arg_conv;
41897         this_arg_conv.inner = untag_ptr(this_arg);
41898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41900         this_arg_conv.is_owned = false;
41901         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41902 }
41903
41904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41905         LDKInitFeatures this_arg_conv;
41906         this_arg_conv.inner = untag_ptr(this_arg);
41907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41909         this_arg_conv.is_owned = false;
41910         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41911         return ret_conv;
41912 }
41913
41914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41915         LDKNodeFeatures this_arg_conv;
41916         this_arg_conv.inner = untag_ptr(this_arg);
41917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41919         this_arg_conv.is_owned = false;
41920         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
41921 }
41922
41923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41924         LDKNodeFeatures this_arg_conv;
41925         this_arg_conv.inner = untag_ptr(this_arg);
41926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41928         this_arg_conv.is_owned = false;
41929         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
41930 }
41931
41932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41933         LDKNodeFeatures this_arg_conv;
41934         this_arg_conv.inner = untag_ptr(this_arg);
41935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41937         this_arg_conv.is_owned = false;
41938         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
41939         return ret_conv;
41940 }
41941
41942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41943         LDKInitFeatures this_arg_conv;
41944         this_arg_conv.inner = untag_ptr(this_arg);
41945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41947         this_arg_conv.is_owned = false;
41948         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41949         return ret_conv;
41950 }
41951
41952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
41953         LDKNodeFeatures this_arg_conv;
41954         this_arg_conv.inner = untag_ptr(this_arg);
41955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41957         this_arg_conv.is_owned = false;
41958         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
41959         return ret_conv;
41960 }
41961
41962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41963         LDKInitFeatures this_arg_conv;
41964         this_arg_conv.inner = untag_ptr(this_arg);
41965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41967         this_arg_conv.is_owned = false;
41968         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
41969 }
41970
41971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41972         LDKInitFeatures this_arg_conv;
41973         this_arg_conv.inner = untag_ptr(this_arg);
41974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41976         this_arg_conv.is_owned = false;
41977         InitFeatures_set_gossip_queries_required(&this_arg_conv);
41978 }
41979
41980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
41981         LDKInitFeatures this_arg_conv;
41982         this_arg_conv.inner = untag_ptr(this_arg);
41983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41985         this_arg_conv.is_owned = false;
41986         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
41987         return ret_conv;
41988 }
41989
41990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41991         LDKNodeFeatures this_arg_conv;
41992         this_arg_conv.inner = untag_ptr(this_arg);
41993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41995         this_arg_conv.is_owned = false;
41996         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
41997 }
41998
41999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42000         LDKNodeFeatures this_arg_conv;
42001         this_arg_conv.inner = untag_ptr(this_arg);
42002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42004         this_arg_conv.is_owned = false;
42005         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
42006 }
42007
42008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
42009         LDKNodeFeatures this_arg_conv;
42010         this_arg_conv.inner = untag_ptr(this_arg);
42011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42013         this_arg_conv.is_owned = false;
42014         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
42015         return ret_conv;
42016 }
42017
42018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
42019         LDKInitFeatures this_arg_conv;
42020         this_arg_conv.inner = untag_ptr(this_arg);
42021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42023         this_arg_conv.is_owned = false;
42024         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
42025         return ret_conv;
42026 }
42027
42028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
42029         LDKNodeFeatures this_arg_conv;
42030         this_arg_conv.inner = untag_ptr(this_arg);
42031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42033         this_arg_conv.is_owned = false;
42034         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
42035         return ret_conv;
42036 }
42037
42038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42039         LDKInitFeatures this_arg_conv;
42040         this_arg_conv.inner = untag_ptr(this_arg);
42041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42043         this_arg_conv.is_owned = false;
42044         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
42045 }
42046
42047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42048         LDKInitFeatures this_arg_conv;
42049         this_arg_conv.inner = untag_ptr(this_arg);
42050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42052         this_arg_conv.is_owned = false;
42053         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
42054 }
42055
42056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
42057         LDKInitFeatures this_arg_conv;
42058         this_arg_conv.inner = untag_ptr(this_arg);
42059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42061         this_arg_conv.is_owned = false;
42062         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
42063         return ret_conv;
42064 }
42065
42066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42067         LDKNodeFeatures this_arg_conv;
42068         this_arg_conv.inner = untag_ptr(this_arg);
42069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42071         this_arg_conv.is_owned = false;
42072         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
42073 }
42074
42075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42076         LDKNodeFeatures this_arg_conv;
42077         this_arg_conv.inner = untag_ptr(this_arg);
42078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42080         this_arg_conv.is_owned = false;
42081         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
42082 }
42083
42084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
42085         LDKNodeFeatures this_arg_conv;
42086         this_arg_conv.inner = untag_ptr(this_arg);
42087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42089         this_arg_conv.is_owned = false;
42090         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
42091         return ret_conv;
42092 }
42093
42094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42095         LDKInvoiceFeatures this_arg_conv;
42096         this_arg_conv.inner = untag_ptr(this_arg);
42097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42099         this_arg_conv.is_owned = false;
42100         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
42101 }
42102
42103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42104         LDKInvoiceFeatures this_arg_conv;
42105         this_arg_conv.inner = untag_ptr(this_arg);
42106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42108         this_arg_conv.is_owned = false;
42109         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
42110 }
42111
42112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
42113         LDKInvoiceFeatures this_arg_conv;
42114         this_arg_conv.inner = untag_ptr(this_arg);
42115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42117         this_arg_conv.is_owned = false;
42118         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
42119         return ret_conv;
42120 }
42121
42122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
42123         LDKInitFeatures this_arg_conv;
42124         this_arg_conv.inner = untag_ptr(this_arg);
42125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42127         this_arg_conv.is_owned = false;
42128         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
42129         return ret_conv;
42130 }
42131
42132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
42133         LDKNodeFeatures this_arg_conv;
42134         this_arg_conv.inner = untag_ptr(this_arg);
42135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42137         this_arg_conv.is_owned = false;
42138         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
42139         return ret_conv;
42140 }
42141
42142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
42143         LDKInvoiceFeatures this_arg_conv;
42144         this_arg_conv.inner = untag_ptr(this_arg);
42145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42147         this_arg_conv.is_owned = false;
42148         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
42149         return ret_conv;
42150 }
42151
42152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42153         LDKInitFeatures this_arg_conv;
42154         this_arg_conv.inner = untag_ptr(this_arg);
42155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42157         this_arg_conv.is_owned = false;
42158         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
42159 }
42160
42161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42162         LDKInitFeatures this_arg_conv;
42163         this_arg_conv.inner = untag_ptr(this_arg);
42164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42166         this_arg_conv.is_owned = false;
42167         InitFeatures_set_static_remote_key_required(&this_arg_conv);
42168 }
42169
42170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
42171         LDKInitFeatures this_arg_conv;
42172         this_arg_conv.inner = untag_ptr(this_arg);
42173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42175         this_arg_conv.is_owned = false;
42176         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
42177         return ret_conv;
42178 }
42179
42180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42181         LDKNodeFeatures this_arg_conv;
42182         this_arg_conv.inner = untag_ptr(this_arg);
42183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42185         this_arg_conv.is_owned = false;
42186         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
42187 }
42188
42189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42190         LDKNodeFeatures this_arg_conv;
42191         this_arg_conv.inner = untag_ptr(this_arg);
42192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42194         this_arg_conv.is_owned = false;
42195         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
42196 }
42197
42198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
42199         LDKNodeFeatures this_arg_conv;
42200         this_arg_conv.inner = untag_ptr(this_arg);
42201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42203         this_arg_conv.is_owned = false;
42204         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
42205         return ret_conv;
42206 }
42207
42208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42209         LDKChannelTypeFeatures this_arg_conv;
42210         this_arg_conv.inner = untag_ptr(this_arg);
42211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42213         this_arg_conv.is_owned = false;
42214         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
42215 }
42216
42217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42218         LDKChannelTypeFeatures this_arg_conv;
42219         this_arg_conv.inner = untag_ptr(this_arg);
42220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42222         this_arg_conv.is_owned = false;
42223         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
42224 }
42225
42226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
42227         LDKChannelTypeFeatures this_arg_conv;
42228         this_arg_conv.inner = untag_ptr(this_arg);
42229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42231         this_arg_conv.is_owned = false;
42232         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
42233         return ret_conv;
42234 }
42235
42236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
42237         LDKInitFeatures this_arg_conv;
42238         this_arg_conv.inner = untag_ptr(this_arg);
42239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42241         this_arg_conv.is_owned = false;
42242         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
42243         return ret_conv;
42244 }
42245
42246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
42247         LDKNodeFeatures this_arg_conv;
42248         this_arg_conv.inner = untag_ptr(this_arg);
42249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42251         this_arg_conv.is_owned = false;
42252         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
42253         return ret_conv;
42254 }
42255
42256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
42257         LDKChannelTypeFeatures this_arg_conv;
42258         this_arg_conv.inner = untag_ptr(this_arg);
42259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42261         this_arg_conv.is_owned = false;
42262         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
42263         return ret_conv;
42264 }
42265
42266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42267         LDKInitFeatures this_arg_conv;
42268         this_arg_conv.inner = untag_ptr(this_arg);
42269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42271         this_arg_conv.is_owned = false;
42272         InitFeatures_set_payment_secret_optional(&this_arg_conv);
42273 }
42274
42275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42276         LDKInitFeatures this_arg_conv;
42277         this_arg_conv.inner = untag_ptr(this_arg);
42278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42280         this_arg_conv.is_owned = false;
42281         InitFeatures_set_payment_secret_required(&this_arg_conv);
42282 }
42283
42284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42285         LDKInitFeatures this_arg_conv;
42286         this_arg_conv.inner = untag_ptr(this_arg);
42287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42289         this_arg_conv.is_owned = false;
42290         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
42291         return ret_conv;
42292 }
42293
42294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42295         LDKNodeFeatures this_arg_conv;
42296         this_arg_conv.inner = untag_ptr(this_arg);
42297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42299         this_arg_conv.is_owned = false;
42300         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
42301 }
42302
42303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42304         LDKNodeFeatures this_arg_conv;
42305         this_arg_conv.inner = untag_ptr(this_arg);
42306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42308         this_arg_conv.is_owned = false;
42309         NodeFeatures_set_payment_secret_required(&this_arg_conv);
42310 }
42311
42312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42313         LDKNodeFeatures this_arg_conv;
42314         this_arg_conv.inner = untag_ptr(this_arg);
42315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42317         this_arg_conv.is_owned = false;
42318         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
42319         return ret_conv;
42320 }
42321
42322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42323         LDKInvoiceFeatures this_arg_conv;
42324         this_arg_conv.inner = untag_ptr(this_arg);
42325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42327         this_arg_conv.is_owned = false;
42328         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
42329 }
42330
42331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42332         LDKInvoiceFeatures this_arg_conv;
42333         this_arg_conv.inner = untag_ptr(this_arg);
42334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42336         this_arg_conv.is_owned = false;
42337         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
42338 }
42339
42340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42341         LDKInvoiceFeatures this_arg_conv;
42342         this_arg_conv.inner = untag_ptr(this_arg);
42343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42345         this_arg_conv.is_owned = false;
42346         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
42347         return ret_conv;
42348 }
42349
42350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42351         LDKInitFeatures this_arg_conv;
42352         this_arg_conv.inner = untag_ptr(this_arg);
42353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42355         this_arg_conv.is_owned = false;
42356         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
42357         return ret_conv;
42358 }
42359
42360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42361         LDKNodeFeatures this_arg_conv;
42362         this_arg_conv.inner = untag_ptr(this_arg);
42363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42365         this_arg_conv.is_owned = false;
42366         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
42367         return ret_conv;
42368 }
42369
42370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
42371         LDKInvoiceFeatures this_arg_conv;
42372         this_arg_conv.inner = untag_ptr(this_arg);
42373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42375         this_arg_conv.is_owned = false;
42376         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
42377         return ret_conv;
42378 }
42379
42380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42381         LDKInitFeatures this_arg_conv;
42382         this_arg_conv.inner = untag_ptr(this_arg);
42383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42385         this_arg_conv.is_owned = false;
42386         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
42387 }
42388
42389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42390         LDKInitFeatures this_arg_conv;
42391         this_arg_conv.inner = untag_ptr(this_arg);
42392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42394         this_arg_conv.is_owned = false;
42395         InitFeatures_set_basic_mpp_required(&this_arg_conv);
42396 }
42397
42398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42399         LDKInitFeatures this_arg_conv;
42400         this_arg_conv.inner = untag_ptr(this_arg);
42401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42403         this_arg_conv.is_owned = false;
42404         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
42405         return ret_conv;
42406 }
42407
42408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42409         LDKNodeFeatures this_arg_conv;
42410         this_arg_conv.inner = untag_ptr(this_arg);
42411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42413         this_arg_conv.is_owned = false;
42414         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
42415 }
42416
42417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42418         LDKNodeFeatures this_arg_conv;
42419         this_arg_conv.inner = untag_ptr(this_arg);
42420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42422         this_arg_conv.is_owned = false;
42423         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
42424 }
42425
42426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42427         LDKNodeFeatures this_arg_conv;
42428         this_arg_conv.inner = untag_ptr(this_arg);
42429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42431         this_arg_conv.is_owned = false;
42432         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
42433         return ret_conv;
42434 }
42435
42436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42437         LDKInvoiceFeatures this_arg_conv;
42438         this_arg_conv.inner = untag_ptr(this_arg);
42439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42441         this_arg_conv.is_owned = false;
42442         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
42443 }
42444
42445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42446         LDKInvoiceFeatures this_arg_conv;
42447         this_arg_conv.inner = untag_ptr(this_arg);
42448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42450         this_arg_conv.is_owned = false;
42451         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
42452 }
42453
42454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42455         LDKInvoiceFeatures this_arg_conv;
42456         this_arg_conv.inner = untag_ptr(this_arg);
42457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42459         this_arg_conv.is_owned = false;
42460         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
42461         return ret_conv;
42462 }
42463
42464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42465         LDKInitFeatures this_arg_conv;
42466         this_arg_conv.inner = untag_ptr(this_arg);
42467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42469         this_arg_conv.is_owned = false;
42470         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
42471         return ret_conv;
42472 }
42473
42474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42475         LDKNodeFeatures this_arg_conv;
42476         this_arg_conv.inner = untag_ptr(this_arg);
42477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42479         this_arg_conv.is_owned = false;
42480         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
42481         return ret_conv;
42482 }
42483
42484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
42485         LDKInvoiceFeatures this_arg_conv;
42486         this_arg_conv.inner = untag_ptr(this_arg);
42487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42489         this_arg_conv.is_owned = false;
42490         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
42491         return ret_conv;
42492 }
42493
42494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42495         LDKInitFeatures this_arg_conv;
42496         this_arg_conv.inner = untag_ptr(this_arg);
42497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42499         this_arg_conv.is_owned = false;
42500         InitFeatures_set_wumbo_optional(&this_arg_conv);
42501 }
42502
42503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42504         LDKInitFeatures this_arg_conv;
42505         this_arg_conv.inner = untag_ptr(this_arg);
42506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42508         this_arg_conv.is_owned = false;
42509         InitFeatures_set_wumbo_required(&this_arg_conv);
42510 }
42511
42512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42513         LDKInitFeatures this_arg_conv;
42514         this_arg_conv.inner = untag_ptr(this_arg);
42515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42517         this_arg_conv.is_owned = false;
42518         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
42519         return ret_conv;
42520 }
42521
42522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42523         LDKNodeFeatures this_arg_conv;
42524         this_arg_conv.inner = untag_ptr(this_arg);
42525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42527         this_arg_conv.is_owned = false;
42528         NodeFeatures_set_wumbo_optional(&this_arg_conv);
42529 }
42530
42531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42532         LDKNodeFeatures this_arg_conv;
42533         this_arg_conv.inner = untag_ptr(this_arg);
42534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42536         this_arg_conv.is_owned = false;
42537         NodeFeatures_set_wumbo_required(&this_arg_conv);
42538 }
42539
42540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42541         LDKNodeFeatures this_arg_conv;
42542         this_arg_conv.inner = untag_ptr(this_arg);
42543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42545         this_arg_conv.is_owned = false;
42546         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
42547         return ret_conv;
42548 }
42549
42550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42551         LDKInitFeatures this_arg_conv;
42552         this_arg_conv.inner = untag_ptr(this_arg);
42553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42555         this_arg_conv.is_owned = false;
42556         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
42557         return ret_conv;
42558 }
42559
42560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
42561         LDKNodeFeatures this_arg_conv;
42562         this_arg_conv.inner = untag_ptr(this_arg);
42563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42565         this_arg_conv.is_owned = false;
42566         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
42567         return ret_conv;
42568 }
42569
42570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42571         LDKInitFeatures this_arg_conv;
42572         this_arg_conv.inner = untag_ptr(this_arg);
42573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42575         this_arg_conv.is_owned = false;
42576         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
42577 }
42578
42579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42580         LDKInitFeatures this_arg_conv;
42581         this_arg_conv.inner = untag_ptr(this_arg);
42582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42584         this_arg_conv.is_owned = false;
42585         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
42586 }
42587
42588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42589         LDKInitFeatures this_arg_conv;
42590         this_arg_conv.inner = untag_ptr(this_arg);
42591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42593         this_arg_conv.is_owned = false;
42594         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
42595         return ret_conv;
42596 }
42597
42598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42599         LDKNodeFeatures this_arg_conv;
42600         this_arg_conv.inner = untag_ptr(this_arg);
42601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42603         this_arg_conv.is_owned = false;
42604         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
42605 }
42606
42607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42608         LDKNodeFeatures this_arg_conv;
42609         this_arg_conv.inner = untag_ptr(this_arg);
42610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42612         this_arg_conv.is_owned = false;
42613         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
42614 }
42615
42616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42617         LDKNodeFeatures this_arg_conv;
42618         this_arg_conv.inner = untag_ptr(this_arg);
42619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42621         this_arg_conv.is_owned = false;
42622         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
42623         return ret_conv;
42624 }
42625
42626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42627         LDKInitFeatures this_arg_conv;
42628         this_arg_conv.inner = untag_ptr(this_arg);
42629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42631         this_arg_conv.is_owned = false;
42632         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
42633         return ret_conv;
42634 }
42635
42636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
42637         LDKNodeFeatures this_arg_conv;
42638         this_arg_conv.inner = untag_ptr(this_arg);
42639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42641         this_arg_conv.is_owned = false;
42642         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
42643         return ret_conv;
42644 }
42645
42646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42647         LDKInitFeatures this_arg_conv;
42648         this_arg_conv.inner = untag_ptr(this_arg);
42649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42651         this_arg_conv.is_owned = false;
42652         InitFeatures_set_onion_messages_optional(&this_arg_conv);
42653 }
42654
42655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42656         LDKInitFeatures this_arg_conv;
42657         this_arg_conv.inner = untag_ptr(this_arg);
42658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42660         this_arg_conv.is_owned = false;
42661         InitFeatures_set_onion_messages_required(&this_arg_conv);
42662 }
42663
42664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
42665         LDKInitFeatures this_arg_conv;
42666         this_arg_conv.inner = untag_ptr(this_arg);
42667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42669         this_arg_conv.is_owned = false;
42670         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
42671         return ret_conv;
42672 }
42673
42674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42675         LDKNodeFeatures this_arg_conv;
42676         this_arg_conv.inner = untag_ptr(this_arg);
42677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42679         this_arg_conv.is_owned = false;
42680         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
42681 }
42682
42683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42684         LDKNodeFeatures this_arg_conv;
42685         this_arg_conv.inner = untag_ptr(this_arg);
42686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42688         this_arg_conv.is_owned = false;
42689         NodeFeatures_set_onion_messages_required(&this_arg_conv);
42690 }
42691
42692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
42693         LDKNodeFeatures this_arg_conv;
42694         this_arg_conv.inner = untag_ptr(this_arg);
42695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42697         this_arg_conv.is_owned = false;
42698         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
42699         return ret_conv;
42700 }
42701
42702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
42703         LDKInitFeatures this_arg_conv;
42704         this_arg_conv.inner = untag_ptr(this_arg);
42705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42707         this_arg_conv.is_owned = false;
42708         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
42709         return ret_conv;
42710 }
42711
42712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
42713         LDKNodeFeatures this_arg_conv;
42714         this_arg_conv.inner = untag_ptr(this_arg);
42715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42717         this_arg_conv.is_owned = false;
42718         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
42719         return ret_conv;
42720 }
42721
42722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42723         LDKInitFeatures this_arg_conv;
42724         this_arg_conv.inner = untag_ptr(this_arg);
42725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42727         this_arg_conv.is_owned = false;
42728         InitFeatures_set_channel_type_optional(&this_arg_conv);
42729 }
42730
42731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42732         LDKInitFeatures this_arg_conv;
42733         this_arg_conv.inner = untag_ptr(this_arg);
42734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42736         this_arg_conv.is_owned = false;
42737         InitFeatures_set_channel_type_required(&this_arg_conv);
42738 }
42739
42740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42741         LDKInitFeatures this_arg_conv;
42742         this_arg_conv.inner = untag_ptr(this_arg);
42743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42745         this_arg_conv.is_owned = false;
42746         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
42747         return ret_conv;
42748 }
42749
42750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42751         LDKNodeFeatures this_arg_conv;
42752         this_arg_conv.inner = untag_ptr(this_arg);
42753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42755         this_arg_conv.is_owned = false;
42756         NodeFeatures_set_channel_type_optional(&this_arg_conv);
42757 }
42758
42759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42760         LDKNodeFeatures this_arg_conv;
42761         this_arg_conv.inner = untag_ptr(this_arg);
42762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42764         this_arg_conv.is_owned = false;
42765         NodeFeatures_set_channel_type_required(&this_arg_conv);
42766 }
42767
42768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42769         LDKNodeFeatures this_arg_conv;
42770         this_arg_conv.inner = untag_ptr(this_arg);
42771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42773         this_arg_conv.is_owned = false;
42774         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
42775         return ret_conv;
42776 }
42777
42778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42779         LDKInitFeatures this_arg_conv;
42780         this_arg_conv.inner = untag_ptr(this_arg);
42781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42783         this_arg_conv.is_owned = false;
42784         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
42785         return ret_conv;
42786 }
42787
42788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
42789         LDKNodeFeatures this_arg_conv;
42790         this_arg_conv.inner = untag_ptr(this_arg);
42791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42793         this_arg_conv.is_owned = false;
42794         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
42795         return ret_conv;
42796 }
42797
42798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42799         LDKInitFeatures this_arg_conv;
42800         this_arg_conv.inner = untag_ptr(this_arg);
42801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42803         this_arg_conv.is_owned = false;
42804         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
42805 }
42806
42807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42808         LDKInitFeatures this_arg_conv;
42809         this_arg_conv.inner = untag_ptr(this_arg);
42810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42812         this_arg_conv.is_owned = false;
42813         InitFeatures_set_scid_privacy_required(&this_arg_conv);
42814 }
42815
42816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42817         LDKInitFeatures this_arg_conv;
42818         this_arg_conv.inner = untag_ptr(this_arg);
42819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42821         this_arg_conv.is_owned = false;
42822         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
42823         return ret_conv;
42824 }
42825
42826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42827         LDKNodeFeatures this_arg_conv;
42828         this_arg_conv.inner = untag_ptr(this_arg);
42829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42831         this_arg_conv.is_owned = false;
42832         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
42833 }
42834
42835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42836         LDKNodeFeatures this_arg_conv;
42837         this_arg_conv.inner = untag_ptr(this_arg);
42838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42840         this_arg_conv.is_owned = false;
42841         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
42842 }
42843
42844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42845         LDKNodeFeatures this_arg_conv;
42846         this_arg_conv.inner = untag_ptr(this_arg);
42847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42849         this_arg_conv.is_owned = false;
42850         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
42851         return ret_conv;
42852 }
42853
42854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42855         LDKChannelTypeFeatures this_arg_conv;
42856         this_arg_conv.inner = untag_ptr(this_arg);
42857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42859         this_arg_conv.is_owned = false;
42860         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
42861 }
42862
42863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42864         LDKChannelTypeFeatures this_arg_conv;
42865         this_arg_conv.inner = untag_ptr(this_arg);
42866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42868         this_arg_conv.is_owned = false;
42869         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
42870 }
42871
42872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42873         LDKChannelTypeFeatures this_arg_conv;
42874         this_arg_conv.inner = untag_ptr(this_arg);
42875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42877         this_arg_conv.is_owned = false;
42878         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
42879         return ret_conv;
42880 }
42881
42882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42883         LDKInitFeatures this_arg_conv;
42884         this_arg_conv.inner = untag_ptr(this_arg);
42885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42887         this_arg_conv.is_owned = false;
42888         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
42889         return ret_conv;
42890 }
42891
42892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42893         LDKNodeFeatures this_arg_conv;
42894         this_arg_conv.inner = untag_ptr(this_arg);
42895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42897         this_arg_conv.is_owned = false;
42898         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
42899         return ret_conv;
42900 }
42901
42902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
42903         LDKChannelTypeFeatures this_arg_conv;
42904         this_arg_conv.inner = untag_ptr(this_arg);
42905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42907         this_arg_conv.is_owned = false;
42908         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
42909         return ret_conv;
42910 }
42911
42912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42913         LDKInitFeatures this_arg_conv;
42914         this_arg_conv.inner = untag_ptr(this_arg);
42915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42917         this_arg_conv.is_owned = false;
42918         InitFeatures_set_zero_conf_optional(&this_arg_conv);
42919 }
42920
42921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42922         LDKInitFeatures this_arg_conv;
42923         this_arg_conv.inner = untag_ptr(this_arg);
42924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42926         this_arg_conv.is_owned = false;
42927         InitFeatures_set_zero_conf_required(&this_arg_conv);
42928 }
42929
42930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42931         LDKInitFeatures this_arg_conv;
42932         this_arg_conv.inner = untag_ptr(this_arg);
42933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42935         this_arg_conv.is_owned = false;
42936         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
42937         return ret_conv;
42938 }
42939
42940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42941         LDKNodeFeatures this_arg_conv;
42942         this_arg_conv.inner = untag_ptr(this_arg);
42943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42945         this_arg_conv.is_owned = false;
42946         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
42947 }
42948
42949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42950         LDKNodeFeatures this_arg_conv;
42951         this_arg_conv.inner = untag_ptr(this_arg);
42952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42954         this_arg_conv.is_owned = false;
42955         NodeFeatures_set_zero_conf_required(&this_arg_conv);
42956 }
42957
42958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42959         LDKNodeFeatures this_arg_conv;
42960         this_arg_conv.inner = untag_ptr(this_arg);
42961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42963         this_arg_conv.is_owned = false;
42964         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
42965         return ret_conv;
42966 }
42967
42968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
42969         LDKChannelTypeFeatures this_arg_conv;
42970         this_arg_conv.inner = untag_ptr(this_arg);
42971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42973         this_arg_conv.is_owned = false;
42974         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
42975 }
42976
42977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
42978         LDKChannelTypeFeatures this_arg_conv;
42979         this_arg_conv.inner = untag_ptr(this_arg);
42980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42982         this_arg_conv.is_owned = false;
42983         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
42984 }
42985
42986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42987         LDKChannelTypeFeatures this_arg_conv;
42988         this_arg_conv.inner = untag_ptr(this_arg);
42989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42991         this_arg_conv.is_owned = false;
42992         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
42993         return ret_conv;
42994 }
42995
42996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
42997         LDKInitFeatures this_arg_conv;
42998         this_arg_conv.inner = untag_ptr(this_arg);
42999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43001         this_arg_conv.is_owned = false;
43002         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
43003         return ret_conv;
43004 }
43005
43006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
43007         LDKNodeFeatures this_arg_conv;
43008         this_arg_conv.inner = untag_ptr(this_arg);
43009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43011         this_arg_conv.is_owned = false;
43012         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
43013         return ret_conv;
43014 }
43015
43016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
43017         LDKChannelTypeFeatures this_arg_conv;
43018         this_arg_conv.inner = untag_ptr(this_arg);
43019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43021         this_arg_conv.is_owned = false;
43022         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
43023         return ret_conv;
43024 }
43025
43026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
43027         LDKNodeFeatures this_arg_conv;
43028         this_arg_conv.inner = untag_ptr(this_arg);
43029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43031         this_arg_conv.is_owned = false;
43032         NodeFeatures_set_keysend_optional(&this_arg_conv);
43033 }
43034
43035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
43036         LDKNodeFeatures this_arg_conv;
43037         this_arg_conv.inner = untag_ptr(this_arg);
43038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43040         this_arg_conv.is_owned = false;
43041         NodeFeatures_set_keysend_required(&this_arg_conv);
43042 }
43043
43044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
43045         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
43051         return ret_conv;
43052 }
43053
43054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
43055         LDKNodeFeatures this_arg_conv;
43056         this_arg_conv.inner = untag_ptr(this_arg);
43057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43059         this_arg_conv.is_owned = false;
43060         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
43061         return ret_conv;
43062 }
43063
43064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43065         LDKShutdownScript this_obj_conv;
43066         this_obj_conv.inner = untag_ptr(this_obj);
43067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43069         ShutdownScript_free(this_obj_conv);
43070 }
43071
43072 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
43073         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
43074         int64_t ret_ref = 0;
43075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43077         return ret_ref;
43078 }
43079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43080         LDKShutdownScript arg_conv;
43081         arg_conv.inner = untag_ptr(arg);
43082         arg_conv.is_owned = ptr_is_owned(arg);
43083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43084         arg_conv.is_owned = false;
43085         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
43086         return ret_conv;
43087 }
43088
43089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43090         LDKShutdownScript orig_conv;
43091         orig_conv.inner = untag_ptr(orig);
43092         orig_conv.is_owned = ptr_is_owned(orig);
43093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43094         orig_conv.is_owned = false;
43095         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
43096         int64_t ret_ref = 0;
43097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43099         return ret_ref;
43100 }
43101
43102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43103         LDKInvalidShutdownScript this_obj_conv;
43104         this_obj_conv.inner = untag_ptr(this_obj);
43105         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43107         InvalidShutdownScript_free(this_obj_conv);
43108 }
43109
43110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
43111         LDKInvalidShutdownScript this_ptr_conv;
43112         this_ptr_conv.inner = untag_ptr(this_ptr);
43113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43115         this_ptr_conv.is_owned = false;
43116         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
43117         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43118         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43119         return ret_arr;
43120 }
43121
43122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43123         LDKInvalidShutdownScript this_ptr_conv;
43124         this_ptr_conv.inner = untag_ptr(this_ptr);
43125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43127         this_ptr_conv.is_owned = false;
43128         LDKCVec_u8Z val_ref;
43129         val_ref.datalen = (*env)->GetArrayLength(env, val);
43130         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43131         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
43132         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
43133 }
43134
43135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
43136         LDKCVec_u8Z script_arg_ref;
43137         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
43138         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43139         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
43140         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
43141         int64_t ret_ref = 0;
43142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43144         return ret_ref;
43145 }
43146
43147 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
43148         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
43149         int64_t ret_ref = 0;
43150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43152         return ret_ref;
43153 }
43154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43155         LDKInvalidShutdownScript arg_conv;
43156         arg_conv.inner = untag_ptr(arg);
43157         arg_conv.is_owned = ptr_is_owned(arg);
43158         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43159         arg_conv.is_owned = false;
43160         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
43161         return ret_conv;
43162 }
43163
43164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43165         LDKInvalidShutdownScript orig_conv;
43166         orig_conv.inner = untag_ptr(orig);
43167         orig_conv.is_owned = ptr_is_owned(orig);
43168         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43169         orig_conv.is_owned = false;
43170         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
43171         int64_t ret_ref = 0;
43172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43174         return ret_ref;
43175 }
43176
43177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
43178         LDKShutdownScript obj_conv;
43179         obj_conv.inner = untag_ptr(obj);
43180         obj_conv.is_owned = ptr_is_owned(obj);
43181         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43182         obj_conv.is_owned = false;
43183         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
43184         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43185         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43186         CVec_u8Z_free(ret_var);
43187         return ret_arr;
43188 }
43189
43190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43191         LDKu8slice ser_ref;
43192         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43193         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43194         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
43195         *ret_conv = ShutdownScript_read(ser_ref);
43196         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43197         return tag_ptr(ret_conv, true);
43198 }
43199
43200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
43201         unsigned char pubkey_hash_arr[20];
43202         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
43203         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
43204         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
43205         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
43206         int64_t ret_ref = 0;
43207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43209         return ret_ref;
43210 }
43211
43212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
43213         unsigned char script_hash_arr[32];
43214         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
43215         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
43216         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
43217         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
43218         int64_t ret_ref = 0;
43219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43221         return ret_ref;
43222 }
43223
43224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
43225         
43226         LDKu8slice program_ref;
43227         program_ref.datalen = (*env)->GetArrayLength(env, program);
43228         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
43229         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
43230         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
43231         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
43232         return tag_ptr(ret_conv, true);
43233 }
43234
43235 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
43236         LDKShutdownScript this_arg_conv;
43237         this_arg_conv.inner = untag_ptr(this_arg);
43238         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43240         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
43241         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
43242         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43243         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43244         CVec_u8Z_free(ret_var);
43245         return ret_arr;
43246 }
43247
43248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
43249         LDKShutdownScript this_arg_conv;
43250         this_arg_conv.inner = untag_ptr(this_arg);
43251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43253         this_arg_conv.is_owned = false;
43254         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43255         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
43256         return ret_arr;
43257 }
43258
43259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
43260         LDKShutdownScript this_arg_conv;
43261         this_arg_conv.inner = untag_ptr(this_arg);
43262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43264         this_arg_conv.is_owned = false;
43265         LDKInitFeatures features_conv;
43266         features_conv.inner = untag_ptr(features);
43267         features_conv.is_owned = ptr_is_owned(features);
43268         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
43269         features_conv.is_owned = false;
43270         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
43271         return ret_conv;
43272 }
43273
43274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43275         if (!ptr_is_owned(this_ptr)) return;
43276         void* this_ptr_ptr = untag_ptr(this_ptr);
43277         CHECK_ACCESS(this_ptr_ptr);
43278         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
43279         FREE(untag_ptr(this_ptr));
43280         CustomMessageReader_free(this_ptr_conv);
43281 }
43282
43283 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
43284         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
43285         *ret_ret = Type_clone(arg);
43286         return tag_ptr(ret_ret, true);
43287 }
43288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43289         void* arg_ptr = untag_ptr(arg);
43290         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
43291         LDKType* arg_conv = (LDKType*)arg_ptr;
43292         int64_t ret_conv = Type_clone_ptr(arg_conv);
43293         return ret_conv;
43294 }
43295
43296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43297         void* orig_ptr = untag_ptr(orig);
43298         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
43299         LDKType* orig_conv = (LDKType*)orig_ptr;
43300         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
43301         *ret_ret = Type_clone(orig_conv);
43302         return tag_ptr(ret_ret, true);
43303 }
43304
43305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43306         if (!ptr_is_owned(this_ptr)) return;
43307         void* this_ptr_ptr = untag_ptr(this_ptr);
43308         CHECK_ACCESS(this_ptr_ptr);
43309         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
43310         FREE(untag_ptr(this_ptr));
43311         Type_free(this_ptr_conv);
43312 }
43313
43314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43315         LDKNodeId this_obj_conv;
43316         this_obj_conv.inner = untag_ptr(this_obj);
43317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43319         NodeId_free(this_obj_conv);
43320 }
43321
43322 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
43323         LDKNodeId ret_var = NodeId_clone(arg);
43324         int64_t ret_ref = 0;
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43327         return ret_ref;
43328 }
43329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43330         LDKNodeId arg_conv;
43331         arg_conv.inner = untag_ptr(arg);
43332         arg_conv.is_owned = ptr_is_owned(arg);
43333         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43334         arg_conv.is_owned = false;
43335         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
43336         return ret_conv;
43337 }
43338
43339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43340         LDKNodeId orig_conv;
43341         orig_conv.inner = untag_ptr(orig);
43342         orig_conv.is_owned = ptr_is_owned(orig);
43343         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43344         orig_conv.is_owned = false;
43345         LDKNodeId ret_var = NodeId_clone(&orig_conv);
43346         int64_t ret_ref = 0;
43347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43349         return ret_ref;
43350 }
43351
43352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
43353         LDKPublicKey pubkey_ref;
43354         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
43355         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
43356         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
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 int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
43364         LDKNodeId this_arg_conv;
43365         this_arg_conv.inner = untag_ptr(this_arg);
43366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43368         this_arg_conv.is_owned = false;
43369         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
43370         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43371         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43372         return ret_arr;
43373 }
43374
43375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
43376         LDKNodeId o_conv;
43377         o_conv.inner = untag_ptr(o);
43378         o_conv.is_owned = ptr_is_owned(o);
43379         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43380         o_conv.is_owned = false;
43381         int64_t ret_conv = NodeId_hash(&o_conv);
43382         return ret_conv;
43383 }
43384
43385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
43386         LDKNodeId obj_conv;
43387         obj_conv.inner = untag_ptr(obj);
43388         obj_conv.is_owned = ptr_is_owned(obj);
43389         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43390         obj_conv.is_owned = false;
43391         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
43392         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43393         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43394         CVec_u8Z_free(ret_var);
43395         return ret_arr;
43396 }
43397
43398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43399         LDKu8slice ser_ref;
43400         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43401         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43402         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
43403         *ret_conv = NodeId_read(ser_ref);
43404         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43405         return tag_ptr(ret_conv, true);
43406 }
43407
43408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43409         LDKNetworkGraph this_obj_conv;
43410         this_obj_conv.inner = untag_ptr(this_obj);
43411         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43413         NetworkGraph_free(this_obj_conv);
43414 }
43415
43416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43417         LDKReadOnlyNetworkGraph this_obj_conv;
43418         this_obj_conv.inner = untag_ptr(this_obj);
43419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43421         ReadOnlyNetworkGraph_free(this_obj_conv);
43422 }
43423
43424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43425         if (!ptr_is_owned(this_ptr)) return;
43426         void* this_ptr_ptr = untag_ptr(this_ptr);
43427         CHECK_ACCESS(this_ptr_ptr);
43428         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
43429         FREE(untag_ptr(this_ptr));
43430         NetworkUpdate_free(this_ptr_conv);
43431 }
43432
43433 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
43434         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43435         *ret_copy = NetworkUpdate_clone(arg);
43436         int64_t ret_ref = tag_ptr(ret_copy, true);
43437         return ret_ref;
43438 }
43439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43440         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
43441         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
43442         return ret_conv;
43443 }
43444
43445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43446         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
43447         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43448         *ret_copy = NetworkUpdate_clone(orig_conv);
43449         int64_t ret_ref = tag_ptr(ret_copy, true);
43450         return ret_ref;
43451 }
43452
43453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
43454         LDKChannelUpdate msg_conv;
43455         msg_conv.inner = untag_ptr(msg);
43456         msg_conv.is_owned = ptr_is_owned(msg);
43457         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43458         msg_conv = ChannelUpdate_clone(&msg_conv);
43459         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43460         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
43461         int64_t ret_ref = tag_ptr(ret_copy, true);
43462         return ret_ref;
43463 }
43464
43465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
43466         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43467         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
43468         int64_t ret_ref = tag_ptr(ret_copy, true);
43469         return ret_ref;
43470 }
43471
43472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
43473         LDKPublicKey node_id_ref;
43474         CHECK((*env)->GetArrayLength(env, node_id) == 33);
43475         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
43476         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
43477         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
43478         int64_t ret_ref = tag_ptr(ret_copy, true);
43479         return ret_ref;
43480 }
43481
43482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
43483         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
43484         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
43485         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43486         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43487         CVec_u8Z_free(ret_var);
43488         return ret_arr;
43489 }
43490
43491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43492         LDKu8slice ser_ref;
43493         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43494         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43495         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
43496         *ret_conv = NetworkUpdate_read(ser_ref);
43497         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43498         return tag_ptr(ret_conv, true);
43499 }
43500
43501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43502         LDKP2PGossipSync this_obj_conv;
43503         this_obj_conv.inner = untag_ptr(this_obj);
43504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43506         P2PGossipSync_free(this_obj_conv);
43507 }
43508
43509 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) {
43510         LDKNetworkGraph network_graph_conv;
43511         network_graph_conv.inner = untag_ptr(network_graph);
43512         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43513         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43514         network_graph_conv.is_owned = false;
43515         void* chain_access_ptr = untag_ptr(chain_access);
43516         CHECK_ACCESS(chain_access_ptr);
43517         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43518         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43519         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43520                 // Manually implement clone for Java trait instances
43521                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43522                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43523                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43524                 }
43525         }
43526         void* logger_ptr = untag_ptr(logger);
43527         CHECK_ACCESS(logger_ptr);
43528         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43529         if (logger_conv.free == LDKLogger_JCalls_free) {
43530                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43531                 LDKLogger_JCalls_cloned(&logger_conv);
43532         }
43533         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
43534         int64_t ret_ref = 0;
43535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43537         return ret_ref;
43538 }
43539
43540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
43541         LDKP2PGossipSync this_arg_conv;
43542         this_arg_conv.inner = untag_ptr(this_arg);
43543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43545         this_arg_conv.is_owned = false;
43546         void* chain_access_ptr = untag_ptr(chain_access);
43547         CHECK_ACCESS(chain_access_ptr);
43548         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43549         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43550         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43551                 // Manually implement clone for Java trait instances
43552                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43553                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43554                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43555                 }
43556         }
43557         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
43558 }
43559
43560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
43561         LDKNetworkGraph this_arg_conv;
43562         this_arg_conv.inner = untag_ptr(this_arg);
43563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43565         this_arg_conv.is_owned = false;
43566         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
43567         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
43568         return tag_ptr(ret_ret, true);
43569 }
43570
43571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
43572         LDKP2PGossipSync this_arg_conv;
43573         this_arg_conv.inner = untag_ptr(this_arg);
43574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43576         this_arg_conv.is_owned = false;
43577         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
43578         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
43579         return tag_ptr(ret_ret, true);
43580 }
43581
43582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
43583         LDKP2PGossipSync this_arg_conv;
43584         this_arg_conv.inner = untag_ptr(this_arg);
43585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43587         this_arg_conv.is_owned = false;
43588         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43589         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
43590         return tag_ptr(ret_ret, true);
43591 }
43592
43593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43594         LDKChannelUpdateInfo this_obj_conv;
43595         this_obj_conv.inner = untag_ptr(this_obj);
43596         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43598         ChannelUpdateInfo_free(this_obj_conv);
43599 }
43600
43601 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
43602         LDKChannelUpdateInfo this_ptr_conv;
43603         this_ptr_conv.inner = untag_ptr(this_ptr);
43604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43606         this_ptr_conv.is_owned = false;
43607         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
43608         return ret_conv;
43609 }
43610
43611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43612         LDKChannelUpdateInfo this_ptr_conv;
43613         this_ptr_conv.inner = untag_ptr(this_ptr);
43614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43616         this_ptr_conv.is_owned = false;
43617         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
43618 }
43619
43620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
43621         LDKChannelUpdateInfo this_ptr_conv;
43622         this_ptr_conv.inner = untag_ptr(this_ptr);
43623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43625         this_ptr_conv.is_owned = false;
43626         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
43627         return ret_conv;
43628 }
43629
43630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43631         LDKChannelUpdateInfo this_ptr_conv;
43632         this_ptr_conv.inner = untag_ptr(this_ptr);
43633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43635         this_ptr_conv.is_owned = false;
43636         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
43637 }
43638
43639 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43640         LDKChannelUpdateInfo this_ptr_conv;
43641         this_ptr_conv.inner = untag_ptr(this_ptr);
43642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43644         this_ptr_conv.is_owned = false;
43645         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
43646         return ret_conv;
43647 }
43648
43649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43650         LDKChannelUpdateInfo this_ptr_conv;
43651         this_ptr_conv.inner = untag_ptr(this_ptr);
43652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43654         this_ptr_conv.is_owned = false;
43655         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
43656 }
43657
43658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43659         LDKChannelUpdateInfo this_ptr_conv;
43660         this_ptr_conv.inner = untag_ptr(this_ptr);
43661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43663         this_ptr_conv.is_owned = false;
43664         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
43665         return ret_conv;
43666 }
43667
43668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43669         LDKChannelUpdateInfo this_ptr_conv;
43670         this_ptr_conv.inner = untag_ptr(this_ptr);
43671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43673         this_ptr_conv.is_owned = false;
43674         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
43675 }
43676
43677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43678         LDKChannelUpdateInfo this_ptr_conv;
43679         this_ptr_conv.inner = untag_ptr(this_ptr);
43680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43682         this_ptr_conv.is_owned = false;
43683         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
43684         return ret_conv;
43685 }
43686
43687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43688         LDKChannelUpdateInfo this_ptr_conv;
43689         this_ptr_conv.inner = untag_ptr(this_ptr);
43690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43692         this_ptr_conv.is_owned = false;
43693         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
43694 }
43695
43696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
43697         LDKChannelUpdateInfo this_ptr_conv;
43698         this_ptr_conv.inner = untag_ptr(this_ptr);
43699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43701         this_ptr_conv.is_owned = false;
43702         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
43703         int64_t ret_ref = 0;
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43706         return ret_ref;
43707 }
43708
43709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43710         LDKChannelUpdateInfo this_ptr_conv;
43711         this_ptr_conv.inner = untag_ptr(this_ptr);
43712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43714         this_ptr_conv.is_owned = false;
43715         LDKRoutingFees val_conv;
43716         val_conv.inner = untag_ptr(val);
43717         val_conv.is_owned = ptr_is_owned(val);
43718         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43719         val_conv = RoutingFees_clone(&val_conv);
43720         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
43721 }
43722
43723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
43724         LDKChannelUpdateInfo this_ptr_conv;
43725         this_ptr_conv.inner = untag_ptr(this_ptr);
43726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43728         this_ptr_conv.is_owned = false;
43729         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
43730         int64_t ret_ref = 0;
43731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43733         return ret_ref;
43734 }
43735
43736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43737         LDKChannelUpdateInfo this_ptr_conv;
43738         this_ptr_conv.inner = untag_ptr(this_ptr);
43739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43741         this_ptr_conv.is_owned = false;
43742         LDKChannelUpdate val_conv;
43743         val_conv.inner = untag_ptr(val);
43744         val_conv.is_owned = ptr_is_owned(val);
43745         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43746         val_conv = ChannelUpdate_clone(&val_conv);
43747         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
43748 }
43749
43750 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) {
43751         LDKRoutingFees fees_arg_conv;
43752         fees_arg_conv.inner = untag_ptr(fees_arg);
43753         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
43754         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
43755         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
43756         LDKChannelUpdate last_update_message_arg_conv;
43757         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
43758         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
43760         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
43761         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);
43762         int64_t ret_ref = 0;
43763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43765         return ret_ref;
43766 }
43767
43768 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
43769         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
43770         int64_t ret_ref = 0;
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43773         return ret_ref;
43774 }
43775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43776         LDKChannelUpdateInfo arg_conv;
43777         arg_conv.inner = untag_ptr(arg);
43778         arg_conv.is_owned = ptr_is_owned(arg);
43779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43780         arg_conv.is_owned = false;
43781         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
43782         return ret_conv;
43783 }
43784
43785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43786         LDKChannelUpdateInfo orig_conv;
43787         orig_conv.inner = untag_ptr(orig);
43788         orig_conv.is_owned = ptr_is_owned(orig);
43789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43790         orig_conv.is_owned = false;
43791         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
43792         int64_t ret_ref = 0;
43793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43795         return ret_ref;
43796 }
43797
43798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
43799         LDKChannelUpdateInfo obj_conv;
43800         obj_conv.inner = untag_ptr(obj);
43801         obj_conv.is_owned = ptr_is_owned(obj);
43802         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43803         obj_conv.is_owned = false;
43804         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
43805         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43806         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43807         CVec_u8Z_free(ret_var);
43808         return ret_arr;
43809 }
43810
43811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43812         LDKu8slice ser_ref;
43813         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43814         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43815         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
43816         *ret_conv = ChannelUpdateInfo_read(ser_ref);
43817         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43818         return tag_ptr(ret_conv, true);
43819 }
43820
43821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43822         LDKChannelInfo this_obj_conv;
43823         this_obj_conv.inner = untag_ptr(this_obj);
43824         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43826         ChannelInfo_free(this_obj_conv);
43827 }
43828
43829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43830         LDKChannelInfo this_ptr_conv;
43831         this_ptr_conv.inner = untag_ptr(this_ptr);
43832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43834         this_ptr_conv.is_owned = false;
43835         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
43836         int64_t ret_ref = 0;
43837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43839         return ret_ref;
43840 }
43841
43842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43843         LDKChannelInfo this_ptr_conv;
43844         this_ptr_conv.inner = untag_ptr(this_ptr);
43845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43847         this_ptr_conv.is_owned = false;
43848         LDKChannelFeatures val_conv;
43849         val_conv.inner = untag_ptr(val);
43850         val_conv.is_owned = ptr_is_owned(val);
43851         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43852         val_conv = ChannelFeatures_clone(&val_conv);
43853         ChannelInfo_set_features(&this_ptr_conv, val_conv);
43854 }
43855
43856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
43857         LDKChannelInfo this_ptr_conv;
43858         this_ptr_conv.inner = untag_ptr(this_ptr);
43859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43861         this_ptr_conv.is_owned = false;
43862         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
43863         int64_t ret_ref = 0;
43864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43866         return ret_ref;
43867 }
43868
43869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43870         LDKChannelInfo this_ptr_conv;
43871         this_ptr_conv.inner = untag_ptr(this_ptr);
43872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43874         this_ptr_conv.is_owned = false;
43875         LDKNodeId val_conv;
43876         val_conv.inner = untag_ptr(val);
43877         val_conv.is_owned = ptr_is_owned(val);
43878         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43879         val_conv = NodeId_clone(&val_conv);
43880         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
43881 }
43882
43883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
43884         LDKChannelInfo this_ptr_conv;
43885         this_ptr_conv.inner = untag_ptr(this_ptr);
43886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43888         this_ptr_conv.is_owned = false;
43889         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
43890         int64_t ret_ref = 0;
43891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43893         return ret_ref;
43894 }
43895
43896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43897         LDKChannelInfo this_ptr_conv;
43898         this_ptr_conv.inner = untag_ptr(this_ptr);
43899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43901         this_ptr_conv.is_owned = false;
43902         LDKChannelUpdateInfo val_conv;
43903         val_conv.inner = untag_ptr(val);
43904         val_conv.is_owned = ptr_is_owned(val);
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43906         val_conv = ChannelUpdateInfo_clone(&val_conv);
43907         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
43908 }
43909
43910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
43911         LDKChannelInfo this_ptr_conv;
43912         this_ptr_conv.inner = untag_ptr(this_ptr);
43913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43915         this_ptr_conv.is_owned = false;
43916         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
43917         int64_t ret_ref = 0;
43918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43920         return ret_ref;
43921 }
43922
43923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43924         LDKChannelInfo this_ptr_conv;
43925         this_ptr_conv.inner = untag_ptr(this_ptr);
43926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43928         this_ptr_conv.is_owned = false;
43929         LDKNodeId val_conv;
43930         val_conv.inner = untag_ptr(val);
43931         val_conv.is_owned = ptr_is_owned(val);
43932         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43933         val_conv = NodeId_clone(&val_conv);
43934         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
43935 }
43936
43937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
43938         LDKChannelInfo this_ptr_conv;
43939         this_ptr_conv.inner = untag_ptr(this_ptr);
43940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43942         this_ptr_conv.is_owned = false;
43943         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
43944         int64_t ret_ref = 0;
43945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43947         return ret_ref;
43948 }
43949
43950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43951         LDKChannelInfo this_ptr_conv;
43952         this_ptr_conv.inner = untag_ptr(this_ptr);
43953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43955         this_ptr_conv.is_owned = false;
43956         LDKChannelUpdateInfo val_conv;
43957         val_conv.inner = untag_ptr(val);
43958         val_conv.is_owned = ptr_is_owned(val);
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43960         val_conv = ChannelUpdateInfo_clone(&val_conv);
43961         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
43962 }
43963
43964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
43965         LDKChannelInfo this_ptr_conv;
43966         this_ptr_conv.inner = untag_ptr(this_ptr);
43967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43969         this_ptr_conv.is_owned = false;
43970         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43971         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
43972         int64_t ret_ref = tag_ptr(ret_copy, true);
43973         return ret_ref;
43974 }
43975
43976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43977         LDKChannelInfo this_ptr_conv;
43978         this_ptr_conv.inner = untag_ptr(this_ptr);
43979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43981         this_ptr_conv.is_owned = false;
43982         void* val_ptr = untag_ptr(val);
43983         CHECK_ACCESS(val_ptr);
43984         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43985         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43986         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
43987 }
43988
43989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
43990         LDKChannelInfo this_ptr_conv;
43991         this_ptr_conv.inner = untag_ptr(this_ptr);
43992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43994         this_ptr_conv.is_owned = false;
43995         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
43996         int64_t ret_ref = 0;
43997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43999         return ret_ref;
44000 }
44001
44002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44003         LDKChannelInfo this_ptr_conv;
44004         this_ptr_conv.inner = untag_ptr(this_ptr);
44005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44007         this_ptr_conv.is_owned = false;
44008         LDKChannelAnnouncement val_conv;
44009         val_conv.inner = untag_ptr(val);
44010         val_conv.is_owned = ptr_is_owned(val);
44011         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44012         val_conv = ChannelAnnouncement_clone(&val_conv);
44013         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
44014 }
44015
44016 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
44017         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
44018         int64_t ret_ref = 0;
44019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44021         return ret_ref;
44022 }
44023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44024         LDKChannelInfo arg_conv;
44025         arg_conv.inner = untag_ptr(arg);
44026         arg_conv.is_owned = ptr_is_owned(arg);
44027         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44028         arg_conv.is_owned = false;
44029         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
44030         return ret_conv;
44031 }
44032
44033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44034         LDKChannelInfo orig_conv;
44035         orig_conv.inner = untag_ptr(orig);
44036         orig_conv.is_owned = ptr_is_owned(orig);
44037         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44038         orig_conv.is_owned = false;
44039         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
44040         int64_t ret_ref = 0;
44041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44043         return ret_ref;
44044 }
44045
44046 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) {
44047         LDKChannelInfo this_arg_conv;
44048         this_arg_conv.inner = untag_ptr(this_arg);
44049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44051         this_arg_conv.is_owned = false;
44052         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
44053         int64_t ret_ref = 0;
44054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44056         return ret_ref;
44057 }
44058
44059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44060         LDKChannelInfo obj_conv;
44061         obj_conv.inner = untag_ptr(obj);
44062         obj_conv.is_owned = ptr_is_owned(obj);
44063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44064         obj_conv.is_owned = false;
44065         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
44066         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44067         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44068         CVec_u8Z_free(ret_var);
44069         return ret_arr;
44070 }
44071
44072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44073         LDKu8slice ser_ref;
44074         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44075         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44076         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
44077         *ret_conv = ChannelInfo_read(ser_ref);
44078         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44079         return tag_ptr(ret_conv, true);
44080 }
44081
44082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44083         LDKDirectedChannelInfo this_obj_conv;
44084         this_obj_conv.inner = untag_ptr(this_obj);
44085         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44087         DirectedChannelInfo_free(this_obj_conv);
44088 }
44089
44090 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
44091         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
44092         int64_t ret_ref = 0;
44093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44095         return ret_ref;
44096 }
44097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44098         LDKDirectedChannelInfo arg_conv;
44099         arg_conv.inner = untag_ptr(arg);
44100         arg_conv.is_owned = ptr_is_owned(arg);
44101         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44102         arg_conv.is_owned = false;
44103         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
44104         return ret_conv;
44105 }
44106
44107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44108         LDKDirectedChannelInfo orig_conv;
44109         orig_conv.inner = untag_ptr(orig);
44110         orig_conv.is_owned = ptr_is_owned(orig);
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44112         orig_conv.is_owned = false;
44113         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
44114         int64_t ret_ref = 0;
44115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44117         return ret_ref;
44118 }
44119
44120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
44121         LDKDirectedChannelInfo this_arg_conv;
44122         this_arg_conv.inner = untag_ptr(this_arg);
44123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44125         this_arg_conv.is_owned = false;
44126         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
44127         int64_t ret_ref = 0;
44128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44130         return ret_ref;
44131 }
44132
44133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
44134         LDKDirectedChannelInfo this_arg_conv;
44135         this_arg_conv.inner = untag_ptr(this_arg);
44136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44138         this_arg_conv.is_owned = false;
44139         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
44140         int64_t ret_ref = 0;
44141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44143         return ret_ref;
44144 }
44145
44146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
44147         LDKDirectedChannelInfo this_arg_conv;
44148         this_arg_conv.inner = untag_ptr(this_arg);
44149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44151         this_arg_conv.is_owned = false;
44152         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
44153         return ret_conv;
44154 }
44155
44156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
44157         LDKDirectedChannelInfo this_arg_conv;
44158         this_arg_conv.inner = untag_ptr(this_arg);
44159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44161         this_arg_conv.is_owned = false;
44162         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44163         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
44164         int64_t ret_ref = tag_ptr(ret_copy, true);
44165         return ret_ref;
44166 }
44167
44168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44169         if (!ptr_is_owned(this_ptr)) return;
44170         void* this_ptr_ptr = untag_ptr(this_ptr);
44171         CHECK_ACCESS(this_ptr_ptr);
44172         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
44173         FREE(untag_ptr(this_ptr));
44174         EffectiveCapacity_free(this_ptr_conv);
44175 }
44176
44177 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
44178         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44179         *ret_copy = EffectiveCapacity_clone(arg);
44180         int64_t ret_ref = tag_ptr(ret_copy, true);
44181         return ret_ref;
44182 }
44183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44184         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
44185         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
44186         return ret_conv;
44187 }
44188
44189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44190         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
44191         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44192         *ret_copy = EffectiveCapacity_clone(orig_conv);
44193         int64_t ret_ref = tag_ptr(ret_copy, true);
44194         return ret_ref;
44195 }
44196
44197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
44198         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44199         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
44200         int64_t ret_ref = tag_ptr(ret_copy, true);
44201         return ret_ref;
44202 }
44203
44204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
44205         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44206         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
44207         int64_t ret_ref = tag_ptr(ret_copy, true);
44208         return ret_ref;
44209 }
44210
44211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
44212         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
44213         CHECK_ACCESS(htlc_maximum_msat_ptr);
44214         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
44215         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
44216         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44217         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
44218         int64_t ret_ref = tag_ptr(ret_copy, true);
44219         return ret_ref;
44220 }
44221
44222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
44223         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44224         *ret_copy = EffectiveCapacity_infinite();
44225         int64_t ret_ref = tag_ptr(ret_copy, true);
44226         return ret_ref;
44227 }
44228
44229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
44230         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44231         *ret_copy = EffectiveCapacity_unknown();
44232         int64_t ret_ref = tag_ptr(ret_copy, true);
44233         return ret_ref;
44234 }
44235
44236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
44237         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
44238         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
44239         return ret_conv;
44240 }
44241
44242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44243         LDKRoutingFees this_obj_conv;
44244         this_obj_conv.inner = untag_ptr(this_obj);
44245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44247         RoutingFees_free(this_obj_conv);
44248 }
44249
44250 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44251         LDKRoutingFees this_ptr_conv;
44252         this_ptr_conv.inner = untag_ptr(this_ptr);
44253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44255         this_ptr_conv.is_owned = false;
44256         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
44257         return ret_conv;
44258 }
44259
44260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44261         LDKRoutingFees this_ptr_conv;
44262         this_ptr_conv.inner = untag_ptr(this_ptr);
44263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44265         this_ptr_conv.is_owned = false;
44266         RoutingFees_set_base_msat(&this_ptr_conv, val);
44267 }
44268
44269 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
44270         LDKRoutingFees this_ptr_conv;
44271         this_ptr_conv.inner = untag_ptr(this_ptr);
44272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44274         this_ptr_conv.is_owned = false;
44275         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
44276         return ret_conv;
44277 }
44278
44279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44280         LDKRoutingFees this_ptr_conv;
44281         this_ptr_conv.inner = untag_ptr(this_ptr);
44282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44284         this_ptr_conv.is_owned = false;
44285         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
44286 }
44287
44288 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) {
44289         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
44290         int64_t ret_ref = 0;
44291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44293         return ret_ref;
44294 }
44295
44296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44297         LDKRoutingFees a_conv;
44298         a_conv.inner = untag_ptr(a);
44299         a_conv.is_owned = ptr_is_owned(a);
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44301         a_conv.is_owned = false;
44302         LDKRoutingFees b_conv;
44303         b_conv.inner = untag_ptr(b);
44304         b_conv.is_owned = ptr_is_owned(b);
44305         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44306         b_conv.is_owned = false;
44307         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
44308         return ret_conv;
44309 }
44310
44311 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
44312         LDKRoutingFees ret_var = RoutingFees_clone(arg);
44313         int64_t ret_ref = 0;
44314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44316         return ret_ref;
44317 }
44318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44319         LDKRoutingFees arg_conv;
44320         arg_conv.inner = untag_ptr(arg);
44321         arg_conv.is_owned = ptr_is_owned(arg);
44322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44323         arg_conv.is_owned = false;
44324         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
44325         return ret_conv;
44326 }
44327
44328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44329         LDKRoutingFees orig_conv;
44330         orig_conv.inner = untag_ptr(orig);
44331         orig_conv.is_owned = ptr_is_owned(orig);
44332         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44333         orig_conv.is_owned = false;
44334         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
44335         int64_t ret_ref = 0;
44336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44338         return ret_ref;
44339 }
44340
44341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
44342         LDKRoutingFees o_conv;
44343         o_conv.inner = untag_ptr(o);
44344         o_conv.is_owned = ptr_is_owned(o);
44345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44346         o_conv.is_owned = false;
44347         int64_t ret_conv = RoutingFees_hash(&o_conv);
44348         return ret_conv;
44349 }
44350
44351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
44352         LDKRoutingFees obj_conv;
44353         obj_conv.inner = untag_ptr(obj);
44354         obj_conv.is_owned = ptr_is_owned(obj);
44355         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44356         obj_conv.is_owned = false;
44357         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
44358         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44359         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44360         CVec_u8Z_free(ret_var);
44361         return ret_arr;
44362 }
44363
44364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44365         LDKu8slice ser_ref;
44366         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44367         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44368         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
44369         *ret_conv = RoutingFees_read(ser_ref);
44370         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44371         return tag_ptr(ret_conv, true);
44372 }
44373
44374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44375         LDKNodeAnnouncementInfo this_obj_conv;
44376         this_obj_conv.inner = untag_ptr(this_obj);
44377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44379         NodeAnnouncementInfo_free(this_obj_conv);
44380 }
44381
44382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
44383         LDKNodeAnnouncementInfo this_ptr_conv;
44384         this_ptr_conv.inner = untag_ptr(this_ptr);
44385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44387         this_ptr_conv.is_owned = false;
44388         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
44389         int64_t ret_ref = 0;
44390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44392         return ret_ref;
44393 }
44394
44395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44396         LDKNodeAnnouncementInfo this_ptr_conv;
44397         this_ptr_conv.inner = untag_ptr(this_ptr);
44398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44400         this_ptr_conv.is_owned = false;
44401         LDKNodeFeatures val_conv;
44402         val_conv.inner = untag_ptr(val);
44403         val_conv.is_owned = ptr_is_owned(val);
44404         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44405         val_conv = NodeFeatures_clone(&val_conv);
44406         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
44407 }
44408
44409 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
44410         LDKNodeAnnouncementInfo this_ptr_conv;
44411         this_ptr_conv.inner = untag_ptr(this_ptr);
44412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44414         this_ptr_conv.is_owned = false;
44415         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
44416         return ret_conv;
44417 }
44418
44419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44420         LDKNodeAnnouncementInfo this_ptr_conv;
44421         this_ptr_conv.inner = untag_ptr(this_ptr);
44422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44424         this_ptr_conv.is_owned = false;
44425         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
44426 }
44427
44428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
44429         LDKNodeAnnouncementInfo this_ptr_conv;
44430         this_ptr_conv.inner = untag_ptr(this_ptr);
44431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44433         this_ptr_conv.is_owned = false;
44434         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
44435         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
44436         return ret_arr;
44437 }
44438
44439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44440         LDKNodeAnnouncementInfo this_ptr_conv;
44441         this_ptr_conv.inner = untag_ptr(this_ptr);
44442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44444         this_ptr_conv.is_owned = false;
44445         LDKThreeBytes val_ref;
44446         CHECK((*env)->GetArrayLength(env, val) == 3);
44447         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
44448         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
44449 }
44450
44451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
44452         LDKNodeAnnouncementInfo this_ptr_conv;
44453         this_ptr_conv.inner = untag_ptr(this_ptr);
44454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44456         this_ptr_conv.is_owned = false;
44457         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
44458         int64_t ret_ref = 0;
44459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44461         return ret_ref;
44462 }
44463
44464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44465         LDKNodeAnnouncementInfo this_ptr_conv;
44466         this_ptr_conv.inner = untag_ptr(this_ptr);
44467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44469         this_ptr_conv.is_owned = false;
44470         LDKNodeAlias val_conv;
44471         val_conv.inner = untag_ptr(val);
44472         val_conv.is_owned = ptr_is_owned(val);
44473         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44474         val_conv = NodeAlias_clone(&val_conv);
44475         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
44476 }
44477
44478 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
44479         LDKNodeAnnouncementInfo this_ptr_conv;
44480         this_ptr_conv.inner = untag_ptr(this_ptr);
44481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44483         this_ptr_conv.is_owned = false;
44484         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
44485         int64_tArray ret_arr = NULL;
44486         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44487         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44488         for (size_t m = 0; m < ret_var.datalen; m++) {
44489                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
44490                 *ret_conv_12_copy = ret_var.data[m];
44491                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
44492                 ret_arr_ptr[m] = ret_conv_12_ref;
44493         }
44494         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44495         FREE(ret_var.data);
44496         return ret_arr;
44497 }
44498
44499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44500         LDKNodeAnnouncementInfo this_ptr_conv;
44501         this_ptr_conv.inner = untag_ptr(this_ptr);
44502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44504         this_ptr_conv.is_owned = false;
44505         LDKCVec_NetAddressZ val_constr;
44506         val_constr.datalen = (*env)->GetArrayLength(env, val);
44507         if (val_constr.datalen > 0)
44508                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44509         else
44510                 val_constr.data = NULL;
44511         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44512         for (size_t m = 0; m < val_constr.datalen; m++) {
44513                 int64_t val_conv_12 = val_vals[m];
44514                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
44515                 CHECK_ACCESS(val_conv_12_ptr);
44516                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
44517                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
44518                 val_constr.data[m] = val_conv_12_conv;
44519         }
44520         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44521         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
44522 }
44523
44524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
44525         LDKNodeAnnouncementInfo this_ptr_conv;
44526         this_ptr_conv.inner = untag_ptr(this_ptr);
44527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44529         this_ptr_conv.is_owned = false;
44530         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
44531         int64_t ret_ref = 0;
44532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44534         return ret_ref;
44535 }
44536
44537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44538         LDKNodeAnnouncementInfo this_ptr_conv;
44539         this_ptr_conv.inner = untag_ptr(this_ptr);
44540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44542         this_ptr_conv.is_owned = false;
44543         LDKNodeAnnouncement val_conv;
44544         val_conv.inner = untag_ptr(val);
44545         val_conv.is_owned = ptr_is_owned(val);
44546         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44547         val_conv = NodeAnnouncement_clone(&val_conv);
44548         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
44549 }
44550
44551 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) {
44552         LDKNodeFeatures features_arg_conv;
44553         features_arg_conv.inner = untag_ptr(features_arg);
44554         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44555         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44556         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
44557         LDKThreeBytes rgb_arg_ref;
44558         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
44559         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
44560         LDKNodeAlias alias_arg_conv;
44561         alias_arg_conv.inner = untag_ptr(alias_arg);
44562         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
44563         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
44564         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
44565         LDKCVec_NetAddressZ addresses_arg_constr;
44566         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
44567         if (addresses_arg_constr.datalen > 0)
44568                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44569         else
44570                 addresses_arg_constr.data = NULL;
44571         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
44572         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
44573                 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
44574                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
44575                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
44576                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
44577                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
44578         }
44579         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
44580         LDKNodeAnnouncement announcement_message_arg_conv;
44581         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
44582         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
44583         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
44584         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
44585         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
44586         int64_t ret_ref = 0;
44587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44589         return ret_ref;
44590 }
44591
44592 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
44593         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
44594         int64_t ret_ref = 0;
44595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44597         return ret_ref;
44598 }
44599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44600         LDKNodeAnnouncementInfo arg_conv;
44601         arg_conv.inner = untag_ptr(arg);
44602         arg_conv.is_owned = ptr_is_owned(arg);
44603         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44604         arg_conv.is_owned = false;
44605         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
44606         return ret_conv;
44607 }
44608
44609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44610         LDKNodeAnnouncementInfo orig_conv;
44611         orig_conv.inner = untag_ptr(orig);
44612         orig_conv.is_owned = ptr_is_owned(orig);
44613         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44614         orig_conv.is_owned = false;
44615         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
44616         int64_t ret_ref = 0;
44617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44619         return ret_ref;
44620 }
44621
44622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44623         LDKNodeAnnouncementInfo obj_conv;
44624         obj_conv.inner = untag_ptr(obj);
44625         obj_conv.is_owned = ptr_is_owned(obj);
44626         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44627         obj_conv.is_owned = false;
44628         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
44629         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44630         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44631         CVec_u8Z_free(ret_var);
44632         return ret_arr;
44633 }
44634
44635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44636         LDKu8slice ser_ref;
44637         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44638         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44639         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
44640         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
44641         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44642         return tag_ptr(ret_conv, true);
44643 }
44644
44645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44646         LDKNodeAlias this_obj_conv;
44647         this_obj_conv.inner = untag_ptr(this_obj);
44648         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44650         NodeAlias_free(this_obj_conv);
44651 }
44652
44653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44654         LDKNodeAlias this_ptr_conv;
44655         this_ptr_conv.inner = untag_ptr(this_ptr);
44656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44658         this_ptr_conv.is_owned = false;
44659         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44660         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
44661         return ret_arr;
44662 }
44663
44664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44665         LDKNodeAlias this_ptr_conv;
44666         this_ptr_conv.inner = untag_ptr(this_ptr);
44667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44669         this_ptr_conv.is_owned = false;
44670         LDKThirtyTwoBytes val_ref;
44671         CHECK((*env)->GetArrayLength(env, val) == 32);
44672         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44673         NodeAlias_set_a(&this_ptr_conv, val_ref);
44674 }
44675
44676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
44677         LDKThirtyTwoBytes a_arg_ref;
44678         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
44679         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
44680         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
44681         int64_t ret_ref = 0;
44682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44684         return ret_ref;
44685 }
44686
44687 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
44688         LDKNodeAlias ret_var = NodeAlias_clone(arg);
44689         int64_t ret_ref = 0;
44690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44692         return ret_ref;
44693 }
44694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44695         LDKNodeAlias arg_conv;
44696         arg_conv.inner = untag_ptr(arg);
44697         arg_conv.is_owned = ptr_is_owned(arg);
44698         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44699         arg_conv.is_owned = false;
44700         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
44701         return ret_conv;
44702 }
44703
44704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44705         LDKNodeAlias orig_conv;
44706         orig_conv.inner = untag_ptr(orig);
44707         orig_conv.is_owned = ptr_is_owned(orig);
44708         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44709         orig_conv.is_owned = false;
44710         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
44711         int64_t ret_ref = 0;
44712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44714         return ret_ref;
44715 }
44716
44717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
44718         LDKNodeAlias obj_conv;
44719         obj_conv.inner = untag_ptr(obj);
44720         obj_conv.is_owned = ptr_is_owned(obj);
44721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44722         obj_conv.is_owned = false;
44723         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
44724         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44725         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44726         CVec_u8Z_free(ret_var);
44727         return ret_arr;
44728 }
44729
44730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44731         LDKu8slice ser_ref;
44732         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44733         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44734         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
44735         *ret_conv = NodeAlias_read(ser_ref);
44736         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44737         return tag_ptr(ret_conv, true);
44738 }
44739
44740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44741         LDKNodeInfo this_obj_conv;
44742         this_obj_conv.inner = untag_ptr(this_obj);
44743         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44745         NodeInfo_free(this_obj_conv);
44746 }
44747
44748 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44749         LDKNodeInfo this_ptr_conv;
44750         this_ptr_conv.inner = untag_ptr(this_ptr);
44751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44753         this_ptr_conv.is_owned = false;
44754         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
44755         int64_tArray ret_arr = NULL;
44756         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44757         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44758         for (size_t g = 0; g < ret_var.datalen; g++) {
44759                 int64_t ret_conv_6_conv = ret_var.data[g];
44760                 ret_arr_ptr[g] = ret_conv_6_conv;
44761         }
44762         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44763         FREE(ret_var.data);
44764         return ret_arr;
44765 }
44766
44767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44768         LDKNodeInfo this_ptr_conv;
44769         this_ptr_conv.inner = untag_ptr(this_ptr);
44770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44772         this_ptr_conv.is_owned = false;
44773         LDKCVec_u64Z val_constr;
44774         val_constr.datalen = (*env)->GetArrayLength(env, val);
44775         if (val_constr.datalen > 0)
44776                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44777         else
44778                 val_constr.data = NULL;
44779         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44780         for (size_t g = 0; g < val_constr.datalen; g++) {
44781                 int64_t val_conv_6 = val_vals[g];
44782                 val_constr.data[g] = val_conv_6;
44783         }
44784         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44785         NodeInfo_set_channels(&this_ptr_conv, val_constr);
44786 }
44787
44788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
44789         LDKNodeInfo this_ptr_conv;
44790         this_ptr_conv.inner = untag_ptr(this_ptr);
44791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44793         this_ptr_conv.is_owned = false;
44794         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
44795         int64_t ret_ref = 0;
44796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44798         return ret_ref;
44799 }
44800
44801 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) {
44802         LDKNodeInfo this_ptr_conv;
44803         this_ptr_conv.inner = untag_ptr(this_ptr);
44804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44806         this_ptr_conv.is_owned = false;
44807         LDKRoutingFees val_conv;
44808         val_conv.inner = untag_ptr(val);
44809         val_conv.is_owned = ptr_is_owned(val);
44810         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44811         val_conv = RoutingFees_clone(&val_conv);
44812         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
44813 }
44814
44815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
44816         LDKNodeInfo this_ptr_conv;
44817         this_ptr_conv.inner = untag_ptr(this_ptr);
44818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44820         this_ptr_conv.is_owned = false;
44821         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
44822         int64_t ret_ref = 0;
44823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44825         return ret_ref;
44826 }
44827
44828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44829         LDKNodeInfo this_ptr_conv;
44830         this_ptr_conv.inner = untag_ptr(this_ptr);
44831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44833         this_ptr_conv.is_owned = false;
44834         LDKNodeAnnouncementInfo val_conv;
44835         val_conv.inner = untag_ptr(val);
44836         val_conv.is_owned = ptr_is_owned(val);
44837         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44838         val_conv = NodeAnnouncementInfo_clone(&val_conv);
44839         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
44840 }
44841
44842 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) {
44843         LDKCVec_u64Z channels_arg_constr;
44844         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
44845         if (channels_arg_constr.datalen > 0)
44846                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44847         else
44848                 channels_arg_constr.data = NULL;
44849         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
44850         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
44851                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
44852                 channels_arg_constr.data[g] = channels_arg_conv_6;
44853         }
44854         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
44855         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
44856         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
44857         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
44858         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
44859         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
44860         LDKNodeAnnouncementInfo announcement_info_arg_conv;
44861         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
44862         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
44863         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
44864         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
44865         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
44866         int64_t ret_ref = 0;
44867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44869         return ret_ref;
44870 }
44871
44872 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
44873         LDKNodeInfo ret_var = NodeInfo_clone(arg);
44874         int64_t ret_ref = 0;
44875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44877         return ret_ref;
44878 }
44879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44880         LDKNodeInfo arg_conv;
44881         arg_conv.inner = untag_ptr(arg);
44882         arg_conv.is_owned = ptr_is_owned(arg);
44883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44884         arg_conv.is_owned = false;
44885         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
44886         return ret_conv;
44887 }
44888
44889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44890         LDKNodeInfo orig_conv;
44891         orig_conv.inner = untag_ptr(orig);
44892         orig_conv.is_owned = ptr_is_owned(orig);
44893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44894         orig_conv.is_owned = false;
44895         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
44896         int64_t ret_ref = 0;
44897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44899         return ret_ref;
44900 }
44901
44902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
44903         LDKNodeInfo obj_conv;
44904         obj_conv.inner = untag_ptr(obj);
44905         obj_conv.is_owned = ptr_is_owned(obj);
44906         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44907         obj_conv.is_owned = false;
44908         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
44909         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44910         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44911         CVec_u8Z_free(ret_var);
44912         return ret_arr;
44913 }
44914
44915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44916         LDKu8slice ser_ref;
44917         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44918         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44919         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
44920         *ret_conv = NodeInfo_read(ser_ref);
44921         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44922         return tag_ptr(ret_conv, true);
44923 }
44924
44925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
44926         LDKNetworkGraph obj_conv;
44927         obj_conv.inner = untag_ptr(obj);
44928         obj_conv.is_owned = ptr_is_owned(obj);
44929         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44930         obj_conv.is_owned = false;
44931         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
44932         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44933         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44934         CVec_u8Z_free(ret_var);
44935         return ret_arr;
44936 }
44937
44938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
44939         LDKu8slice ser_ref;
44940         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44941         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44942         void* arg_ptr = untag_ptr(arg);
44943         CHECK_ACCESS(arg_ptr);
44944         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
44945         if (arg_conv.free == LDKLogger_JCalls_free) {
44946                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44947                 LDKLogger_JCalls_cloned(&arg_conv);
44948         }
44949         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
44950         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
44951         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44952         return tag_ptr(ret_conv, true);
44953 }
44954
44955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
44956         LDKThirtyTwoBytes genesis_hash_ref;
44957         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
44958         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
44959         void* logger_ptr = untag_ptr(logger);
44960         CHECK_ACCESS(logger_ptr);
44961         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44962         if (logger_conv.free == LDKLogger_JCalls_free) {
44963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44964                 LDKLogger_JCalls_cloned(&logger_conv);
44965         }
44966         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
44967         int64_t ret_ref = 0;
44968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44970         return ret_ref;
44971 }
44972
44973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
44974         LDKNetworkGraph this_arg_conv;
44975         this_arg_conv.inner = untag_ptr(this_arg);
44976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44978         this_arg_conv.is_owned = false;
44979         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
44980         int64_t ret_ref = 0;
44981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44983         return ret_ref;
44984 }
44985
44986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
44987         LDKNetworkGraph this_arg_conv;
44988         this_arg_conv.inner = untag_ptr(this_arg);
44989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44991         this_arg_conv.is_owned = false;
44992         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
44993         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
44994         int64_t ret_ref = tag_ptr(ret_copy, true);
44995         return ret_ref;
44996 }
44997
44998 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) {
44999         LDKNetworkGraph this_arg_conv;
45000         this_arg_conv.inner = untag_ptr(this_arg);
45001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45003         this_arg_conv.is_owned = false;
45004         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
45005 }
45006
45007 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) {
45008         LDKNetworkGraph this_arg_conv;
45009         this_arg_conv.inner = untag_ptr(this_arg);
45010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45012         this_arg_conv.is_owned = false;
45013         LDKNodeAnnouncement msg_conv;
45014         msg_conv.inner = untag_ptr(msg);
45015         msg_conv.is_owned = ptr_is_owned(msg);
45016         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45017         msg_conv.is_owned = false;
45018         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45019         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
45020         return tag_ptr(ret_conv, true);
45021 }
45022
45023 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) {
45024         LDKNetworkGraph this_arg_conv;
45025         this_arg_conv.inner = untag_ptr(this_arg);
45026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45028         this_arg_conv.is_owned = false;
45029         LDKUnsignedNodeAnnouncement msg_conv;
45030         msg_conv.inner = untag_ptr(msg);
45031         msg_conv.is_owned = ptr_is_owned(msg);
45032         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45033         msg_conv.is_owned = false;
45034         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45035         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
45036         return tag_ptr(ret_conv, true);
45037 }
45038
45039 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) {
45040         LDKNetworkGraph this_arg_conv;
45041         this_arg_conv.inner = untag_ptr(this_arg);
45042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45044         this_arg_conv.is_owned = false;
45045         LDKChannelAnnouncement msg_conv;
45046         msg_conv.inner = untag_ptr(msg);
45047         msg_conv.is_owned = ptr_is_owned(msg);
45048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45049         msg_conv.is_owned = false;
45050         void* chain_access_ptr = untag_ptr(chain_access);
45051         CHECK_ACCESS(chain_access_ptr);
45052         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
45053         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
45054         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
45055                 // Manually implement clone for Java trait instances
45056                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
45057                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45058                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
45059                 }
45060         }
45061         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45062         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
45063         return tag_ptr(ret_conv, true);
45064 }
45065
45066 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) {
45067         LDKNetworkGraph this_arg_conv;
45068         this_arg_conv.inner = untag_ptr(this_arg);
45069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45071         this_arg_conv.is_owned = false;
45072         LDKUnsignedChannelAnnouncement msg_conv;
45073         msg_conv.inner = untag_ptr(msg);
45074         msg_conv.is_owned = ptr_is_owned(msg);
45075         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45076         msg_conv.is_owned = false;
45077         void* chain_access_ptr = untag_ptr(chain_access);
45078         CHECK_ACCESS(chain_access_ptr);
45079         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
45080         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
45081         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
45082                 // Manually implement clone for Java trait instances
45083                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
45084                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45085                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
45086                 }
45087         }
45088         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45089         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
45090         return tag_ptr(ret_conv, true);
45091 }
45092
45093 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) {
45094         LDKNetworkGraph this_arg_conv;
45095         this_arg_conv.inner = untag_ptr(this_arg);
45096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45098         this_arg_conv.is_owned = false;
45099         LDKChannelFeatures features_conv;
45100         features_conv.inner = untag_ptr(features);
45101         features_conv.is_owned = ptr_is_owned(features);
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
45103         features_conv = ChannelFeatures_clone(&features_conv);
45104         LDKPublicKey node_id_1_ref;
45105         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
45106         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
45107         LDKPublicKey node_id_2_ref;
45108         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
45109         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
45110         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45111         *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);
45112         return tag_ptr(ret_conv, true);
45113 }
45114
45115 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) {
45116         LDKNetworkGraph this_arg_conv;
45117         this_arg_conv.inner = untag_ptr(this_arg);
45118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45120         this_arg_conv.is_owned = false;
45121         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
45122 }
45123
45124 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) {
45125         LDKNetworkGraph this_arg_conv;
45126         this_arg_conv.inner = untag_ptr(this_arg);
45127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45129         this_arg_conv.is_owned = false;
45130         LDKPublicKey _node_id_ref;
45131         CHECK((*env)->GetArrayLength(env, _node_id) == 33);
45132         (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
45133         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
45134 }
45135
45136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
45137         LDKNetworkGraph this_arg_conv;
45138         this_arg_conv.inner = untag_ptr(this_arg);
45139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45141         this_arg_conv.is_owned = false;
45142         NetworkGraph_remove_stale_channels(&this_arg_conv);
45143 }
45144
45145 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) {
45146         LDKNetworkGraph this_arg_conv;
45147         this_arg_conv.inner = untag_ptr(this_arg);
45148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45150         this_arg_conv.is_owned = false;
45151         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
45152 }
45153
45154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
45155         LDKNetworkGraph this_arg_conv;
45156         this_arg_conv.inner = untag_ptr(this_arg);
45157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45159         this_arg_conv.is_owned = false;
45160         LDKChannelUpdate msg_conv;
45161         msg_conv.inner = untag_ptr(msg);
45162         msg_conv.is_owned = ptr_is_owned(msg);
45163         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45164         msg_conv.is_owned = false;
45165         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45166         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
45167         return tag_ptr(ret_conv, true);
45168 }
45169
45170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
45171         LDKNetworkGraph this_arg_conv;
45172         this_arg_conv.inner = untag_ptr(this_arg);
45173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45175         this_arg_conv.is_owned = false;
45176         LDKUnsignedChannelUpdate msg_conv;
45177         msg_conv.inner = untag_ptr(msg);
45178         msg_conv.is_owned = ptr_is_owned(msg);
45179         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45180         msg_conv.is_owned = false;
45181         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
45182         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
45183         return tag_ptr(ret_conv, true);
45184 }
45185
45186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
45187         LDKReadOnlyNetworkGraph this_arg_conv;
45188         this_arg_conv.inner = untag_ptr(this_arg);
45189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45191         this_arg_conv.is_owned = false;
45192         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
45193         int64_t ret_ref = 0;
45194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45196         return ret_ref;
45197 }
45198
45199 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
45200         LDKReadOnlyNetworkGraph this_arg_conv;
45201         this_arg_conv.inner = untag_ptr(this_arg);
45202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45204         this_arg_conv.is_owned = false;
45205         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
45206         int64_tArray ret_arr = NULL;
45207         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45208         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45209         for (size_t g = 0; g < ret_var.datalen; g++) {
45210                 int64_t ret_conv_6_conv = ret_var.data[g];
45211                 ret_arr_ptr[g] = ret_conv_6_conv;
45212         }
45213         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45214         FREE(ret_var.data);
45215         return ret_arr;
45216 }
45217
45218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45219         LDKReadOnlyNetworkGraph this_arg_conv;
45220         this_arg_conv.inner = untag_ptr(this_arg);
45221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45223         this_arg_conv.is_owned = false;
45224         LDKNodeId node_id_conv;
45225         node_id_conv.inner = untag_ptr(node_id);
45226         node_id_conv.is_owned = ptr_is_owned(node_id);
45227         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45228         node_id_conv.is_owned = false;
45229         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
45230         int64_t ret_ref = 0;
45231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45233         return ret_ref;
45234 }
45235
45236 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
45237         LDKReadOnlyNetworkGraph this_arg_conv;
45238         this_arg_conv.inner = untag_ptr(this_arg);
45239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45241         this_arg_conv.is_owned = false;
45242         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
45243         int64_tArray ret_arr = NULL;
45244         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45245         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45246         for (size_t i = 0; i < ret_var.datalen; i++) {
45247                 LDKNodeId ret_conv_8_var = ret_var.data[i];
45248                 int64_t ret_conv_8_ref = 0;
45249                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
45250                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
45251                 ret_arr_ptr[i] = ret_conv_8_ref;
45252         }
45253         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45254         FREE(ret_var.data);
45255         return ret_arr;
45256 }
45257
45258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
45259         LDKReadOnlyNetworkGraph this_arg_conv;
45260         this_arg_conv.inner = untag_ptr(this_arg);
45261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45263         this_arg_conv.is_owned = false;
45264         LDKPublicKey pubkey_ref;
45265         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
45266         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
45267         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
45268         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
45269         int64_t ret_ref = tag_ptr(ret_copy, true);
45270         return ret_ref;
45271 }
45272
45273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45274         LDKRouteHop this_obj_conv;
45275         this_obj_conv.inner = untag_ptr(this_obj);
45276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45278         RouteHop_free(this_obj_conv);
45279 }
45280
45281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
45282         LDKRouteHop this_ptr_conv;
45283         this_ptr_conv.inner = untag_ptr(this_ptr);
45284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45286         this_ptr_conv.is_owned = false;
45287         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45288         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
45289         return ret_arr;
45290 }
45291
45292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45293         LDKRouteHop this_ptr_conv;
45294         this_ptr_conv.inner = untag_ptr(this_ptr);
45295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45297         this_ptr_conv.is_owned = false;
45298         LDKPublicKey val_ref;
45299         CHECK((*env)->GetArrayLength(env, val) == 33);
45300         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45301         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
45302 }
45303
45304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45305         LDKRouteHop this_ptr_conv;
45306         this_ptr_conv.inner = untag_ptr(this_ptr);
45307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45309         this_ptr_conv.is_owned = false;
45310         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
45311         int64_t ret_ref = 0;
45312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45314         return ret_ref;
45315 }
45316
45317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45318         LDKRouteHop this_ptr_conv;
45319         this_ptr_conv.inner = untag_ptr(this_ptr);
45320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45322         this_ptr_conv.is_owned = false;
45323         LDKNodeFeatures val_conv;
45324         val_conv.inner = untag_ptr(val);
45325         val_conv.is_owned = ptr_is_owned(val);
45326         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45327         val_conv = NodeFeatures_clone(&val_conv);
45328         RouteHop_set_node_features(&this_ptr_conv, val_conv);
45329 }
45330
45331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45332         LDKRouteHop this_ptr_conv;
45333         this_ptr_conv.inner = untag_ptr(this_ptr);
45334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45336         this_ptr_conv.is_owned = false;
45337         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
45338         return ret_conv;
45339 }
45340
45341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45342         LDKRouteHop this_ptr_conv;
45343         this_ptr_conv.inner = untag_ptr(this_ptr);
45344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45346         this_ptr_conv.is_owned = false;
45347         RouteHop_set_short_channel_id(&this_ptr_conv, val);
45348 }
45349
45350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45351         LDKRouteHop this_ptr_conv;
45352         this_ptr_conv.inner = untag_ptr(this_ptr);
45353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45355         this_ptr_conv.is_owned = false;
45356         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
45357         int64_t ret_ref = 0;
45358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45360         return ret_ref;
45361 }
45362
45363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45364         LDKRouteHop this_ptr_conv;
45365         this_ptr_conv.inner = untag_ptr(this_ptr);
45366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45368         this_ptr_conv.is_owned = false;
45369         LDKChannelFeatures val_conv;
45370         val_conv.inner = untag_ptr(val);
45371         val_conv.is_owned = ptr_is_owned(val);
45372         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45373         val_conv = ChannelFeatures_clone(&val_conv);
45374         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
45375 }
45376
45377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45378         LDKRouteHop this_ptr_conv;
45379         this_ptr_conv.inner = untag_ptr(this_ptr);
45380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45382         this_ptr_conv.is_owned = false;
45383         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
45384         return ret_conv;
45385 }
45386
45387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45388         LDKRouteHop this_ptr_conv;
45389         this_ptr_conv.inner = untag_ptr(this_ptr);
45390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45392         this_ptr_conv.is_owned = false;
45393         RouteHop_set_fee_msat(&this_ptr_conv, val);
45394 }
45395
45396 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45397         LDKRouteHop this_ptr_conv;
45398         this_ptr_conv.inner = untag_ptr(this_ptr);
45399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45401         this_ptr_conv.is_owned = false;
45402         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
45403         return ret_conv;
45404 }
45405
45406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45407         LDKRouteHop this_ptr_conv;
45408         this_ptr_conv.inner = untag_ptr(this_ptr);
45409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45411         this_ptr_conv.is_owned = false;
45412         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
45413 }
45414
45415 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) {
45416         LDKPublicKey pubkey_arg_ref;
45417         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
45418         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
45419         LDKNodeFeatures node_features_arg_conv;
45420         node_features_arg_conv.inner = untag_ptr(node_features_arg);
45421         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
45422         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
45423         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
45424         LDKChannelFeatures channel_features_arg_conv;
45425         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
45426         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
45427         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
45428         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
45429         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);
45430         int64_t ret_ref = 0;
45431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45433         return ret_ref;
45434 }
45435
45436 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
45437         LDKRouteHop ret_var = RouteHop_clone(arg);
45438         int64_t ret_ref = 0;
45439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45441         return ret_ref;
45442 }
45443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45444         LDKRouteHop arg_conv;
45445         arg_conv.inner = untag_ptr(arg);
45446         arg_conv.is_owned = ptr_is_owned(arg);
45447         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45448         arg_conv.is_owned = false;
45449         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
45450         return ret_conv;
45451 }
45452
45453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45454         LDKRouteHop orig_conv;
45455         orig_conv.inner = untag_ptr(orig);
45456         orig_conv.is_owned = ptr_is_owned(orig);
45457         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45458         orig_conv.is_owned = false;
45459         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
45460         int64_t ret_ref = 0;
45461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45463         return ret_ref;
45464 }
45465
45466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
45467         LDKRouteHop o_conv;
45468         o_conv.inner = untag_ptr(o);
45469         o_conv.is_owned = ptr_is_owned(o);
45470         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45471         o_conv.is_owned = false;
45472         int64_t ret_conv = RouteHop_hash(&o_conv);
45473         return ret_conv;
45474 }
45475
45476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45477         LDKRouteHop a_conv;
45478         a_conv.inner = untag_ptr(a);
45479         a_conv.is_owned = ptr_is_owned(a);
45480         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45481         a_conv.is_owned = false;
45482         LDKRouteHop b_conv;
45483         b_conv.inner = untag_ptr(b);
45484         b_conv.is_owned = ptr_is_owned(b);
45485         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45486         b_conv.is_owned = false;
45487         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
45488         return ret_conv;
45489 }
45490
45491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
45492         LDKRouteHop obj_conv;
45493         obj_conv.inner = untag_ptr(obj);
45494         obj_conv.is_owned = ptr_is_owned(obj);
45495         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45496         obj_conv.is_owned = false;
45497         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
45498         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45499         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45500         CVec_u8Z_free(ret_var);
45501         return ret_arr;
45502 }
45503
45504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45505         LDKu8slice ser_ref;
45506         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45507         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45508         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
45509         *ret_conv = RouteHop_read(ser_ref);
45510         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45511         return tag_ptr(ret_conv, true);
45512 }
45513
45514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45515         LDKRoute this_obj_conv;
45516         this_obj_conv.inner = untag_ptr(this_obj);
45517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45519         Route_free(this_obj_conv);
45520 }
45521
45522 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
45523         LDKRoute this_ptr_conv;
45524         this_ptr_conv.inner = untag_ptr(this_ptr);
45525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45527         this_ptr_conv.is_owned = false;
45528         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
45529         jobjectArray ret_arr = NULL;
45530         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
45531         ;
45532         for (size_t m = 0; m < ret_var.datalen; m++) {
45533                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
45534                 int64_tArray ret_conv_12_arr = NULL;
45535                 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
45536                 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
45537                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
45538                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
45539                         int64_t ret_conv_12_conv_10_ref = 0;
45540                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
45541                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
45542                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
45543                 }
45544                 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
45545                 FREE(ret_conv_12_var.data);
45546                 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
45547         }
45548         
45549         FREE(ret_var.data);
45550         return ret_arr;
45551 }
45552
45553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
45554         LDKRoute this_ptr_conv;
45555         this_ptr_conv.inner = untag_ptr(this_ptr);
45556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45558         this_ptr_conv.is_owned = false;
45559         LDKCVec_CVec_RouteHopZZ val_constr;
45560         val_constr.datalen = (*env)->GetArrayLength(env, val);
45561         if (val_constr.datalen > 0)
45562                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45563         else
45564                 val_constr.data = NULL;
45565         for (size_t m = 0; m < val_constr.datalen; m++) {
45566                 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
45567                 LDKCVec_RouteHopZ val_conv_12_constr;
45568                 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
45569                 if (val_conv_12_constr.datalen > 0)
45570                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45571                 else
45572                         val_conv_12_constr.data = NULL;
45573                 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
45574                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
45575                         int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
45576                         LDKRouteHop val_conv_12_conv_10_conv;
45577                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
45578                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
45579                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
45580                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
45581                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
45582                 }
45583                 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
45584                 val_constr.data[m] = val_conv_12_constr;
45585         }
45586         Route_set_paths(&this_ptr_conv, val_constr);
45587 }
45588
45589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
45590         LDKRoute this_ptr_conv;
45591         this_ptr_conv.inner = untag_ptr(this_ptr);
45592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45594         this_ptr_conv.is_owned = false;
45595         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
45596         int64_t ret_ref = 0;
45597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45599         return ret_ref;
45600 }
45601
45602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45603         LDKRoute this_ptr_conv;
45604         this_ptr_conv.inner = untag_ptr(this_ptr);
45605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45607         this_ptr_conv.is_owned = false;
45608         LDKPaymentParameters val_conv;
45609         val_conv.inner = untag_ptr(val);
45610         val_conv.is_owned = ptr_is_owned(val);
45611         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45612         val_conv = PaymentParameters_clone(&val_conv);
45613         Route_set_payment_params(&this_ptr_conv, val_conv);
45614 }
45615
45616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
45617         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
45618         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
45619         if (paths_arg_constr.datalen > 0)
45620                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
45621         else
45622                 paths_arg_constr.data = NULL;
45623         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
45624                 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
45625                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
45626                 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
45627                 if (paths_arg_conv_12_constr.datalen > 0)
45628                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
45629                 else
45630                         paths_arg_conv_12_constr.data = NULL;
45631                 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
45632                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
45633                         int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
45634                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
45635                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
45636                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
45637                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
45638                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
45639                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
45640                 }
45641                 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
45642                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
45643         }
45644         LDKPaymentParameters payment_params_arg_conv;
45645         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
45646         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
45647         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45648         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45649         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
45650         int64_t ret_ref = 0;
45651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45653         return ret_ref;
45654 }
45655
45656 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
45657         LDKRoute ret_var = Route_clone(arg);
45658         int64_t ret_ref = 0;
45659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45661         return ret_ref;
45662 }
45663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45664         LDKRoute arg_conv;
45665         arg_conv.inner = untag_ptr(arg);
45666         arg_conv.is_owned = ptr_is_owned(arg);
45667         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45668         arg_conv.is_owned = false;
45669         int64_t ret_conv = Route_clone_ptr(&arg_conv);
45670         return ret_conv;
45671 }
45672
45673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45674         LDKRoute orig_conv;
45675         orig_conv.inner = untag_ptr(orig);
45676         orig_conv.is_owned = ptr_is_owned(orig);
45677         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45678         orig_conv.is_owned = false;
45679         LDKRoute ret_var = Route_clone(&orig_conv);
45680         int64_t ret_ref = 0;
45681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45683         return ret_ref;
45684 }
45685
45686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
45687         LDKRoute o_conv;
45688         o_conv.inner = untag_ptr(o);
45689         o_conv.is_owned = ptr_is_owned(o);
45690         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45691         o_conv.is_owned = false;
45692         int64_t ret_conv = Route_hash(&o_conv);
45693         return ret_conv;
45694 }
45695
45696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45697         LDKRoute a_conv;
45698         a_conv.inner = untag_ptr(a);
45699         a_conv.is_owned = ptr_is_owned(a);
45700         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45701         a_conv.is_owned = false;
45702         LDKRoute b_conv;
45703         b_conv.inner = untag_ptr(b);
45704         b_conv.is_owned = ptr_is_owned(b);
45705         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45706         b_conv.is_owned = false;
45707         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
45708         return ret_conv;
45709 }
45710
45711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
45712         LDKRoute this_arg_conv;
45713         this_arg_conv.inner = untag_ptr(this_arg);
45714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45716         this_arg_conv.is_owned = false;
45717         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
45718         return ret_conv;
45719 }
45720
45721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
45722         LDKRoute this_arg_conv;
45723         this_arg_conv.inner = untag_ptr(this_arg);
45724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45726         this_arg_conv.is_owned = false;
45727         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
45728         return ret_conv;
45729 }
45730
45731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
45732         LDKRoute obj_conv;
45733         obj_conv.inner = untag_ptr(obj);
45734         obj_conv.is_owned = ptr_is_owned(obj);
45735         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45736         obj_conv.is_owned = false;
45737         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
45738         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45739         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45740         CVec_u8Z_free(ret_var);
45741         return ret_arr;
45742 }
45743
45744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45745         LDKu8slice ser_ref;
45746         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45747         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45748         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
45749         *ret_conv = Route_read(ser_ref);
45750         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45751         return tag_ptr(ret_conv, true);
45752 }
45753
45754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45755         LDKRouteParameters this_obj_conv;
45756         this_obj_conv.inner = untag_ptr(this_obj);
45757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45759         RouteParameters_free(this_obj_conv);
45760 }
45761
45762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
45763         LDKRouteParameters this_ptr_conv;
45764         this_ptr_conv.inner = untag_ptr(this_ptr);
45765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45767         this_ptr_conv.is_owned = false;
45768         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
45769         int64_t ret_ref = 0;
45770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45772         return ret_ref;
45773 }
45774
45775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45776         LDKRouteParameters this_ptr_conv;
45777         this_ptr_conv.inner = untag_ptr(this_ptr);
45778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45780         this_ptr_conv.is_owned = false;
45781         LDKPaymentParameters val_conv;
45782         val_conv.inner = untag_ptr(val);
45783         val_conv.is_owned = ptr_is_owned(val);
45784         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45785         val_conv = PaymentParameters_clone(&val_conv);
45786         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
45787 }
45788
45789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45790         LDKRouteParameters this_ptr_conv;
45791         this_ptr_conv.inner = untag_ptr(this_ptr);
45792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45794         this_ptr_conv.is_owned = false;
45795         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
45796         return ret_conv;
45797 }
45798
45799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45800         LDKRouteParameters this_ptr_conv;
45801         this_ptr_conv.inner = untag_ptr(this_ptr);
45802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45804         this_ptr_conv.is_owned = false;
45805         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
45806 }
45807
45808 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
45809         LDKRouteParameters this_ptr_conv;
45810         this_ptr_conv.inner = untag_ptr(this_ptr);
45811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45813         this_ptr_conv.is_owned = false;
45814         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
45815         return ret_conv;
45816 }
45817
45818 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) {
45819         LDKRouteParameters this_ptr_conv;
45820         this_ptr_conv.inner = untag_ptr(this_ptr);
45821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45823         this_ptr_conv.is_owned = false;
45824         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
45825 }
45826
45827 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) {
45828         LDKPaymentParameters payment_params_arg_conv;
45829         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
45830         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
45831         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
45832         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
45833         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
45834         int64_t ret_ref = 0;
45835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45837         return ret_ref;
45838 }
45839
45840 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
45841         LDKRouteParameters ret_var = RouteParameters_clone(arg);
45842         int64_t ret_ref = 0;
45843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45845         return ret_ref;
45846 }
45847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45848         LDKRouteParameters arg_conv;
45849         arg_conv.inner = untag_ptr(arg);
45850         arg_conv.is_owned = ptr_is_owned(arg);
45851         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45852         arg_conv.is_owned = false;
45853         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
45854         return ret_conv;
45855 }
45856
45857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45858         LDKRouteParameters orig_conv;
45859         orig_conv.inner = untag_ptr(orig);
45860         orig_conv.is_owned = ptr_is_owned(orig);
45861         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45862         orig_conv.is_owned = false;
45863         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
45864         int64_t ret_ref = 0;
45865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45867         return ret_ref;
45868 }
45869
45870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
45871         LDKRouteParameters obj_conv;
45872         obj_conv.inner = untag_ptr(obj);
45873         obj_conv.is_owned = ptr_is_owned(obj);
45874         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45875         obj_conv.is_owned = false;
45876         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
45877         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45878         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45879         CVec_u8Z_free(ret_var);
45880         return ret_arr;
45881 }
45882
45883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45884         LDKu8slice ser_ref;
45885         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45886         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45887         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
45888         *ret_conv = RouteParameters_read(ser_ref);
45889         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45890         return tag_ptr(ret_conv, true);
45891 }
45892
45893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45894         LDKPaymentParameters this_obj_conv;
45895         this_obj_conv.inner = untag_ptr(this_obj);
45896         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45898         PaymentParameters_free(this_obj_conv);
45899 }
45900
45901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
45902         LDKPaymentParameters this_ptr_conv;
45903         this_ptr_conv.inner = untag_ptr(this_ptr);
45904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45906         this_ptr_conv.is_owned = false;
45907         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45908         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
45909         return ret_arr;
45910 }
45911
45912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45913         LDKPaymentParameters this_ptr_conv;
45914         this_ptr_conv.inner = untag_ptr(this_ptr);
45915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45917         this_ptr_conv.is_owned = false;
45918         LDKPublicKey val_ref;
45919         CHECK((*env)->GetArrayLength(env, val) == 33);
45920         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45921         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
45922 }
45923
45924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45925         LDKPaymentParameters this_ptr_conv;
45926         this_ptr_conv.inner = untag_ptr(this_ptr);
45927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45929         this_ptr_conv.is_owned = false;
45930         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_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_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45938         LDKPaymentParameters this_ptr_conv;
45939         this_ptr_conv.inner = untag_ptr(this_ptr);
45940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45942         this_ptr_conv.is_owned = false;
45943         LDKInvoiceFeatures val_conv;
45944         val_conv.inner = untag_ptr(val);
45945         val_conv.is_owned = ptr_is_owned(val);
45946         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45947         val_conv = InvoiceFeatures_clone(&val_conv);
45948         PaymentParameters_set_features(&this_ptr_conv, val_conv);
45949 }
45950
45951 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
45952         LDKPaymentParameters this_ptr_conv;
45953         this_ptr_conv.inner = untag_ptr(this_ptr);
45954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45956         this_ptr_conv.is_owned = false;
45957         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
45958         int64_tArray ret_arr = NULL;
45959         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45960         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45961         for (size_t l = 0; l < ret_var.datalen; l++) {
45962                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45963                 int64_t ret_conv_11_ref = 0;
45964                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45965                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
45966                 ret_arr_ptr[l] = ret_conv_11_ref;
45967         }
45968         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45969         FREE(ret_var.data);
45970         return ret_arr;
45971 }
45972
45973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45974         LDKPaymentParameters this_ptr_conv;
45975         this_ptr_conv.inner = untag_ptr(this_ptr);
45976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45978         this_ptr_conv.is_owned = false;
45979         LDKCVec_RouteHintZ val_constr;
45980         val_constr.datalen = (*env)->GetArrayLength(env, val);
45981         if (val_constr.datalen > 0)
45982                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
45983         else
45984                 val_constr.data = NULL;
45985         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
45986         for (size_t l = 0; l < val_constr.datalen; l++) {
45987                 int64_t val_conv_11 = val_vals[l];
45988                 LDKRouteHint val_conv_11_conv;
45989                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
45990                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
45991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
45992                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
45993                 val_constr.data[l] = val_conv_11_conv;
45994         }
45995         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
45996         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
45997 }
45998
45999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
46000         LDKPaymentParameters this_ptr_conv;
46001         this_ptr_conv.inner = untag_ptr(this_ptr);
46002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46004         this_ptr_conv.is_owned = false;
46005         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46006         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
46007         int64_t ret_ref = tag_ptr(ret_copy, true);
46008         return ret_ref;
46009 }
46010
46011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46012         LDKPaymentParameters this_ptr_conv;
46013         this_ptr_conv.inner = untag_ptr(this_ptr);
46014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46016         this_ptr_conv.is_owned = false;
46017         void* val_ptr = untag_ptr(val);
46018         CHECK_ACCESS(val_ptr);
46019         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46020         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46021         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
46022 }
46023
46024 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46025         LDKPaymentParameters this_ptr_conv;
46026         this_ptr_conv.inner = untag_ptr(this_ptr);
46027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46029         this_ptr_conv.is_owned = false;
46030         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
46031         return ret_conv;
46032 }
46033
46034 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) {
46035         LDKPaymentParameters this_ptr_conv;
46036         this_ptr_conv.inner = untag_ptr(this_ptr);
46037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46039         this_ptr_conv.is_owned = false;
46040         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
46041 }
46042
46043 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
46044         LDKPaymentParameters this_ptr_conv;
46045         this_ptr_conv.inner = untag_ptr(this_ptr);
46046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46048         this_ptr_conv.is_owned = false;
46049         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
46050         return ret_conv;
46051 }
46052
46053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
46054         LDKPaymentParameters this_ptr_conv;
46055         this_ptr_conv.inner = untag_ptr(this_ptr);
46056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46058         this_ptr_conv.is_owned = false;
46059         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
46060 }
46061
46062 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) {
46063         LDKPaymentParameters this_ptr_conv;
46064         this_ptr_conv.inner = untag_ptr(this_ptr);
46065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46067         this_ptr_conv.is_owned = false;
46068         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
46069         return ret_conv;
46070 }
46071
46072 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) {
46073         LDKPaymentParameters this_ptr_conv;
46074         this_ptr_conv.inner = untag_ptr(this_ptr);
46075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46077         this_ptr_conv.is_owned = false;
46078         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
46079 }
46080
46081 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
46082         LDKPaymentParameters this_ptr_conv;
46083         this_ptr_conv.inner = untag_ptr(this_ptr);
46084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46086         this_ptr_conv.is_owned = false;
46087         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
46088         int64_tArray ret_arr = NULL;
46089         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46090         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46091         for (size_t g = 0; g < ret_var.datalen; g++) {
46092                 int64_t ret_conv_6_conv = ret_var.data[g];
46093                 ret_arr_ptr[g] = ret_conv_6_conv;
46094         }
46095         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46096         FREE(ret_var.data);
46097         return ret_arr;
46098 }
46099
46100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
46101         LDKPaymentParameters this_ptr_conv;
46102         this_ptr_conv.inner = untag_ptr(this_ptr);
46103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46105         this_ptr_conv.is_owned = false;
46106         LDKCVec_u64Z val_constr;
46107         val_constr.datalen = (*env)->GetArrayLength(env, val);
46108         if (val_constr.datalen > 0)
46109                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
46110         else
46111                 val_constr.data = NULL;
46112         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
46113         for (size_t g = 0; g < val_constr.datalen; g++) {
46114                 int64_t val_conv_6 = val_vals[g];
46115                 val_constr.data[g] = val_conv_6;
46116         }
46117         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
46118         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
46119 }
46120
46121 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) {
46122         LDKPublicKey payee_pubkey_arg_ref;
46123         CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
46124         (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
46125         LDKInvoiceFeatures features_arg_conv;
46126         features_arg_conv.inner = untag_ptr(features_arg);
46127         features_arg_conv.is_owned = ptr_is_owned(features_arg);
46128         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
46129         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
46130         LDKCVec_RouteHintZ route_hints_arg_constr;
46131         route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
46132         if (route_hints_arg_constr.datalen > 0)
46133                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
46134         else
46135                 route_hints_arg_constr.data = NULL;
46136         int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
46137         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
46138                 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
46139                 LDKRouteHint route_hints_arg_conv_11_conv;
46140                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
46141                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
46142                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
46143                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
46144                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
46145         }
46146         (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
46147         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
46148         CHECK_ACCESS(expiry_time_arg_ptr);
46149         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
46150         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
46151         LDKCVec_u64Z previously_failed_channels_arg_constr;
46152         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
46153         if (previously_failed_channels_arg_constr.datalen > 0)
46154                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
46155         else
46156                 previously_failed_channels_arg_constr.data = NULL;
46157         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
46158         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
46159                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
46160                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
46161         }
46162         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
46163         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);
46164         int64_t ret_ref = 0;
46165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46167         return ret_ref;
46168 }
46169
46170 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
46171         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
46172         int64_t ret_ref = 0;
46173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46175         return ret_ref;
46176 }
46177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46178         LDKPaymentParameters arg_conv;
46179         arg_conv.inner = untag_ptr(arg);
46180         arg_conv.is_owned = ptr_is_owned(arg);
46181         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46182         arg_conv.is_owned = false;
46183         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
46184         return ret_conv;
46185 }
46186
46187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46188         LDKPaymentParameters orig_conv;
46189         orig_conv.inner = untag_ptr(orig);
46190         orig_conv.is_owned = ptr_is_owned(orig);
46191         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46192         orig_conv.is_owned = false;
46193         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
46194         int64_t ret_ref = 0;
46195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46197         return ret_ref;
46198 }
46199
46200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
46201         LDKPaymentParameters o_conv;
46202         o_conv.inner = untag_ptr(o);
46203         o_conv.is_owned = ptr_is_owned(o);
46204         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46205         o_conv.is_owned = false;
46206         int64_t ret_conv = PaymentParameters_hash(&o_conv);
46207         return ret_conv;
46208 }
46209
46210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46211         LDKPaymentParameters a_conv;
46212         a_conv.inner = untag_ptr(a);
46213         a_conv.is_owned = ptr_is_owned(a);
46214         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46215         a_conv.is_owned = false;
46216         LDKPaymentParameters b_conv;
46217         b_conv.inner = untag_ptr(b);
46218         b_conv.is_owned = ptr_is_owned(b);
46219         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46220         b_conv.is_owned = false;
46221         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
46222         return ret_conv;
46223 }
46224
46225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
46226         LDKPaymentParameters obj_conv;
46227         obj_conv.inner = untag_ptr(obj);
46228         obj_conv.is_owned = ptr_is_owned(obj);
46229         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46230         obj_conv.is_owned = false;
46231         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
46232         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46233         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46234         CVec_u8Z_free(ret_var);
46235         return ret_arr;
46236 }
46237
46238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46239         LDKu8slice ser_ref;
46240         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46241         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46242         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
46243         *ret_conv = PaymentParameters_read(ser_ref);
46244         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46245         return tag_ptr(ret_conv, true);
46246 }
46247
46248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
46249         LDKPublicKey payee_pubkey_ref;
46250         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
46251         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
46252         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
46253         int64_t ret_ref = 0;
46254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46256         return ret_ref;
46257 }
46258
46259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
46260         LDKPublicKey payee_pubkey_ref;
46261         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
46262         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
46263         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
46264         int64_t ret_ref = 0;
46265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46267         return ret_ref;
46268 }
46269
46270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46271         LDKRouteHint this_obj_conv;
46272         this_obj_conv.inner = untag_ptr(this_obj);
46273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46275         RouteHint_free(this_obj_conv);
46276 }
46277
46278 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46279         LDKRouteHint this_ptr_conv;
46280         this_ptr_conv.inner = untag_ptr(this_ptr);
46281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46283         this_ptr_conv.is_owned = false;
46284         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
46285         int64_tArray ret_arr = NULL;
46286         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46287         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46288         for (size_t o = 0; o < ret_var.datalen; o++) {
46289                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
46290                 int64_t ret_conv_14_ref = 0;
46291                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46292                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46293                 ret_arr_ptr[o] = ret_conv_14_ref;
46294         }
46295         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46296         FREE(ret_var.data);
46297         return ret_arr;
46298 }
46299
46300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
46301         LDKRouteHint this_ptr_conv;
46302         this_ptr_conv.inner = untag_ptr(this_ptr);
46303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46305         this_ptr_conv.is_owned = false;
46306         LDKCVec_RouteHintHopZ val_constr;
46307         val_constr.datalen = (*env)->GetArrayLength(env, val);
46308         if (val_constr.datalen > 0)
46309                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46310         else
46311                 val_constr.data = NULL;
46312         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
46313         for (size_t o = 0; o < val_constr.datalen; o++) {
46314                 int64_t val_conv_14 = val_vals[o];
46315                 LDKRouteHintHop val_conv_14_conv;
46316                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
46317                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
46318                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
46319                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
46320                 val_constr.data[o] = val_conv_14_conv;
46321         }
46322         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
46323         RouteHint_set_a(&this_ptr_conv, val_constr);
46324 }
46325
46326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
46327         LDKCVec_RouteHintHopZ a_arg_constr;
46328         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
46329         if (a_arg_constr.datalen > 0)
46330                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
46331         else
46332                 a_arg_constr.data = NULL;
46333         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
46334         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
46335                 int64_t a_arg_conv_14 = a_arg_vals[o];
46336                 LDKRouteHintHop a_arg_conv_14_conv;
46337                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
46338                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
46339                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
46340                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
46341                 a_arg_constr.data[o] = a_arg_conv_14_conv;
46342         }
46343         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
46344         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
46345         int64_t ret_ref = 0;
46346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46348         return ret_ref;
46349 }
46350
46351 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
46352         LDKRouteHint ret_var = RouteHint_clone(arg);
46353         int64_t ret_ref = 0;
46354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46356         return ret_ref;
46357 }
46358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46359         LDKRouteHint arg_conv;
46360         arg_conv.inner = untag_ptr(arg);
46361         arg_conv.is_owned = ptr_is_owned(arg);
46362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46363         arg_conv.is_owned = false;
46364         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
46365         return ret_conv;
46366 }
46367
46368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46369         LDKRouteHint orig_conv;
46370         orig_conv.inner = untag_ptr(orig);
46371         orig_conv.is_owned = ptr_is_owned(orig);
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46373         orig_conv.is_owned = false;
46374         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
46375         int64_t ret_ref = 0;
46376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46378         return ret_ref;
46379 }
46380
46381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
46382         LDKRouteHint o_conv;
46383         o_conv.inner = untag_ptr(o);
46384         o_conv.is_owned = ptr_is_owned(o);
46385         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46386         o_conv.is_owned = false;
46387         int64_t ret_conv = RouteHint_hash(&o_conv);
46388         return ret_conv;
46389 }
46390
46391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46392         LDKRouteHint a_conv;
46393         a_conv.inner = untag_ptr(a);
46394         a_conv.is_owned = ptr_is_owned(a);
46395         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46396         a_conv.is_owned = false;
46397         LDKRouteHint b_conv;
46398         b_conv.inner = untag_ptr(b);
46399         b_conv.is_owned = ptr_is_owned(b);
46400         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46401         b_conv.is_owned = false;
46402         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
46403         return ret_conv;
46404 }
46405
46406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
46407         LDKRouteHint obj_conv;
46408         obj_conv.inner = untag_ptr(obj);
46409         obj_conv.is_owned = ptr_is_owned(obj);
46410         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46411         obj_conv.is_owned = false;
46412         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
46413         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46414         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46415         CVec_u8Z_free(ret_var);
46416         return ret_arr;
46417 }
46418
46419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46420         LDKu8slice ser_ref;
46421         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46422         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46423         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
46424         *ret_conv = RouteHint_read(ser_ref);
46425         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46426         return tag_ptr(ret_conv, true);
46427 }
46428
46429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46430         LDKRouteHintHop this_obj_conv;
46431         this_obj_conv.inner = untag_ptr(this_obj);
46432         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46434         RouteHintHop_free(this_obj_conv);
46435 }
46436
46437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46438         LDKRouteHintHop this_ptr_conv;
46439         this_ptr_conv.inner = untag_ptr(this_ptr);
46440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46442         this_ptr_conv.is_owned = false;
46443         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46444         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
46445         return ret_arr;
46446 }
46447
46448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46449         LDKRouteHintHop this_ptr_conv;
46450         this_ptr_conv.inner = untag_ptr(this_ptr);
46451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46453         this_ptr_conv.is_owned = false;
46454         LDKPublicKey val_ref;
46455         CHECK((*env)->GetArrayLength(env, val) == 33);
46456         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46457         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
46458 }
46459
46460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46461         LDKRouteHintHop this_ptr_conv;
46462         this_ptr_conv.inner = untag_ptr(this_ptr);
46463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46465         this_ptr_conv.is_owned = false;
46466         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
46467         return ret_conv;
46468 }
46469
46470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46471         LDKRouteHintHop this_ptr_conv;
46472         this_ptr_conv.inner = untag_ptr(this_ptr);
46473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46475         this_ptr_conv.is_owned = false;
46476         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
46477 }
46478
46479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
46480         LDKRouteHintHop this_ptr_conv;
46481         this_ptr_conv.inner = untag_ptr(this_ptr);
46482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46484         this_ptr_conv.is_owned = false;
46485         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
46486         int64_t ret_ref = 0;
46487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46489         return ret_ref;
46490 }
46491
46492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46493         LDKRouteHintHop this_ptr_conv;
46494         this_ptr_conv.inner = untag_ptr(this_ptr);
46495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46497         this_ptr_conv.is_owned = false;
46498         LDKRoutingFees val_conv;
46499         val_conv.inner = untag_ptr(val);
46500         val_conv.is_owned = ptr_is_owned(val);
46501         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46502         val_conv = RoutingFees_clone(&val_conv);
46503         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
46504 }
46505
46506 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46507         LDKRouteHintHop this_ptr_conv;
46508         this_ptr_conv.inner = untag_ptr(this_ptr);
46509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46511         this_ptr_conv.is_owned = false;
46512         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
46513         return ret_conv;
46514 }
46515
46516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46517         LDKRouteHintHop this_ptr_conv;
46518         this_ptr_conv.inner = untag_ptr(this_ptr);
46519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46521         this_ptr_conv.is_owned = false;
46522         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
46523 }
46524
46525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46526         LDKRouteHintHop this_ptr_conv;
46527         this_ptr_conv.inner = untag_ptr(this_ptr);
46528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46530         this_ptr_conv.is_owned = false;
46531         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46532         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
46533         int64_t ret_ref = tag_ptr(ret_copy, true);
46534         return ret_ref;
46535 }
46536
46537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46538         LDKRouteHintHop 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         void* val_ptr = untag_ptr(val);
46544         CHECK_ACCESS(val_ptr);
46545         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46546         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46547         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
46548 }
46549
46550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46551         LDKRouteHintHop this_ptr_conv;
46552         this_ptr_conv.inner = untag_ptr(this_ptr);
46553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46555         this_ptr_conv.is_owned = false;
46556         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46557         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
46558         int64_t ret_ref = tag_ptr(ret_copy, true);
46559         return ret_ref;
46560 }
46561
46562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46563         LDKRouteHintHop this_ptr_conv;
46564         this_ptr_conv.inner = untag_ptr(this_ptr);
46565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46567         this_ptr_conv.is_owned = false;
46568         void* val_ptr = untag_ptr(val);
46569         CHECK_ACCESS(val_ptr);
46570         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46571         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46572         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
46573 }
46574
46575 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) {
46576         LDKPublicKey src_node_id_arg_ref;
46577         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
46578         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
46579         LDKRoutingFees fees_arg_conv;
46580         fees_arg_conv.inner = untag_ptr(fees_arg);
46581         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
46582         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
46583         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
46584         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
46585         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
46586         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
46587         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
46588         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
46589         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
46590         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
46591         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
46592         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);
46593         int64_t ret_ref = 0;
46594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46596         return ret_ref;
46597 }
46598
46599 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
46600         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
46601         int64_t ret_ref = 0;
46602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46604         return ret_ref;
46605 }
46606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46607         LDKRouteHintHop arg_conv;
46608         arg_conv.inner = untag_ptr(arg);
46609         arg_conv.is_owned = ptr_is_owned(arg);
46610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46611         arg_conv.is_owned = false;
46612         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
46613         return ret_conv;
46614 }
46615
46616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46617         LDKRouteHintHop orig_conv;
46618         orig_conv.inner = untag_ptr(orig);
46619         orig_conv.is_owned = ptr_is_owned(orig);
46620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46621         orig_conv.is_owned = false;
46622         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
46623         int64_t ret_ref = 0;
46624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46626         return ret_ref;
46627 }
46628
46629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
46630         LDKRouteHintHop o_conv;
46631         o_conv.inner = untag_ptr(o);
46632         o_conv.is_owned = ptr_is_owned(o);
46633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46634         o_conv.is_owned = false;
46635         int64_t ret_conv = RouteHintHop_hash(&o_conv);
46636         return ret_conv;
46637 }
46638
46639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46640         LDKRouteHintHop a_conv;
46641         a_conv.inner = untag_ptr(a);
46642         a_conv.is_owned = ptr_is_owned(a);
46643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46644         a_conv.is_owned = false;
46645         LDKRouteHintHop b_conv;
46646         b_conv.inner = untag_ptr(b);
46647         b_conv.is_owned = ptr_is_owned(b);
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46649         b_conv.is_owned = false;
46650         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
46651         return ret_conv;
46652 }
46653
46654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
46655         LDKRouteHintHop obj_conv;
46656         obj_conv.inner = untag_ptr(obj);
46657         obj_conv.is_owned = ptr_is_owned(obj);
46658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46659         obj_conv.is_owned = false;
46660         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
46661         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46662         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46663         CVec_u8Z_free(ret_var);
46664         return ret_arr;
46665 }
46666
46667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
46668         LDKu8slice ser_ref;
46669         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
46670         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
46671         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
46672         *ret_conv = RouteHintHop_read(ser_ref);
46673         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
46674         return tag_ptr(ret_conv, true);
46675 }
46676
46677 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) {
46678         LDKPublicKey our_node_pubkey_ref;
46679         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
46680         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
46681         LDKRouteParameters route_params_conv;
46682         route_params_conv.inner = untag_ptr(route_params);
46683         route_params_conv.is_owned = ptr_is_owned(route_params);
46684         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46685         route_params_conv.is_owned = false;
46686         LDKNetworkGraph network_graph_conv;
46687         network_graph_conv.inner = untag_ptr(network_graph);
46688         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46689         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46690         network_graph_conv.is_owned = false;
46691         LDKCVec_ChannelDetailsZ first_hops_constr;
46692         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
46693         if (first_hops != NULL) {
46694                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
46695                 if (first_hops_constr.datalen > 0)
46696                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
46697                 else
46698                         first_hops_constr.data = NULL;
46699                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
46700                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
46701                         int64_t first_hops_conv_16 = first_hops_vals[q];
46702                         LDKChannelDetails first_hops_conv_16_conv;
46703                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
46704                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
46705                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
46706                         first_hops_conv_16_conv.is_owned = false;
46707                         first_hops_constr.data[q] = first_hops_conv_16_conv;
46708                 }
46709                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
46710                 first_hops_ptr = &first_hops_constr;
46711         }
46712         void* logger_ptr = untag_ptr(logger);
46713         CHECK_ACCESS(logger_ptr);
46714         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46715         if (logger_conv.free == LDKLogger_JCalls_free) {
46716                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46717                 LDKLogger_JCalls_cloned(&logger_conv);
46718         }
46719         void* scorer_ptr = untag_ptr(scorer);
46720         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
46721         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
46722         unsigned char random_seed_bytes_arr[32];
46723         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46724         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
46725         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46726         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46727         *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);
46728         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
46729         return tag_ptr(ret_conv, true);
46730 }
46731
46732 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) {
46733         LDKPublicKey our_node_pubkey_ref;
46734         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
46735         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
46736         LDKCVec_PublicKeyZ hops_constr;
46737         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
46738         if (hops_constr.datalen > 0)
46739                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46740         else
46741                 hops_constr.data = NULL;
46742         for (size_t i = 0; i < hops_constr.datalen; i++) {
46743                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
46744                 LDKPublicKey hops_conv_8_ref;
46745                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
46746                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
46747                 hops_constr.data[i] = hops_conv_8_ref;
46748         }
46749         LDKRouteParameters route_params_conv;
46750         route_params_conv.inner = untag_ptr(route_params);
46751         route_params_conv.is_owned = ptr_is_owned(route_params);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
46753         route_params_conv.is_owned = false;
46754         LDKNetworkGraph network_graph_conv;
46755         network_graph_conv.inner = untag_ptr(network_graph);
46756         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46757         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46758         network_graph_conv.is_owned = false;
46759         void* logger_ptr = untag_ptr(logger);
46760         CHECK_ACCESS(logger_ptr);
46761         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46762         if (logger_conv.free == LDKLogger_JCalls_free) {
46763                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46764                 LDKLogger_JCalls_cloned(&logger_conv);
46765         }
46766         unsigned char random_seed_bytes_arr[32];
46767         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46768         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
46769         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
46770         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
46771         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
46772         return tag_ptr(ret_conv, true);
46773 }
46774
46775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46776         if (!ptr_is_owned(this_ptr)) return;
46777         void* this_ptr_ptr = untag_ptr(this_ptr);
46778         CHECK_ACCESS(this_ptr_ptr);
46779         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
46780         FREE(untag_ptr(this_ptr));
46781         Score_free(this_ptr_conv);
46782 }
46783
46784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46785         if (!ptr_is_owned(this_ptr)) return;
46786         void* this_ptr_ptr = untag_ptr(this_ptr);
46787         CHECK_ACCESS(this_ptr_ptr);
46788         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
46789         FREE(untag_ptr(this_ptr));
46790         LockableScore_free(this_ptr_conv);
46791 }
46792
46793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46794         if (!ptr_is_owned(this_ptr)) return;
46795         void* this_ptr_ptr = untag_ptr(this_ptr);
46796         CHECK_ACCESS(this_ptr_ptr);
46797         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
46798         FREE(untag_ptr(this_ptr));
46799         WriteableScore_free(this_ptr_conv);
46800 }
46801
46802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46803         LDKMultiThreadedLockableScore this_obj_conv;
46804         this_obj_conv.inner = untag_ptr(this_obj);
46805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46807         MultiThreadedLockableScore_free(this_obj_conv);
46808 }
46809
46810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46811         LDKMultiThreadedScoreLock this_obj_conv;
46812         this_obj_conv.inner = untag_ptr(this_obj);
46813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46815         MultiThreadedScoreLock_free(this_obj_conv);
46816 }
46817
46818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
46819         LDKMultiThreadedScoreLock this_arg_conv;
46820         this_arg_conv.inner = untag_ptr(this_arg);
46821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46823         this_arg_conv.is_owned = false;
46824         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
46825         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
46826         return tag_ptr(ret_ret, true);
46827 }
46828
46829 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1write(JNIEnv *env, jclass clz, int64_t obj) {
46830         LDKMultiThreadedScoreLock obj_conv;
46831         obj_conv.inner = untag_ptr(obj);
46832         obj_conv.is_owned = ptr_is_owned(obj);
46833         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46834         obj_conv.is_owned = false;
46835         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
46836         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46837         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46838         CVec_u8Z_free(ret_var);
46839         return ret_arr;
46840 }
46841
46842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
46843         LDKMultiThreadedLockableScore this_arg_conv;
46844         this_arg_conv.inner = untag_ptr(this_arg);
46845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46847         this_arg_conv.is_owned = false;
46848         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
46849         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
46850         return tag_ptr(ret_ret, true);
46851 }
46852
46853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
46854         LDKMultiThreadedLockableScore obj_conv;
46855         obj_conv.inner = untag_ptr(obj);
46856         obj_conv.is_owned = ptr_is_owned(obj);
46857         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46858         obj_conv.is_owned = false;
46859         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
46860         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46861         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46862         CVec_u8Z_free(ret_var);
46863         return ret_arr;
46864 }
46865
46866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
46867         LDKMultiThreadedLockableScore this_arg_conv;
46868         this_arg_conv.inner = untag_ptr(this_arg);
46869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46871         this_arg_conv.is_owned = false;
46872         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
46873         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
46874         return tag_ptr(ret_ret, true);
46875 }
46876
46877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
46878         void* score_ptr = untag_ptr(score);
46879         CHECK_ACCESS(score_ptr);
46880         LDKScore score_conv = *(LDKScore*)(score_ptr);
46881         if (score_conv.free == LDKScore_JCalls_free) {
46882                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46883                 LDKScore_JCalls_cloned(&score_conv);
46884         }
46885         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_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 void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46893         LDKChannelUsage this_obj_conv;
46894         this_obj_conv.inner = untag_ptr(this_obj);
46895         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46897         ChannelUsage_free(this_obj_conv);
46898 }
46899
46900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46901         LDKChannelUsage this_ptr_conv;
46902         this_ptr_conv.inner = untag_ptr(this_ptr);
46903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46905         this_ptr_conv.is_owned = false;
46906         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
46907         return ret_conv;
46908 }
46909
46910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46911         LDKChannelUsage this_ptr_conv;
46912         this_ptr_conv.inner = untag_ptr(this_ptr);
46913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46915         this_ptr_conv.is_owned = false;
46916         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
46917 }
46918
46919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46920         LDKChannelUsage this_ptr_conv;
46921         this_ptr_conv.inner = untag_ptr(this_ptr);
46922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46924         this_ptr_conv.is_owned = false;
46925         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
46926         return ret_conv;
46927 }
46928
46929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46930         LDKChannelUsage this_ptr_conv;
46931         this_ptr_conv.inner = untag_ptr(this_ptr);
46932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46934         this_ptr_conv.is_owned = false;
46935         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
46936 }
46937
46938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
46939         LDKChannelUsage this_ptr_conv;
46940         this_ptr_conv.inner = untag_ptr(this_ptr);
46941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46943         this_ptr_conv.is_owned = false;
46944         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
46945         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
46946         int64_t ret_ref = tag_ptr(ret_copy, true);
46947         return ret_ref;
46948 }
46949
46950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46951         LDKChannelUsage this_ptr_conv;
46952         this_ptr_conv.inner = untag_ptr(this_ptr);
46953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46955         this_ptr_conv.is_owned = false;
46956         void* val_ptr = untag_ptr(val);
46957         CHECK_ACCESS(val_ptr);
46958         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
46959         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
46960         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
46961 }
46962
46963 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) {
46964         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
46965         CHECK_ACCESS(effective_capacity_arg_ptr);
46966         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
46967         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
46968         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
46969         int64_t ret_ref = 0;
46970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46972         return ret_ref;
46973 }
46974
46975 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
46976         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
46977         int64_t ret_ref = 0;
46978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46980         return ret_ref;
46981 }
46982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46983         LDKChannelUsage arg_conv;
46984         arg_conv.inner = untag_ptr(arg);
46985         arg_conv.is_owned = ptr_is_owned(arg);
46986         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46987         arg_conv.is_owned = false;
46988         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
46989         return ret_conv;
46990 }
46991
46992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46993         LDKChannelUsage orig_conv;
46994         orig_conv.inner = untag_ptr(orig);
46995         orig_conv.is_owned = ptr_is_owned(orig);
46996         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46997         orig_conv.is_owned = false;
46998         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
46999         int64_t ret_ref = 0;
47000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47002         return ret_ref;
47003 }
47004
47005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47006         LDKFixedPenaltyScorer this_obj_conv;
47007         this_obj_conv.inner = untag_ptr(this_obj);
47008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47010         FixedPenaltyScorer_free(this_obj_conv);
47011 }
47012
47013 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
47014         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
47015         int64_t ret_ref = 0;
47016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47018         return ret_ref;
47019 }
47020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47021         LDKFixedPenaltyScorer arg_conv;
47022         arg_conv.inner = untag_ptr(arg);
47023         arg_conv.is_owned = ptr_is_owned(arg);
47024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47025         arg_conv.is_owned = false;
47026         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
47027         return ret_conv;
47028 }
47029
47030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47031         LDKFixedPenaltyScorer orig_conv;
47032         orig_conv.inner = untag_ptr(orig);
47033         orig_conv.is_owned = ptr_is_owned(orig);
47034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47035         orig_conv.is_owned = false;
47036         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
47037         int64_t ret_ref = 0;
47038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47040         return ret_ref;
47041 }
47042
47043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
47044         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
47045         int64_t ret_ref = 0;
47046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47048         return ret_ref;
47049 }
47050
47051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
47052         LDKFixedPenaltyScorer this_arg_conv;
47053         this_arg_conv.inner = untag_ptr(this_arg);
47054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47056         this_arg_conv.is_owned = false;
47057         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
47058         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
47059         return tag_ptr(ret_ret, true);
47060 }
47061
47062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
47063         LDKFixedPenaltyScorer obj_conv;
47064         obj_conv.inner = untag_ptr(obj);
47065         obj_conv.is_owned = ptr_is_owned(obj);
47066         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47067         obj_conv.is_owned = false;
47068         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
47069         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47070         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47071         CVec_u8Z_free(ret_var);
47072         return ret_arr;
47073 }
47074
47075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
47076         LDKu8slice ser_ref;
47077         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47078         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47079         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
47080         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
47081         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47082         return tag_ptr(ret_conv, true);
47083 }
47084
47085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47086         LDKProbabilisticScorer this_obj_conv;
47087         this_obj_conv.inner = untag_ptr(this_obj);
47088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47090         ProbabilisticScorer_free(this_obj_conv);
47091 }
47092
47093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47094         LDKProbabilisticScoringParameters this_obj_conv;
47095         this_obj_conv.inner = untag_ptr(this_obj);
47096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47098         ProbabilisticScoringParameters_free(this_obj_conv);
47099 }
47100
47101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47102         LDKProbabilisticScoringParameters this_ptr_conv;
47103         this_ptr_conv.inner = untag_ptr(this_ptr);
47104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47106         this_ptr_conv.is_owned = false;
47107         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
47108         return ret_conv;
47109 }
47110
47111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47112         LDKProbabilisticScoringParameters this_ptr_conv;
47113         this_ptr_conv.inner = untag_ptr(this_ptr);
47114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47116         this_ptr_conv.is_owned = false;
47117         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
47118 }
47119
47120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47121         LDKProbabilisticScoringParameters this_ptr_conv;
47122         this_ptr_conv.inner = untag_ptr(this_ptr);
47123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47125         this_ptr_conv.is_owned = false;
47126         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
47127         return ret_conv;
47128 }
47129
47130 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) {
47131         LDKProbabilisticScoringParameters this_ptr_conv;
47132         this_ptr_conv.inner = untag_ptr(this_ptr);
47133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47135         this_ptr_conv.is_owned = false;
47136         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
47137 }
47138
47139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47140         LDKProbabilisticScoringParameters this_ptr_conv;
47141         this_ptr_conv.inner = untag_ptr(this_ptr);
47142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47144         this_ptr_conv.is_owned = false;
47145         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
47146         return ret_conv;
47147 }
47148
47149 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) {
47150         LDKProbabilisticScoringParameters this_ptr_conv;
47151         this_ptr_conv.inner = untag_ptr(this_ptr);
47152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47154         this_ptr_conv.is_owned = false;
47155         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
47156 }
47157
47158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
47159         LDKProbabilisticScoringParameters this_ptr_conv;
47160         this_ptr_conv.inner = untag_ptr(this_ptr);
47161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47163         this_ptr_conv.is_owned = false;
47164         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
47165         return ret_conv;
47166 }
47167
47168 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) {
47169         LDKProbabilisticScoringParameters this_ptr_conv;
47170         this_ptr_conv.inner = untag_ptr(this_ptr);
47171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47173         this_ptr_conv.is_owned = false;
47174         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
47175 }
47176
47177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47178         LDKProbabilisticScoringParameters this_ptr_conv;
47179         this_ptr_conv.inner = untag_ptr(this_ptr);
47180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47182         this_ptr_conv.is_owned = false;
47183         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
47184         return ret_conv;
47185 }
47186
47187 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) {
47188         LDKProbabilisticScoringParameters this_ptr_conv;
47189         this_ptr_conv.inner = untag_ptr(this_ptr);
47190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47192         this_ptr_conv.is_owned = false;
47193         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
47194 }
47195
47196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47197         LDKProbabilisticScoringParameters this_ptr_conv;
47198         this_ptr_conv.inner = untag_ptr(this_ptr);
47199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47201         this_ptr_conv.is_owned = false;
47202         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
47203         return ret_conv;
47204 }
47205
47206 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) {
47207         LDKProbabilisticScoringParameters this_ptr_conv;
47208         this_ptr_conv.inner = untag_ptr(this_ptr);
47209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47211         this_ptr_conv.is_owned = false;
47212         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
47213 }
47214
47215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47216         LDKProbabilisticScoringParameters this_ptr_conv;
47217         this_ptr_conv.inner = untag_ptr(this_ptr);
47218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47220         this_ptr_conv.is_owned = false;
47221         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
47222         return ret_conv;
47223 }
47224
47225 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) {
47226         LDKProbabilisticScoringParameters this_ptr_conv;
47227         this_ptr_conv.inner = untag_ptr(this_ptr);
47228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47230         this_ptr_conv.is_owned = false;
47231         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
47232 }
47233
47234 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
47235         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
47236         int64_t ret_ref = 0;
47237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47239         return ret_ref;
47240 }
47241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47242         LDKProbabilisticScoringParameters arg_conv;
47243         arg_conv.inner = untag_ptr(arg);
47244         arg_conv.is_owned = ptr_is_owned(arg);
47245         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47246         arg_conv.is_owned = false;
47247         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
47248         return ret_conv;
47249 }
47250
47251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47252         LDKProbabilisticScoringParameters orig_conv;
47253         orig_conv.inner = untag_ptr(orig);
47254         orig_conv.is_owned = ptr_is_owned(orig);
47255         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47256         orig_conv.is_owned = false;
47257         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
47258         int64_t ret_ref = 0;
47259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47261         return ret_ref;
47262 }
47263
47264 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) {
47265         LDKProbabilisticScoringParameters params_conv;
47266         params_conv.inner = untag_ptr(params);
47267         params_conv.is_owned = ptr_is_owned(params);
47268         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
47269         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
47270         LDKNetworkGraph network_graph_conv;
47271         network_graph_conv.inner = untag_ptr(network_graph);
47272         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47273         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47274         network_graph_conv.is_owned = false;
47275         void* logger_ptr = untag_ptr(logger);
47276         CHECK_ACCESS(logger_ptr);
47277         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47278         if (logger_conv.free == LDKLogger_JCalls_free) {
47279                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47280                 LDKLogger_JCalls_cloned(&logger_conv);
47281         }
47282         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
47283         int64_t ret_ref = 0;
47284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47286         return ret_ref;
47287 }
47288
47289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
47290         LDKProbabilisticScorer this_arg_conv;
47291         this_arg_conv.inner = untag_ptr(this_arg);
47292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47294         this_arg_conv.is_owned = false;
47295         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
47296 }
47297
47298 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) {
47299         LDKProbabilisticScorer 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.is_owned = false;
47304         LDKNodeId target_conv;
47305         target_conv.inner = untag_ptr(target);
47306         target_conv.is_owned = ptr_is_owned(target);
47307         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
47308         target_conv.is_owned = false;
47309         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
47310         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
47311         int64_t ret_ref = tag_ptr(ret_copy, true);
47312         return ret_ref;
47313 }
47314
47315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
47316         LDKProbabilisticScorer this_arg_conv;
47317         this_arg_conv.inner = untag_ptr(this_arg);
47318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47320         this_arg_conv.is_owned = false;
47321         LDKNodeId node_id_conv;
47322         node_id_conv.inner = untag_ptr(node_id);
47323         node_id_conv.is_owned = ptr_is_owned(node_id);
47324         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47325         node_id_conv.is_owned = false;
47326         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
47327 }
47328
47329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
47330         LDKProbabilisticScorer this_arg_conv;
47331         this_arg_conv.inner = untag_ptr(this_arg);
47332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47334         this_arg_conv.is_owned = false;
47335         LDKNodeId node_id_conv;
47336         node_id_conv.inner = untag_ptr(node_id);
47337         node_id_conv.is_owned = ptr_is_owned(node_id);
47338         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47339         node_id_conv.is_owned = false;
47340         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
47341 }
47342
47343 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) {
47344         LDKProbabilisticScorer this_arg_conv;
47345         this_arg_conv.inner = untag_ptr(this_arg);
47346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47348         this_arg_conv.is_owned = false;
47349         LDKNodeId node_id_conv;
47350         node_id_conv.inner = untag_ptr(node_id);
47351         node_id_conv.is_owned = ptr_is_owned(node_id);
47352         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47353         node_id_conv.is_owned = false;
47354         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
47355 }
47356
47357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
47358         LDKProbabilisticScorer 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.is_owned = false;
47363         LDKNodeId node_id_conv;
47364         node_id_conv.inner = untag_ptr(node_id);
47365         node_id_conv.is_owned = ptr_is_owned(node_id);
47366         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
47367         node_id_conv.is_owned = false;
47368         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
47369 }
47370
47371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
47372         LDKProbabilisticScorer this_arg_conv;
47373         this_arg_conv.inner = untag_ptr(this_arg);
47374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47376         this_arg_conv.is_owned = false;
47377         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
47378 }
47379
47380 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) {
47381         LDKProbabilisticScoringParameters this_arg_conv;
47382         this_arg_conv.inner = untag_ptr(this_arg);
47383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47385         this_arg_conv.is_owned = false;
47386         LDKCVec_NodeIdZ node_ids_constr;
47387         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
47388         if (node_ids_constr.datalen > 0)
47389                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
47390         else
47391                 node_ids_constr.data = NULL;
47392         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
47393         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
47394                 int64_t node_ids_conv_8 = node_ids_vals[i];
47395                 LDKNodeId node_ids_conv_8_conv;
47396                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
47397                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
47398                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
47399                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
47400                 node_ids_constr.data[i] = node_ids_conv_8_conv;
47401         }
47402         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
47403         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
47404 }
47405
47406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
47407         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
47408         int64_t ret_ref = 0;
47409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47411         return ret_ref;
47412 }
47413
47414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
47415         LDKProbabilisticScorer this_arg_conv;
47416         this_arg_conv.inner = untag_ptr(this_arg);
47417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47419         this_arg_conv.is_owned = false;
47420         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
47421         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
47422         return tag_ptr(ret_ret, true);
47423 }
47424
47425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
47426         LDKProbabilisticScorer obj_conv;
47427         obj_conv.inner = untag_ptr(obj);
47428         obj_conv.is_owned = ptr_is_owned(obj);
47429         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47430         obj_conv.is_owned = false;
47431         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
47432         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47433         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47434         CVec_u8Z_free(ret_var);
47435         return ret_arr;
47436 }
47437
47438 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) {
47439         LDKu8slice ser_ref;
47440         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47441         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47442         LDKProbabilisticScoringParameters arg_a_conv;
47443         arg_a_conv.inner = untag_ptr(arg_a);
47444         arg_a_conv.is_owned = ptr_is_owned(arg_a);
47445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
47446         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
47447         LDKNetworkGraph arg_b_conv;
47448         arg_b_conv.inner = untag_ptr(arg_b);
47449         arg_b_conv.is_owned = ptr_is_owned(arg_b);
47450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
47451         arg_b_conv.is_owned = false;
47452         void* arg_c_ptr = untag_ptr(arg_c);
47453         CHECK_ACCESS(arg_c_ptr);
47454         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
47455         if (arg_c_conv.free == LDKLogger_JCalls_free) {
47456                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47457                 LDKLogger_JCalls_cloned(&arg_c_conv);
47458         }
47459         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
47460         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
47461         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47462         return tag_ptr(ret_conv, true);
47463 }
47464
47465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47466         LDKBlindedRoute this_obj_conv;
47467         this_obj_conv.inner = untag_ptr(this_obj);
47468         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47470         BlindedRoute_free(this_obj_conv);
47471 }
47472
47473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47474         LDKBlindedHop this_obj_conv;
47475         this_obj_conv.inner = untag_ptr(this_obj);
47476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47478         BlindedHop_free(this_obj_conv);
47479 }
47480
47481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedRoute_1new(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t keys_manager) {
47482         LDKCVec_PublicKeyZ node_pks_constr;
47483         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
47484         if (node_pks_constr.datalen > 0)
47485                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
47486         else
47487                 node_pks_constr.data = NULL;
47488         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
47489                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
47490                 LDKPublicKey node_pks_conv_8_ref;
47491                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
47492                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
47493                 node_pks_constr.data[i] = node_pks_conv_8_ref;
47494         }
47495         void* keys_manager_ptr = untag_ptr(keys_manager);
47496         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
47497         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
47498         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
47499         *ret_conv = BlindedRoute_new(node_pks_constr, keys_manager_conv);
47500         return tag_ptr(ret_conv, true);
47501 }
47502
47503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedRoute_1write(JNIEnv *env, jclass clz, int64_t obj) {
47504         LDKBlindedRoute obj_conv;
47505         obj_conv.inner = untag_ptr(obj);
47506         obj_conv.is_owned = ptr_is_owned(obj);
47507         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47508         obj_conv.is_owned = false;
47509         LDKCVec_u8Z ret_var = BlindedRoute_write(&obj_conv);
47510         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47511         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47512         CVec_u8Z_free(ret_var);
47513         return ret_arr;
47514 }
47515
47516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedRoute_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47517         LDKu8slice ser_ref;
47518         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47519         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47520         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
47521         *ret_conv = BlindedRoute_read(ser_ref);
47522         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47523         return tag_ptr(ret_conv, true);
47524 }
47525
47526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
47527         LDKBlindedHop obj_conv;
47528         obj_conv.inner = untag_ptr(obj);
47529         obj_conv.is_owned = ptr_is_owned(obj);
47530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47531         obj_conv.is_owned = false;
47532         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
47533         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
47534         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
47535         CVec_u8Z_free(ret_var);
47536         return ret_arr;
47537 }
47538
47539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
47540         LDKu8slice ser_ref;
47541         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
47542         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
47543         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
47544         *ret_conv = BlindedHop_read(ser_ref);
47545         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
47546         return tag_ptr(ret_conv, true);
47547 }
47548
47549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47550         LDKOnionMessenger this_obj_conv;
47551         this_obj_conv.inner = untag_ptr(this_obj);
47552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47554         OnionMessenger_free(this_obj_conv);
47555 }
47556
47557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47558         if (!ptr_is_owned(this_ptr)) return;
47559         void* this_ptr_ptr = untag_ptr(this_ptr);
47560         CHECK_ACCESS(this_ptr_ptr);
47561         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
47562         FREE(untag_ptr(this_ptr));
47563         Destination_free(this_ptr_conv);
47564 }
47565
47566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
47567         LDKPublicKey a_ref;
47568         CHECK((*env)->GetArrayLength(env, a) == 33);
47569         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
47570         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47571         *ret_copy = Destination_node(a_ref);
47572         int64_t ret_ref = tag_ptr(ret_copy, true);
47573         return ret_ref;
47574 }
47575
47576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1route(JNIEnv *env, jclass clz, int64_t a) {
47577         LDKBlindedRoute a_conv;
47578         a_conv.inner = untag_ptr(a);
47579         a_conv.is_owned = ptr_is_owned(a);
47580         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47581         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
47582         
47583         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
47584         *ret_copy = Destination_blinded_route(a_conv);
47585         int64_t ret_ref = tag_ptr(ret_copy, true);
47586         return ret_ref;
47587 }
47588
47589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47590         if (!ptr_is_owned(this_ptr)) return;
47591         void* this_ptr_ptr = untag_ptr(this_ptr);
47592         CHECK_ACCESS(this_ptr_ptr);
47593         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
47594         FREE(untag_ptr(this_ptr));
47595         SendError_free(this_ptr_conv);
47596 }
47597
47598 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
47599         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47600         *ret_copy = SendError_clone(arg);
47601         int64_t ret_ref = tag_ptr(ret_copy, true);
47602         return ret_ref;
47603 }
47604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47605         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
47606         int64_t ret_conv = SendError_clone_ptr(arg_conv);
47607         return ret_conv;
47608 }
47609
47610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47611         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
47612         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47613         *ret_copy = SendError_clone(orig_conv);
47614         int64_t ret_ref = tag_ptr(ret_copy, true);
47615         return ret_ref;
47616 }
47617
47618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
47619         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
47620         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47621         *ret_copy = SendError_secp256k1(a_conv);
47622         int64_t ret_ref = tag_ptr(ret_copy, true);
47623         return ret_ref;
47624 }
47625
47626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
47627         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47628         *ret_copy = SendError_too_big_packet();
47629         int64_t ret_ref = tag_ptr(ret_copy, true);
47630         return ret_ref;
47631 }
47632
47633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
47634         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47635         *ret_copy = SendError_too_few_blinded_hops();
47636         int64_t ret_ref = tag_ptr(ret_copy, true);
47637         return ret_ref;
47638 }
47639
47640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
47641         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47642         *ret_copy = SendError_invalid_first_hop();
47643         int64_t ret_ref = tag_ptr(ret_copy, true);
47644         return ret_ref;
47645 }
47646
47647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
47648         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
47649         *ret_copy = SendError_buffer_full();
47650         int64_t ret_ref = tag_ptr(ret_copy, true);
47651         return ret_ref;
47652 }
47653
47654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t logger) {
47655         void* keys_manager_ptr = untag_ptr(keys_manager);
47656         CHECK_ACCESS(keys_manager_ptr);
47657         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47658         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47660                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47661         }
47662         void* logger_ptr = untag_ptr(logger);
47663         CHECK_ACCESS(logger_ptr);
47664         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47665         if (logger_conv.free == LDKLogger_JCalls_free) {
47666                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47667                 LDKLogger_JCalls_cloned(&logger_conv);
47668         }
47669         LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv);
47670         int64_t ret_ref = 0;
47671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47673         return ret_ref;
47674 }
47675
47676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray intermediate_nodes, int64_t destination, int64_t reply_path) {
47677         LDKOnionMessenger this_arg_conv;
47678         this_arg_conv.inner = untag_ptr(this_arg);
47679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47681         this_arg_conv.is_owned = false;
47682         LDKCVec_PublicKeyZ intermediate_nodes_constr;
47683         intermediate_nodes_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes);
47684         if (intermediate_nodes_constr.datalen > 0)
47685                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
47686         else
47687                 intermediate_nodes_constr.data = NULL;
47688         for (size_t i = 0; i < intermediate_nodes_constr.datalen; i++) {
47689                 int8_tArray intermediate_nodes_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes, i);
47690                 LDKPublicKey intermediate_nodes_conv_8_ref;
47691                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_conv_8) == 33);
47692                 (*env)->GetByteArrayRegion(env, intermediate_nodes_conv_8, 0, 33, intermediate_nodes_conv_8_ref.compressed_form);
47693                 intermediate_nodes_constr.data[i] = intermediate_nodes_conv_8_ref;
47694         }
47695         void* destination_ptr = untag_ptr(destination);
47696         CHECK_ACCESS(destination_ptr);
47697         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
47698         // WARNING: we may need a move here but no clone is available for LDKDestination
47699         LDKBlindedRoute reply_path_conv;
47700         reply_path_conv.inner = untag_ptr(reply_path);
47701         reply_path_conv.is_owned = ptr_is_owned(reply_path);
47702         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
47703         reply_path_conv.is_owned = false;
47704         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
47705         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, reply_path_conv);
47706         return tag_ptr(ret_conv, true);
47707 }
47708
47709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
47710         LDKOnionMessenger this_arg_conv;
47711         this_arg_conv.inner = untag_ptr(this_arg);
47712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47714         this_arg_conv.is_owned = false;
47715         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
47716         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
47717         return tag_ptr(ret_ret, true);
47718 }
47719
47720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
47721         LDKOnionMessenger this_arg_conv;
47722         this_arg_conv.inner = untag_ptr(this_arg);
47723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47725         this_arg_conv.is_owned = false;
47726         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
47727         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
47728         return tag_ptr(ret_ret, true);
47729 }
47730
47731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47732         LDKFilesystemPersister this_obj_conv;
47733         this_obj_conv.inner = untag_ptr(this_obj);
47734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47736         FilesystemPersister_free(this_obj_conv);
47737 }
47738
47739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
47740         LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
47741         LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
47742         int64_t ret_ref = 0;
47743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47745         return ret_ref;
47746 }
47747
47748 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
47749         LDKFilesystemPersister this_arg_conv;
47750         this_arg_conv.inner = untag_ptr(this_arg);
47751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47753         this_arg_conv.is_owned = false;
47754         LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
47755         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47756         Str_free(ret_str);
47757         return ret_conv;
47758 }
47759
47760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
47761         LDKFilesystemPersister this_arg_conv;
47762         this_arg_conv.inner = untag_ptr(this_arg);
47763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47765         this_arg_conv.is_owned = false;
47766         void* keys_manager_ptr = untag_ptr(keys_manager);
47767         CHECK_ACCESS(keys_manager_ptr);
47768         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47769         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47770                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47771                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47772         }
47773         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
47774         *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
47775         return tag_ptr(ret_conv, true);
47776 }
47777
47778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47779         LDKBackgroundProcessor this_obj_conv;
47780         this_obj_conv.inner = untag_ptr(this_obj);
47781         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47783         BackgroundProcessor_free(this_obj_conv);
47784 }
47785
47786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47787         if (!ptr_is_owned(this_ptr)) return;
47788         void* this_ptr_ptr = untag_ptr(this_ptr);
47789         CHECK_ACCESS(this_ptr_ptr);
47790         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
47791         FREE(untag_ptr(this_ptr));
47792         GossipSync_free(this_ptr_conv);
47793 }
47794
47795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
47796         LDKP2PGossipSync a_conv;
47797         a_conv.inner = untag_ptr(a);
47798         a_conv.is_owned = ptr_is_owned(a);
47799         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47800         a_conv.is_owned = false;
47801         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47802         *ret_copy = GossipSync_p2_p(&a_conv);
47803         int64_t ret_ref = tag_ptr(ret_copy, true);
47804         return ret_ref;
47805 }
47806
47807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
47808         LDKRapidGossipSync a_conv;
47809         a_conv.inner = untag_ptr(a);
47810         a_conv.is_owned = ptr_is_owned(a);
47811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47812         a_conv.is_owned = false;
47813         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47814         *ret_copy = GossipSync_rapid(&a_conv);
47815         int64_t ret_ref = tag_ptr(ret_copy, true);
47816         return ret_ref;
47817 }
47818
47819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
47820         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
47821         *ret_copy = GossipSync_none();
47822         int64_t ret_ref = tag_ptr(ret_copy, true);
47823         return ret_ref;
47824 }
47825
47826 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) {
47827         void* persister_ptr = untag_ptr(persister);
47828         CHECK_ACCESS(persister_ptr);
47829         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
47830         if (persister_conv.free == LDKPersister_JCalls_free) {
47831                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47832                 LDKPersister_JCalls_cloned(&persister_conv);
47833         }
47834         void* event_handler_ptr = untag_ptr(event_handler);
47835         CHECK_ACCESS(event_handler_ptr);
47836         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47837         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47838                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47839                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47840         }
47841         LDKChainMonitor chain_monitor_conv;
47842         chain_monitor_conv.inner = untag_ptr(chain_monitor);
47843         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
47844         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
47845         chain_monitor_conv.is_owned = false;
47846         LDKChannelManager channel_manager_conv;
47847         channel_manager_conv.inner = untag_ptr(channel_manager);
47848         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
47849         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
47850         channel_manager_conv.is_owned = false;
47851         void* gossip_sync_ptr = untag_ptr(gossip_sync);
47852         CHECK_ACCESS(gossip_sync_ptr);
47853         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
47854         // WARNING: we may need a move here but no clone is available for LDKGossipSync
47855         LDKPeerManager peer_manager_conv;
47856         peer_manager_conv.inner = untag_ptr(peer_manager);
47857         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
47858         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
47859         peer_manager_conv.is_owned = false;
47860         void* logger_ptr = untag_ptr(logger);
47861         CHECK_ACCESS(logger_ptr);
47862         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47863         if (logger_conv.free == LDKLogger_JCalls_free) {
47864                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47865                 LDKLogger_JCalls_cloned(&logger_conv);
47866         }
47867         void* scorer_ptr = untag_ptr(scorer);
47868         CHECK_ACCESS(scorer_ptr);
47869         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
47870         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
47871         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
47872                 // Manually implement clone for Java trait instances
47873                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
47874                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47875                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
47876                 }
47877         }
47878         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);
47879         int64_t ret_ref = 0;
47880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47882         return ret_ref;
47883 }
47884
47885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
47886         LDKBackgroundProcessor this_arg_conv;
47887         this_arg_conv.inner = untag_ptr(this_arg);
47888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47890         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
47891         
47892         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
47893         *ret_conv = BackgroundProcessor_join(this_arg_conv);
47894         return tag_ptr(ret_conv, true);
47895 }
47896
47897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
47898         LDKBackgroundProcessor this_arg_conv;
47899         this_arg_conv.inner = untag_ptr(this_arg);
47900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47902         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
47903         
47904         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
47905         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
47906         return tag_ptr(ret_conv, true);
47907 }
47908
47909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47910         if (!ptr_is_owned(this_ptr)) return;
47911         void* this_ptr_ptr = untag_ptr(this_ptr);
47912         CHECK_ACCESS(this_ptr_ptr);
47913         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
47914         FREE(untag_ptr(this_ptr));
47915         ParseError_free(this_ptr_conv);
47916 }
47917
47918 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
47919         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47920         *ret_copy = ParseError_clone(arg);
47921         int64_t ret_ref = tag_ptr(ret_copy, true);
47922         return ret_ref;
47923 }
47924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47925         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
47926         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
47927         return ret_conv;
47928 }
47929
47930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47931         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
47932         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47933         *ret_copy = ParseError_clone(orig_conv);
47934         int64_t ret_ref = tag_ptr(ret_copy, true);
47935         return ret_ref;
47936 }
47937
47938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
47939         void* a_ptr = untag_ptr(a);
47940         CHECK_ACCESS(a_ptr);
47941         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
47942         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
47943         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47944         *ret_copy = ParseError_bech32_error(a_conv);
47945         int64_t ret_ref = tag_ptr(ret_copy, true);
47946         return ret_ref;
47947 }
47948
47949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
47950         
47951         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47952         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
47953         int64_t ret_ref = tag_ptr(ret_copy, true);
47954         return ret_ref;
47955 }
47956
47957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
47958         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
47959         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47960         *ret_copy = ParseError_malformed_signature(a_conv);
47961         int64_t ret_ref = tag_ptr(ret_copy, true);
47962         return ret_ref;
47963 }
47964
47965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
47966         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47967         *ret_copy = ParseError_bad_prefix();
47968         int64_t ret_ref = tag_ptr(ret_copy, true);
47969         return ret_ref;
47970 }
47971
47972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
47973         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47974         *ret_copy = ParseError_unknown_currency();
47975         int64_t ret_ref = tag_ptr(ret_copy, true);
47976         return ret_ref;
47977 }
47978
47979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
47980         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47981         *ret_copy = ParseError_unknown_si_prefix();
47982         int64_t ret_ref = tag_ptr(ret_copy, true);
47983         return ret_ref;
47984 }
47985
47986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
47987         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47988         *ret_copy = ParseError_malformed_hrp();
47989         int64_t ret_ref = tag_ptr(ret_copy, true);
47990         return ret_ref;
47991 }
47992
47993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
47994         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
47995         *ret_copy = ParseError_too_short_data_part();
47996         int64_t ret_ref = tag_ptr(ret_copy, true);
47997         return ret_ref;
47998 }
47999
48000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
48001         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48002         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
48003         int64_t ret_ref = tag_ptr(ret_copy, true);
48004         return ret_ref;
48005 }
48006
48007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
48008         
48009         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48010         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
48011         int64_t ret_ref = tag_ptr(ret_copy, true);
48012         return ret_ref;
48013 }
48014
48015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
48016         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48017         *ret_copy = ParseError_padding_error();
48018         int64_t ret_ref = tag_ptr(ret_copy, true);
48019         return ret_ref;
48020 }
48021
48022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
48023         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48024         *ret_copy = ParseError_integer_overflow_error();
48025         int64_t ret_ref = tag_ptr(ret_copy, true);
48026         return ret_ref;
48027 }
48028
48029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
48030         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48031         *ret_copy = ParseError_invalid_seg_wit_program_length();
48032         int64_t ret_ref = tag_ptr(ret_copy, true);
48033         return ret_ref;
48034 }
48035
48036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
48037         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48038         *ret_copy = ParseError_invalid_pub_key_hash_length();
48039         int64_t ret_ref = tag_ptr(ret_copy, true);
48040         return ret_ref;
48041 }
48042
48043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
48044         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48045         *ret_copy = ParseError_invalid_script_hash_length();
48046         int64_t ret_ref = tag_ptr(ret_copy, true);
48047         return ret_ref;
48048 }
48049
48050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
48051         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48052         *ret_copy = ParseError_invalid_recovery_id();
48053         int64_t ret_ref = tag_ptr(ret_copy, true);
48054         return ret_ref;
48055 }
48056
48057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
48058         LDKStr a_conv = java_to_owned_str(env, a);
48059         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48060         *ret_copy = ParseError_invalid_slice_length(a_conv);
48061         int64_t ret_ref = tag_ptr(ret_copy, true);
48062         return ret_ref;
48063 }
48064
48065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
48066         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
48067         *ret_copy = ParseError_skip();
48068         int64_t ret_ref = tag_ptr(ret_copy, true);
48069         return ret_ref;
48070 }
48071
48072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48073         if (!ptr_is_owned(this_ptr)) return;
48074         void* this_ptr_ptr = untag_ptr(this_ptr);
48075         CHECK_ACCESS(this_ptr_ptr);
48076         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
48077         FREE(untag_ptr(this_ptr));
48078         ParseOrSemanticError_free(this_ptr_conv);
48079 }
48080
48081 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
48082         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48083         *ret_copy = ParseOrSemanticError_clone(arg);
48084         int64_t ret_ref = tag_ptr(ret_copy, true);
48085         return ret_ref;
48086 }
48087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48088         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
48089         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
48090         return ret_conv;
48091 }
48092
48093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48094         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
48095         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48096         *ret_copy = ParseOrSemanticError_clone(orig_conv);
48097         int64_t ret_ref = tag_ptr(ret_copy, true);
48098         return ret_ref;
48099 }
48100
48101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
48102         void* a_ptr = untag_ptr(a);
48103         CHECK_ACCESS(a_ptr);
48104         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
48105         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
48106         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48107         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
48108         int64_t ret_ref = tag_ptr(ret_copy, true);
48109         return ret_ref;
48110 }
48111
48112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
48113         LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
48114         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
48115         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
48116         int64_t ret_ref = tag_ptr(ret_copy, true);
48117         return ret_ref;
48118 }
48119
48120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48121         LDKInvoice this_obj_conv;
48122         this_obj_conv.inner = untag_ptr(this_obj);
48123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48125         Invoice_free(this_obj_conv);
48126 }
48127
48128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48129         LDKInvoice a_conv;
48130         a_conv.inner = untag_ptr(a);
48131         a_conv.is_owned = ptr_is_owned(a);
48132         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48133         a_conv.is_owned = false;
48134         LDKInvoice b_conv;
48135         b_conv.inner = untag_ptr(b);
48136         b_conv.is_owned = ptr_is_owned(b);
48137         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48138         b_conv.is_owned = false;
48139         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
48140         return ret_conv;
48141 }
48142
48143 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
48144         LDKInvoice ret_var = Invoice_clone(arg);
48145         int64_t ret_ref = 0;
48146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48148         return ret_ref;
48149 }
48150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48151         LDKInvoice arg_conv;
48152         arg_conv.inner = untag_ptr(arg);
48153         arg_conv.is_owned = ptr_is_owned(arg);
48154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48155         arg_conv.is_owned = false;
48156         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
48157         return ret_conv;
48158 }
48159
48160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48161         LDKInvoice orig_conv;
48162         orig_conv.inner = untag_ptr(orig);
48163         orig_conv.is_owned = ptr_is_owned(orig);
48164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48165         orig_conv.is_owned = false;
48166         LDKInvoice ret_var = Invoice_clone(&orig_conv);
48167         int64_t ret_ref = 0;
48168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48170         return ret_ref;
48171 }
48172
48173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
48174         LDKInvoice o_conv;
48175         o_conv.inner = untag_ptr(o);
48176         o_conv.is_owned = ptr_is_owned(o);
48177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48178         o_conv.is_owned = false;
48179         int64_t ret_conv = Invoice_hash(&o_conv);
48180         return ret_conv;
48181 }
48182
48183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48184         LDKSignedRawInvoice this_obj_conv;
48185         this_obj_conv.inner = untag_ptr(this_obj);
48186         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48188         SignedRawInvoice_free(this_obj_conv);
48189 }
48190
48191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48192         LDKSignedRawInvoice a_conv;
48193         a_conv.inner = untag_ptr(a);
48194         a_conv.is_owned = ptr_is_owned(a);
48195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48196         a_conv.is_owned = false;
48197         LDKSignedRawInvoice b_conv;
48198         b_conv.inner = untag_ptr(b);
48199         b_conv.is_owned = ptr_is_owned(b);
48200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48201         b_conv.is_owned = false;
48202         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
48203         return ret_conv;
48204 }
48205
48206 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
48207         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
48208         int64_t ret_ref = 0;
48209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48211         return ret_ref;
48212 }
48213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48214         LDKSignedRawInvoice arg_conv;
48215         arg_conv.inner = untag_ptr(arg);
48216         arg_conv.is_owned = ptr_is_owned(arg);
48217         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48218         arg_conv.is_owned = false;
48219         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
48220         return ret_conv;
48221 }
48222
48223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48224         LDKSignedRawInvoice orig_conv;
48225         orig_conv.inner = untag_ptr(orig);
48226         orig_conv.is_owned = ptr_is_owned(orig);
48227         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48228         orig_conv.is_owned = false;
48229         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
48230         int64_t ret_ref = 0;
48231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48233         return ret_ref;
48234 }
48235
48236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
48237         LDKSignedRawInvoice o_conv;
48238         o_conv.inner = untag_ptr(o);
48239         o_conv.is_owned = ptr_is_owned(o);
48240         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48241         o_conv.is_owned = false;
48242         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
48243         return ret_conv;
48244 }
48245
48246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48247         LDKRawInvoice this_obj_conv;
48248         this_obj_conv.inner = untag_ptr(this_obj);
48249         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48251         RawInvoice_free(this_obj_conv);
48252 }
48253
48254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
48255         LDKRawInvoice this_ptr_conv;
48256         this_ptr_conv.inner = untag_ptr(this_ptr);
48257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48259         this_ptr_conv.is_owned = false;
48260         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
48261         int64_t ret_ref = 0;
48262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48264         return ret_ref;
48265 }
48266
48267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48268         LDKRawInvoice this_ptr_conv;
48269         this_ptr_conv.inner = untag_ptr(this_ptr);
48270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48272         this_ptr_conv.is_owned = false;
48273         LDKRawDataPart val_conv;
48274         val_conv.inner = untag_ptr(val);
48275         val_conv.is_owned = ptr_is_owned(val);
48276         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48277         val_conv = RawDataPart_clone(&val_conv);
48278         RawInvoice_set_data(&this_ptr_conv, val_conv);
48279 }
48280
48281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48282         LDKRawInvoice a_conv;
48283         a_conv.inner = untag_ptr(a);
48284         a_conv.is_owned = ptr_is_owned(a);
48285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48286         a_conv.is_owned = false;
48287         LDKRawInvoice b_conv;
48288         b_conv.inner = untag_ptr(b);
48289         b_conv.is_owned = ptr_is_owned(b);
48290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48291         b_conv.is_owned = false;
48292         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
48293         return ret_conv;
48294 }
48295
48296 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
48297         LDKRawInvoice ret_var = RawInvoice_clone(arg);
48298         int64_t ret_ref = 0;
48299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48301         return ret_ref;
48302 }
48303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48304         LDKRawInvoice arg_conv;
48305         arg_conv.inner = untag_ptr(arg);
48306         arg_conv.is_owned = ptr_is_owned(arg);
48307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48308         arg_conv.is_owned = false;
48309         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
48310         return ret_conv;
48311 }
48312
48313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48314         LDKRawInvoice orig_conv;
48315         orig_conv.inner = untag_ptr(orig);
48316         orig_conv.is_owned = ptr_is_owned(orig);
48317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48318         orig_conv.is_owned = false;
48319         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
48320         int64_t ret_ref = 0;
48321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48323         return ret_ref;
48324 }
48325
48326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
48327         LDKRawInvoice o_conv;
48328         o_conv.inner = untag_ptr(o);
48329         o_conv.is_owned = ptr_is_owned(o);
48330         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48331         o_conv.is_owned = false;
48332         int64_t ret_conv = RawInvoice_hash(&o_conv);
48333         return ret_conv;
48334 }
48335
48336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48337         LDKRawDataPart this_obj_conv;
48338         this_obj_conv.inner = untag_ptr(this_obj);
48339         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48341         RawDataPart_free(this_obj_conv);
48342 }
48343
48344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
48345         LDKRawDataPart this_ptr_conv;
48346         this_ptr_conv.inner = untag_ptr(this_ptr);
48347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48349         this_ptr_conv.is_owned = false;
48350         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
48351         int64_t ret_ref = 0;
48352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48354         return ret_ref;
48355 }
48356
48357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48358         LDKRawDataPart this_ptr_conv;
48359         this_ptr_conv.inner = untag_ptr(this_ptr);
48360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48362         this_ptr_conv.is_owned = false;
48363         LDKPositiveTimestamp val_conv;
48364         val_conv.inner = untag_ptr(val);
48365         val_conv.is_owned = ptr_is_owned(val);
48366         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48367         val_conv = PositiveTimestamp_clone(&val_conv);
48368         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
48369 }
48370
48371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48372         LDKRawDataPart a_conv;
48373         a_conv.inner = untag_ptr(a);
48374         a_conv.is_owned = ptr_is_owned(a);
48375         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48376         a_conv.is_owned = false;
48377         LDKRawDataPart b_conv;
48378         b_conv.inner = untag_ptr(b);
48379         b_conv.is_owned = ptr_is_owned(b);
48380         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48381         b_conv.is_owned = false;
48382         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
48383         return ret_conv;
48384 }
48385
48386 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
48387         LDKRawDataPart ret_var = RawDataPart_clone(arg);
48388         int64_t ret_ref = 0;
48389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48391         return ret_ref;
48392 }
48393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48394         LDKRawDataPart arg_conv;
48395         arg_conv.inner = untag_ptr(arg);
48396         arg_conv.is_owned = ptr_is_owned(arg);
48397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48398         arg_conv.is_owned = false;
48399         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
48400         return ret_conv;
48401 }
48402
48403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48404         LDKRawDataPart orig_conv;
48405         orig_conv.inner = untag_ptr(orig);
48406         orig_conv.is_owned = ptr_is_owned(orig);
48407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48408         orig_conv.is_owned = false;
48409         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
48410         int64_t ret_ref = 0;
48411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48413         return ret_ref;
48414 }
48415
48416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
48417         LDKRawDataPart o_conv;
48418         o_conv.inner = untag_ptr(o);
48419         o_conv.is_owned = ptr_is_owned(o);
48420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48421         o_conv.is_owned = false;
48422         int64_t ret_conv = RawDataPart_hash(&o_conv);
48423         return ret_conv;
48424 }
48425
48426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48427         LDKPositiveTimestamp this_obj_conv;
48428         this_obj_conv.inner = untag_ptr(this_obj);
48429         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48431         PositiveTimestamp_free(this_obj_conv);
48432 }
48433
48434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48435         LDKPositiveTimestamp a_conv;
48436         a_conv.inner = untag_ptr(a);
48437         a_conv.is_owned = ptr_is_owned(a);
48438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48439         a_conv.is_owned = false;
48440         LDKPositiveTimestamp b_conv;
48441         b_conv.inner = untag_ptr(b);
48442         b_conv.is_owned = ptr_is_owned(b);
48443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48444         b_conv.is_owned = false;
48445         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
48446         return ret_conv;
48447 }
48448
48449 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
48450         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
48451         int64_t ret_ref = 0;
48452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48454         return ret_ref;
48455 }
48456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48457         LDKPositiveTimestamp arg_conv;
48458         arg_conv.inner = untag_ptr(arg);
48459         arg_conv.is_owned = ptr_is_owned(arg);
48460         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48461         arg_conv.is_owned = false;
48462         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
48463         return ret_conv;
48464 }
48465
48466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48467         LDKPositiveTimestamp orig_conv;
48468         orig_conv.inner = untag_ptr(orig);
48469         orig_conv.is_owned = ptr_is_owned(orig);
48470         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48471         orig_conv.is_owned = false;
48472         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
48473         int64_t ret_ref = 0;
48474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48476         return ret_ref;
48477 }
48478
48479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
48480         LDKPositiveTimestamp o_conv;
48481         o_conv.inner = untag_ptr(o);
48482         o_conv.is_owned = ptr_is_owned(o);
48483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48484         o_conv.is_owned = false;
48485         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
48486         return ret_conv;
48487 }
48488
48489 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48490         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
48491         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
48492         return ret_conv;
48493 }
48494
48495 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
48496         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
48497         return ret_conv;
48498 }
48499
48500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
48501         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
48502         return ret_conv;
48503 }
48504
48505 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
48506         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
48507         return ret_conv;
48508 }
48509
48510 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
48511         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
48512         return ret_conv;
48513 }
48514
48515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48516         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
48517         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
48518         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
48519         return ret_conv;
48520 }
48521
48522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
48523         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
48524         int64_t ret_conv = SiPrefix_hash(o_conv);
48525         return ret_conv;
48526 }
48527
48528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
48529         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
48530         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
48531         return ret_conv;
48532 }
48533
48534 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48535         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
48536         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
48537         return ret_conv;
48538 }
48539
48540 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
48541         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
48542         return ret_conv;
48543 }
48544
48545 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
48546         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
48547         return ret_conv;
48548 }
48549
48550 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
48551         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
48552         return ret_conv;
48553 }
48554
48555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
48556         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
48557         return ret_conv;
48558 }
48559
48560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
48561         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
48562         return ret_conv;
48563 }
48564
48565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
48566         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
48567         int64_t ret_conv = Currency_hash(o_conv);
48568         return ret_conv;
48569 }
48570
48571 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48572         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
48573         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
48574         jboolean ret_conv = Currency_eq(a_conv, b_conv);
48575         return ret_conv;
48576 }
48577
48578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48579         LDKSha256 this_obj_conv;
48580         this_obj_conv.inner = untag_ptr(this_obj);
48581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48583         Sha256_free(this_obj_conv);
48584 }
48585
48586 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
48587         LDKSha256 ret_var = Sha256_clone(arg);
48588         int64_t ret_ref = 0;
48589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48591         return ret_ref;
48592 }
48593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48594         LDKSha256 arg_conv;
48595         arg_conv.inner = untag_ptr(arg);
48596         arg_conv.is_owned = ptr_is_owned(arg);
48597         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48598         arg_conv.is_owned = false;
48599         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
48600         return ret_conv;
48601 }
48602
48603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48604         LDKSha256 orig_conv;
48605         orig_conv.inner = untag_ptr(orig);
48606         orig_conv.is_owned = ptr_is_owned(orig);
48607         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48608         orig_conv.is_owned = false;
48609         LDKSha256 ret_var = Sha256_clone(&orig_conv);
48610         int64_t ret_ref = 0;
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48613         return ret_ref;
48614 }
48615
48616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
48617         LDKSha256 o_conv;
48618         o_conv.inner = untag_ptr(o);
48619         o_conv.is_owned = ptr_is_owned(o);
48620         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48621         o_conv.is_owned = false;
48622         int64_t ret_conv = Sha256_hash(&o_conv);
48623         return ret_conv;
48624 }
48625
48626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48627         LDKSha256 a_conv;
48628         a_conv.inner = untag_ptr(a);
48629         a_conv.is_owned = ptr_is_owned(a);
48630         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48631         a_conv.is_owned = false;
48632         LDKSha256 b_conv;
48633         b_conv.inner = untag_ptr(b);
48634         b_conv.is_owned = ptr_is_owned(b);
48635         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48636         b_conv.is_owned = false;
48637         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
48638         return ret_conv;
48639 }
48640
48641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48642         LDKDescription this_obj_conv;
48643         this_obj_conv.inner = untag_ptr(this_obj);
48644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48646         Description_free(this_obj_conv);
48647 }
48648
48649 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
48650         LDKDescription ret_var = Description_clone(arg);
48651         int64_t ret_ref = 0;
48652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48654         return ret_ref;
48655 }
48656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48657         LDKDescription arg_conv;
48658         arg_conv.inner = untag_ptr(arg);
48659         arg_conv.is_owned = ptr_is_owned(arg);
48660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48661         arg_conv.is_owned = false;
48662         int64_t ret_conv = Description_clone_ptr(&arg_conv);
48663         return ret_conv;
48664 }
48665
48666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48667         LDKDescription orig_conv;
48668         orig_conv.inner = untag_ptr(orig);
48669         orig_conv.is_owned = ptr_is_owned(orig);
48670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48671         orig_conv.is_owned = false;
48672         LDKDescription ret_var = Description_clone(&orig_conv);
48673         int64_t ret_ref = 0;
48674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48676         return ret_ref;
48677 }
48678
48679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
48680         LDKDescription o_conv;
48681         o_conv.inner = untag_ptr(o);
48682         o_conv.is_owned = ptr_is_owned(o);
48683         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48684         o_conv.is_owned = false;
48685         int64_t ret_conv = Description_hash(&o_conv);
48686         return ret_conv;
48687 }
48688
48689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48690         LDKDescription a_conv;
48691         a_conv.inner = untag_ptr(a);
48692         a_conv.is_owned = ptr_is_owned(a);
48693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48694         a_conv.is_owned = false;
48695         LDKDescription b_conv;
48696         b_conv.inner = untag_ptr(b);
48697         b_conv.is_owned = ptr_is_owned(b);
48698         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48699         b_conv.is_owned = false;
48700         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
48701         return ret_conv;
48702 }
48703
48704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48705         LDKPayeePubKey this_obj_conv;
48706         this_obj_conv.inner = untag_ptr(this_obj);
48707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48709         PayeePubKey_free(this_obj_conv);
48710 }
48711
48712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
48713         LDKPayeePubKey this_ptr_conv;
48714         this_ptr_conv.inner = untag_ptr(this_ptr);
48715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48717         this_ptr_conv.is_owned = false;
48718         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48719         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
48720         return ret_arr;
48721 }
48722
48723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
48724         LDKPayeePubKey this_ptr_conv;
48725         this_ptr_conv.inner = untag_ptr(this_ptr);
48726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48728         this_ptr_conv.is_owned = false;
48729         LDKPublicKey val_ref;
48730         CHECK((*env)->GetArrayLength(env, val) == 33);
48731         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
48732         PayeePubKey_set_a(&this_ptr_conv, val_ref);
48733 }
48734
48735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
48736         LDKPublicKey a_arg_ref;
48737         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
48738         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
48739         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
48740         int64_t ret_ref = 0;
48741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48743         return ret_ref;
48744 }
48745
48746 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
48747         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
48748         int64_t ret_ref = 0;
48749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48751         return ret_ref;
48752 }
48753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48754         LDKPayeePubKey arg_conv;
48755         arg_conv.inner = untag_ptr(arg);
48756         arg_conv.is_owned = ptr_is_owned(arg);
48757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48758         arg_conv.is_owned = false;
48759         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
48760         return ret_conv;
48761 }
48762
48763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48764         LDKPayeePubKey orig_conv;
48765         orig_conv.inner = untag_ptr(orig);
48766         orig_conv.is_owned = ptr_is_owned(orig);
48767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48768         orig_conv.is_owned = false;
48769         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
48770         int64_t ret_ref = 0;
48771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48773         return ret_ref;
48774 }
48775
48776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
48777         LDKPayeePubKey o_conv;
48778         o_conv.inner = untag_ptr(o);
48779         o_conv.is_owned = ptr_is_owned(o);
48780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48781         o_conv.is_owned = false;
48782         int64_t ret_conv = PayeePubKey_hash(&o_conv);
48783         return ret_conv;
48784 }
48785
48786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48787         LDKPayeePubKey a_conv;
48788         a_conv.inner = untag_ptr(a);
48789         a_conv.is_owned = ptr_is_owned(a);
48790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48791         a_conv.is_owned = false;
48792         LDKPayeePubKey b_conv;
48793         b_conv.inner = untag_ptr(b);
48794         b_conv.is_owned = ptr_is_owned(b);
48795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48796         b_conv.is_owned = false;
48797         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
48798         return ret_conv;
48799 }
48800
48801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48802         LDKExpiryTime this_obj_conv;
48803         this_obj_conv.inner = untag_ptr(this_obj);
48804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48806         ExpiryTime_free(this_obj_conv);
48807 }
48808
48809 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
48810         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
48811         int64_t ret_ref = 0;
48812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48814         return ret_ref;
48815 }
48816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48817         LDKExpiryTime arg_conv;
48818         arg_conv.inner = untag_ptr(arg);
48819         arg_conv.is_owned = ptr_is_owned(arg);
48820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48821         arg_conv.is_owned = false;
48822         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
48823         return ret_conv;
48824 }
48825
48826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48827         LDKExpiryTime orig_conv;
48828         orig_conv.inner = untag_ptr(orig);
48829         orig_conv.is_owned = ptr_is_owned(orig);
48830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48831         orig_conv.is_owned = false;
48832         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
48833         int64_t ret_ref = 0;
48834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48836         return ret_ref;
48837 }
48838
48839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
48840         LDKExpiryTime o_conv;
48841         o_conv.inner = untag_ptr(o);
48842         o_conv.is_owned = ptr_is_owned(o);
48843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48844         o_conv.is_owned = false;
48845         int64_t ret_conv = ExpiryTime_hash(&o_conv);
48846         return ret_conv;
48847 }
48848
48849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48850         LDKExpiryTime a_conv;
48851         a_conv.inner = untag_ptr(a);
48852         a_conv.is_owned = ptr_is_owned(a);
48853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48854         a_conv.is_owned = false;
48855         LDKExpiryTime b_conv;
48856         b_conv.inner = untag_ptr(b);
48857         b_conv.is_owned = ptr_is_owned(b);
48858         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48859         b_conv.is_owned = false;
48860         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
48861         return ret_conv;
48862 }
48863
48864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48865         LDKMinFinalCltvExpiry this_obj_conv;
48866         this_obj_conv.inner = untag_ptr(this_obj);
48867         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48869         MinFinalCltvExpiry_free(this_obj_conv);
48870 }
48871
48872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
48873         LDKMinFinalCltvExpiry this_ptr_conv;
48874         this_ptr_conv.inner = untag_ptr(this_ptr);
48875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48877         this_ptr_conv.is_owned = false;
48878         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
48879         return ret_conv;
48880 }
48881
48882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
48883         LDKMinFinalCltvExpiry this_ptr_conv;
48884         this_ptr_conv.inner = untag_ptr(this_ptr);
48885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48887         this_ptr_conv.is_owned = false;
48888         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
48889 }
48890
48891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
48892         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
48893         int64_t ret_ref = 0;
48894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48896         return ret_ref;
48897 }
48898
48899 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
48900         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
48901         int64_t ret_ref = 0;
48902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48904         return ret_ref;
48905 }
48906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48907         LDKMinFinalCltvExpiry arg_conv;
48908         arg_conv.inner = untag_ptr(arg);
48909         arg_conv.is_owned = ptr_is_owned(arg);
48910         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48911         arg_conv.is_owned = false;
48912         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
48913         return ret_conv;
48914 }
48915
48916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48917         LDKMinFinalCltvExpiry orig_conv;
48918         orig_conv.inner = untag_ptr(orig);
48919         orig_conv.is_owned = ptr_is_owned(orig);
48920         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48921         orig_conv.is_owned = false;
48922         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
48923         int64_t ret_ref = 0;
48924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48926         return ret_ref;
48927 }
48928
48929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
48930         LDKMinFinalCltvExpiry o_conv;
48931         o_conv.inner = untag_ptr(o);
48932         o_conv.is_owned = ptr_is_owned(o);
48933         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48934         o_conv.is_owned = false;
48935         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
48936         return ret_conv;
48937 }
48938
48939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48940         LDKMinFinalCltvExpiry a_conv;
48941         a_conv.inner = untag_ptr(a);
48942         a_conv.is_owned = ptr_is_owned(a);
48943         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48944         a_conv.is_owned = false;
48945         LDKMinFinalCltvExpiry b_conv;
48946         b_conv.inner = untag_ptr(b);
48947         b_conv.is_owned = ptr_is_owned(b);
48948         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48949         b_conv.is_owned = false;
48950         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
48951         return ret_conv;
48952 }
48953
48954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48955         if (!ptr_is_owned(this_ptr)) return;
48956         void* this_ptr_ptr = untag_ptr(this_ptr);
48957         CHECK_ACCESS(this_ptr_ptr);
48958         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
48959         FREE(untag_ptr(this_ptr));
48960         Fallback_free(this_ptr_conv);
48961 }
48962
48963 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
48964         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48965         *ret_copy = Fallback_clone(arg);
48966         int64_t ret_ref = tag_ptr(ret_copy, true);
48967         return ret_ref;
48968 }
48969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48970         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
48971         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
48972         return ret_conv;
48973 }
48974
48975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48976         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
48977         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48978         *ret_copy = Fallback_clone(orig_conv);
48979         int64_t ret_ref = tag_ptr(ret_copy, true);
48980         return ret_ref;
48981 }
48982
48983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
48984         
48985         LDKCVec_u8Z program_ref;
48986         program_ref.datalen = (*env)->GetArrayLength(env, program);
48987         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
48988         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
48989         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
48990         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
48991         int64_t ret_ref = tag_ptr(ret_copy, true);
48992         return ret_ref;
48993 }
48994
48995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
48996         LDKTwentyBytes a_ref;
48997         CHECK((*env)->GetArrayLength(env, a) == 20);
48998         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
48999         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49000         *ret_copy = Fallback_pub_key_hash(a_ref);
49001         int64_t ret_ref = tag_ptr(ret_copy, true);
49002         return ret_ref;
49003 }
49004
49005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
49006         LDKTwentyBytes a_ref;
49007         CHECK((*env)->GetArrayLength(env, a) == 20);
49008         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
49009         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
49010         *ret_copy = Fallback_script_hash(a_ref);
49011         int64_t ret_ref = tag_ptr(ret_copy, true);
49012         return ret_ref;
49013 }
49014
49015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
49016         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
49017         int64_t ret_conv = Fallback_hash(o_conv);
49018         return ret_conv;
49019 }
49020
49021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49022         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
49023         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
49024         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
49025         return ret_conv;
49026 }
49027
49028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49029         LDKInvoiceSignature this_obj_conv;
49030         this_obj_conv.inner = untag_ptr(this_obj);
49031         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49033         InvoiceSignature_free(this_obj_conv);
49034 }
49035
49036 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
49037         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
49038         int64_t ret_ref = 0;
49039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49041         return ret_ref;
49042 }
49043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49044         LDKInvoiceSignature arg_conv;
49045         arg_conv.inner = untag_ptr(arg);
49046         arg_conv.is_owned = ptr_is_owned(arg);
49047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49048         arg_conv.is_owned = false;
49049         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
49050         return ret_conv;
49051 }
49052
49053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49054         LDKInvoiceSignature orig_conv;
49055         orig_conv.inner = untag_ptr(orig);
49056         orig_conv.is_owned = ptr_is_owned(orig);
49057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49058         orig_conv.is_owned = false;
49059         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
49060         int64_t ret_ref = 0;
49061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49063         return ret_ref;
49064 }
49065
49066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
49067         LDKInvoiceSignature o_conv;
49068         o_conv.inner = untag_ptr(o);
49069         o_conv.is_owned = ptr_is_owned(o);
49070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49071         o_conv.is_owned = false;
49072         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
49073         return ret_conv;
49074 }
49075
49076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49077         LDKInvoiceSignature a_conv;
49078         a_conv.inner = untag_ptr(a);
49079         a_conv.is_owned = ptr_is_owned(a);
49080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49081         a_conv.is_owned = false;
49082         LDKInvoiceSignature b_conv;
49083         b_conv.inner = untag_ptr(b);
49084         b_conv.is_owned = ptr_is_owned(b);
49085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49086         b_conv.is_owned = false;
49087         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
49088         return ret_conv;
49089 }
49090
49091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49092         LDKPrivateRoute this_obj_conv;
49093         this_obj_conv.inner = untag_ptr(this_obj);
49094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49096         PrivateRoute_free(this_obj_conv);
49097 }
49098
49099 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
49100         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
49101         int64_t ret_ref = 0;
49102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49104         return ret_ref;
49105 }
49106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49107         LDKPrivateRoute arg_conv;
49108         arg_conv.inner = untag_ptr(arg);
49109         arg_conv.is_owned = ptr_is_owned(arg);
49110         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49111         arg_conv.is_owned = false;
49112         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
49113         return ret_conv;
49114 }
49115
49116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49117         LDKPrivateRoute orig_conv;
49118         orig_conv.inner = untag_ptr(orig);
49119         orig_conv.is_owned = ptr_is_owned(orig);
49120         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49121         orig_conv.is_owned = false;
49122         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
49123         int64_t ret_ref = 0;
49124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49126         return ret_ref;
49127 }
49128
49129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
49130         LDKPrivateRoute o_conv;
49131         o_conv.inner = untag_ptr(o);
49132         o_conv.is_owned = ptr_is_owned(o);
49133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49134         o_conv.is_owned = false;
49135         int64_t ret_conv = PrivateRoute_hash(&o_conv);
49136         return ret_conv;
49137 }
49138
49139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49140         LDKPrivateRoute a_conv;
49141         a_conv.inner = untag_ptr(a);
49142         a_conv.is_owned = ptr_is_owned(a);
49143         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49144         a_conv.is_owned = false;
49145         LDKPrivateRoute b_conv;
49146         b_conv.inner = untag_ptr(b);
49147         b_conv.is_owned = ptr_is_owned(b);
49148         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49149         b_conv.is_owned = false;
49150         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
49151         return ret_conv;
49152 }
49153
49154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
49155         LDKSignedRawInvoice this_arg_conv;
49156         this_arg_conv.inner = untag_ptr(this_arg);
49157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49159         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
49160         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
49161         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
49162         return tag_ptr(ret_conv, true);
49163 }
49164
49165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
49166         LDKSignedRawInvoice this_arg_conv;
49167         this_arg_conv.inner = untag_ptr(this_arg);
49168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49170         this_arg_conv.is_owned = false;
49171         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
49172         int64_t ret_ref = 0;
49173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49175         return ret_ref;
49176 }
49177
49178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
49179         LDKSignedRawInvoice this_arg_conv;
49180         this_arg_conv.inner = untag_ptr(this_arg);
49181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49183         this_arg_conv.is_owned = false;
49184         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49185         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_signable_hash(&this_arg_conv));
49186         return ret_arr;
49187 }
49188
49189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
49190         LDKSignedRawInvoice this_arg_conv;
49191         this_arg_conv.inner = untag_ptr(this_arg);
49192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49194         this_arg_conv.is_owned = false;
49195         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
49196         int64_t ret_ref = 0;
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49199         return ret_ref;
49200 }
49201
49202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49203         LDKSignedRawInvoice this_arg_conv;
49204         this_arg_conv.inner = untag_ptr(this_arg);
49205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49207         this_arg_conv.is_owned = false;
49208         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
49209         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
49210         return tag_ptr(ret_conv, true);
49211 }
49212
49213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
49214         LDKSignedRawInvoice this_arg_conv;
49215         this_arg_conv.inner = untag_ptr(this_arg);
49216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49218         this_arg_conv.is_owned = false;
49219         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
49220         return ret_conv;
49221 }
49222
49223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
49224         LDKRawInvoice this_arg_conv;
49225         this_arg_conv.inner = untag_ptr(this_arg);
49226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49228         this_arg_conv.is_owned = false;
49229         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49230         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_signable_hash(&this_arg_conv).data);
49231         return ret_arr;
49232 }
49233
49234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
49235         LDKRawInvoice this_arg_conv;
49236         this_arg_conv.inner = untag_ptr(this_arg);
49237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49239         this_arg_conv.is_owned = false;
49240         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
49241         int64_t ret_ref = 0;
49242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49244         return ret_ref;
49245 }
49246
49247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
49248         LDKRawInvoice this_arg_conv;
49249         this_arg_conv.inner = untag_ptr(this_arg);
49250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49252         this_arg_conv.is_owned = false;
49253         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
49254         int64_t ret_ref = 0;
49255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49257         return ret_ref;
49258 }
49259
49260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49261         LDKRawInvoice this_arg_conv;
49262         this_arg_conv.inner = untag_ptr(this_arg);
49263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49265         this_arg_conv.is_owned = false;
49266         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
49267         int64_t ret_ref = 0;
49268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49270         return ret_ref;
49271 }
49272
49273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
49274         LDKRawInvoice this_arg_conv;
49275         this_arg_conv.inner = untag_ptr(this_arg);
49276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49278         this_arg_conv.is_owned = false;
49279         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
49280         int64_t ret_ref = 0;
49281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49283         return ret_ref;
49284 }
49285
49286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
49287         LDKRawInvoice this_arg_conv;
49288         this_arg_conv.inner = untag_ptr(this_arg);
49289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49291         this_arg_conv.is_owned = false;
49292         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
49293         int64_t ret_ref = 0;
49294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49296         return ret_ref;
49297 }
49298
49299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
49300         LDKRawInvoice this_arg_conv;
49301         this_arg_conv.inner = untag_ptr(this_arg);
49302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49304         this_arg_conv.is_owned = false;
49305         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
49306         int64_t ret_ref = 0;
49307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49309         return ret_ref;
49310 }
49311
49312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
49313         LDKRawInvoice this_arg_conv;
49314         this_arg_conv.inner = untag_ptr(this_arg);
49315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49317         this_arg_conv.is_owned = false;
49318         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49319         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
49320         return ret_arr;
49321 }
49322
49323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
49324         LDKRawInvoice this_arg_conv;
49325         this_arg_conv.inner = untag_ptr(this_arg);
49326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49328         this_arg_conv.is_owned = false;
49329         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
49330         int64_t ret_ref = 0;
49331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49333         return ret_ref;
49334 }
49335
49336 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
49337         LDKRawInvoice this_arg_conv;
49338         this_arg_conv.inner = untag_ptr(this_arg);
49339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49341         this_arg_conv.is_owned = false;
49342         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
49343         int64_tArray ret_arr = NULL;
49344         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49345         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49346         for (size_t o = 0; o < ret_var.datalen; o++) {
49347                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49348                 int64_t ret_conv_14_ref = 0;
49349                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49350                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
49351                 ret_arr_ptr[o] = ret_conv_14_ref;
49352         }
49353         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49354         FREE(ret_var.data);
49355         return ret_arr;
49356 }
49357
49358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
49359         LDKRawInvoice this_arg_conv;
49360         this_arg_conv.inner = untag_ptr(this_arg);
49361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49363         this_arg_conv.is_owned = false;
49364         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49365         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
49366         int64_t ret_ref = tag_ptr(ret_copy, true);
49367         return ret_ref;
49368 }
49369
49370 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
49371         LDKRawInvoice this_arg_conv;
49372         this_arg_conv.inner = untag_ptr(this_arg);
49373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49375         this_arg_conv.is_owned = false;
49376         jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
49377         return ret_conv;
49378 }
49379
49380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
49381         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
49382         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
49383         return tag_ptr(ret_conv, true);
49384 }
49385
49386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
49387         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
49388         *ret_conv = PositiveTimestamp_from_system_time(time);
49389         return tag_ptr(ret_conv, true);
49390 }
49391
49392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
49393         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
49394         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
49395         return tag_ptr(ret_conv, true);
49396 }
49397
49398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
49399         LDKPositiveTimestamp this_arg_conv;
49400         this_arg_conv.inner = untag_ptr(this_arg);
49401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49403         this_arg_conv.is_owned = false;
49404         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
49405         return ret_conv;
49406 }
49407
49408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
49409         LDKPositiveTimestamp this_arg_conv;
49410         this_arg_conv.inner = untag_ptr(this_arg);
49411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49413         this_arg_conv.is_owned = false;
49414         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
49415         return ret_conv;
49416 }
49417
49418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
49419         LDKPositiveTimestamp this_arg_conv;
49420         this_arg_conv.inner = untag_ptr(this_arg);
49421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49423         this_arg_conv.is_owned = false;
49424         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
49425         return ret_conv;
49426 }
49427
49428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
49429         LDKInvoice this_arg_conv;
49430         this_arg_conv.inner = untag_ptr(this_arg);
49431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49433         this_arg_conv = Invoice_clone(&this_arg_conv);
49434         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
49435         int64_t ret_ref = 0;
49436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49438         return ret_ref;
49439 }
49440
49441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
49442         LDKInvoice this_arg_conv;
49443         this_arg_conv.inner = untag_ptr(this_arg);
49444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49446         this_arg_conv.is_owned = false;
49447         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
49448         *ret_conv = Invoice_check_signature(&this_arg_conv);
49449         return tag_ptr(ret_conv, true);
49450 }
49451
49452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
49453         LDKSignedRawInvoice signed_invoice_conv;
49454         signed_invoice_conv.inner = untag_ptr(signed_invoice);
49455         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
49456         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
49457         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
49458         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
49459         *ret_conv = Invoice_from_signed(signed_invoice_conv);
49460         return tag_ptr(ret_conv, true);
49461 }
49462
49463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
49464         LDKInvoice this_arg_conv;
49465         this_arg_conv.inner = untag_ptr(this_arg);
49466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49468         this_arg_conv.is_owned = false;
49469         int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
49470         return ret_conv;
49471 }
49472
49473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
49474         LDKInvoice this_arg_conv;
49475         this_arg_conv.inner = untag_ptr(this_arg);
49476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49478         this_arg_conv.is_owned = false;
49479         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
49480         return ret_conv;
49481 }
49482
49483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
49484         LDKInvoice this_arg_conv;
49485         this_arg_conv.inner = untag_ptr(this_arg);
49486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49488         this_arg_conv.is_owned = false;
49489         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49490         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
49491         return ret_arr;
49492 }
49493
49494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49495         LDKInvoice this_arg_conv;
49496         this_arg_conv.inner = untag_ptr(this_arg);
49497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49499         this_arg_conv.is_owned = false;
49500         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49501         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
49502         return ret_arr;
49503 }
49504
49505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
49506         LDKInvoice this_arg_conv;
49507         this_arg_conv.inner = untag_ptr(this_arg);
49508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49510         this_arg_conv.is_owned = false;
49511         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49512         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
49513         return ret_arr;
49514 }
49515
49516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
49517         LDKInvoice this_arg_conv;
49518         this_arg_conv.inner = untag_ptr(this_arg);
49519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49521         this_arg_conv.is_owned = false;
49522         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
49523         int64_t ret_ref = 0;
49524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49526         return ret_ref;
49527 }
49528
49529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49530         LDKInvoice this_arg_conv;
49531         this_arg_conv.inner = untag_ptr(this_arg);
49532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49534         this_arg_conv.is_owned = false;
49535         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49536         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
49537         return ret_arr;
49538 }
49539
49540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
49541         LDKInvoice this_arg_conv;
49542         this_arg_conv.inner = untag_ptr(this_arg);
49543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49545         this_arg_conv.is_owned = false;
49546         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
49547         return ret_conv;
49548 }
49549
49550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
49551         LDKInvoice this_arg_conv;
49552         this_arg_conv.inner = untag_ptr(this_arg);
49553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49555         this_arg_conv.is_owned = false;
49556         jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
49557         return ret_conv;
49558 }
49559
49560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
49561         LDKInvoice this_arg_conv;
49562         this_arg_conv.inner = untag_ptr(this_arg);
49563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49565         this_arg_conv.is_owned = false;
49566         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
49567         return ret_conv;
49568 }
49569
49570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
49571         LDKInvoice this_arg_conv;
49572         this_arg_conv.inner = untag_ptr(this_arg);
49573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49575         this_arg_conv.is_owned = false;
49576         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
49577         return ret_conv;
49578 }
49579
49580 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
49581         LDKInvoice this_arg_conv;
49582         this_arg_conv.inner = untag_ptr(this_arg);
49583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49585         this_arg_conv.is_owned = false;
49586         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
49587         int64_tArray ret_arr = NULL;
49588         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49589         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49590         for (size_t o = 0; o < ret_var.datalen; o++) {
49591                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
49592                 int64_t ret_conv_14_ref = 0;
49593                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
49594                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
49595                 ret_arr_ptr[o] = ret_conv_14_ref;
49596         }
49597         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49598         FREE(ret_var.data);
49599         return ret_arr;
49600 }
49601
49602 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
49603         LDKInvoice this_arg_conv;
49604         this_arg_conv.inner = untag_ptr(this_arg);
49605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49607         this_arg_conv.is_owned = false;
49608         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
49609         int64_tArray ret_arr = NULL;
49610         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49611         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49612         for (size_t l = 0; l < ret_var.datalen; l++) {
49613                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
49614                 int64_t ret_conv_11_ref = 0;
49615                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
49616                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
49617                 ret_arr_ptr[l] = ret_conv_11_ref;
49618         }
49619         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49620         FREE(ret_var.data);
49621         return ret_arr;
49622 }
49623
49624 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
49625         LDKInvoice this_arg_conv;
49626         this_arg_conv.inner = untag_ptr(this_arg);
49627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49629         this_arg_conv.is_owned = false;
49630         jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
49631         return ret_conv;
49632 }
49633
49634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
49635         LDKInvoice this_arg_conv;
49636         this_arg_conv.inner = untag_ptr(this_arg);
49637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49639         this_arg_conv.is_owned = false;
49640         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
49641         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
49642         int64_t ret_ref = tag_ptr(ret_copy, true);
49643         return ret_ref;
49644 }
49645
49646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
49647         LDKStr description_conv = java_to_owned_str(env, description);
49648         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
49649         *ret_conv = Description_new(description_conv);
49650         return tag_ptr(ret_conv, true);
49651 }
49652
49653 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
49654         LDKDescription this_arg_conv;
49655         this_arg_conv.inner = untag_ptr(this_arg);
49656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49658         this_arg_conv = Description_clone(&this_arg_conv);
49659         LDKStr ret_str = Description_into_inner(this_arg_conv);
49660         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49661         Str_free(ret_str);
49662         return ret_conv;
49663 }
49664
49665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
49666         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
49667         int64_t ret_ref = 0;
49668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49670         return ret_ref;
49671 }
49672
49673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
49674         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
49675         int64_t ret_ref = 0;
49676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49678         return ret_ref;
49679 }
49680
49681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
49682         LDKExpiryTime this_arg_conv;
49683         this_arg_conv.inner = untag_ptr(this_arg);
49684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49686         this_arg_conv.is_owned = false;
49687         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
49688         return ret_conv;
49689 }
49690
49691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
49692         LDKExpiryTime this_arg_conv;
49693         this_arg_conv.inner = untag_ptr(this_arg);
49694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49696         this_arg_conv.is_owned = false;
49697         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
49698         return ret_conv;
49699 }
49700
49701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
49702         LDKRouteHint hops_conv;
49703         hops_conv.inner = untag_ptr(hops);
49704         hops_conv.is_owned = ptr_is_owned(hops);
49705         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
49706         hops_conv = RouteHint_clone(&hops_conv);
49707         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
49708         *ret_conv = PrivateRoute_new(hops_conv);
49709         return tag_ptr(ret_conv, true);
49710 }
49711
49712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
49713         LDKPrivateRoute this_arg_conv;
49714         this_arg_conv.inner = untag_ptr(this_arg);
49715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49717         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
49718         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
49719         int64_t ret_ref = 0;
49720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49722         return ret_ref;
49723 }
49724
49725 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49726         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
49727         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
49728         return ret_conv;
49729 }
49730
49731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
49732         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
49733         return ret_conv;
49734 }
49735
49736 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
49737         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
49738         return ret_conv;
49739 }
49740
49741 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
49742         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
49743         return ret_conv;
49744 }
49745
49746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
49747         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
49748         return ret_conv;
49749 }
49750
49751 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
49752         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
49753         return ret_conv;
49754 }
49755
49756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49757         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
49758         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
49759         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
49760         return ret_conv;
49761 }
49762
49763 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49764         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
49765         LDKStr ret_str = CreationError_to_str(o_conv);
49766         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49767         Str_free(ret_str);
49768         return ret_conv;
49769 }
49770
49771 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49772         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
49773         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
49774         return ret_conv;
49775 }
49776
49777 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
49778         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
49779         return ret_conv;
49780 }
49781
49782 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
49783         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
49784         return ret_conv;
49785 }
49786
49787 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
49788         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
49789         return ret_conv;
49790 }
49791
49792 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
49793         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
49794         return ret_conv;
49795 }
49796
49797 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
49798         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
49799         return ret_conv;
49800 }
49801
49802 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
49803         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
49804         return ret_conv;
49805 }
49806
49807 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
49808         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
49809         return ret_conv;
49810 }
49811
49812 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
49813         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
49814         return ret_conv;
49815 }
49816
49817 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
49818         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
49819         return ret_conv;
49820 }
49821
49822 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
49823         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
49824         return ret_conv;
49825 }
49826
49827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49828         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
49829         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
49830         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
49831         return ret_conv;
49832 }
49833
49834 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49835         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
49836         LDKStr ret_str = SemanticError_to_str(o_conv);
49837         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49838         Str_free(ret_str);
49839         return ret_conv;
49840 }
49841
49842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49843         if (!ptr_is_owned(this_ptr)) return;
49844         void* this_ptr_ptr = untag_ptr(this_ptr);
49845         CHECK_ACCESS(this_ptr_ptr);
49846         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
49847         FREE(untag_ptr(this_ptr));
49848         SignOrCreationError_free(this_ptr_conv);
49849 }
49850
49851 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
49852         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49853         *ret_copy = SignOrCreationError_clone(arg);
49854         int64_t ret_ref = tag_ptr(ret_copy, true);
49855         return ret_ref;
49856 }
49857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49858         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
49859         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
49860         return ret_conv;
49861 }
49862
49863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49864         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
49865         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49866         *ret_copy = SignOrCreationError_clone(orig_conv);
49867         int64_t ret_ref = tag_ptr(ret_copy, true);
49868         return ret_ref;
49869 }
49870
49871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
49872         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49873         *ret_copy = SignOrCreationError_sign_error();
49874         int64_t ret_ref = tag_ptr(ret_copy, true);
49875         return ret_ref;
49876 }
49877
49878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
49879         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
49880         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
49881         *ret_copy = SignOrCreationError_creation_error(a_conv);
49882         int64_t ret_ref = tag_ptr(ret_copy, true);
49883         return ret_ref;
49884 }
49885
49886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49887         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
49888         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
49889         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
49890         return ret_conv;
49891 }
49892
49893 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
49894         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
49895         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
49896         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
49897         Str_free(ret_str);
49898         return ret_conv;
49899 }
49900
49901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49902         LDKInvoicePayer this_obj_conv;
49903         this_obj_conv.inner = untag_ptr(this_obj);
49904         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49906         InvoicePayer_free(this_obj_conv);
49907 }
49908
49909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49910         if (!ptr_is_owned(this_ptr)) return;
49911         void* this_ptr_ptr = untag_ptr(this_ptr);
49912         CHECK_ACCESS(this_ptr_ptr);
49913         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
49914         FREE(untag_ptr(this_ptr));
49915         Payer_free(this_ptr_conv);
49916 }
49917
49918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49919         if (!ptr_is_owned(this_ptr)) return;
49920         void* this_ptr_ptr = untag_ptr(this_ptr);
49921         CHECK_ACCESS(this_ptr_ptr);
49922         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
49923         FREE(untag_ptr(this_ptr));
49924         Router_free(this_ptr_conv);
49925 }
49926
49927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49928         if (!ptr_is_owned(this_ptr)) return;
49929         void* this_ptr_ptr = untag_ptr(this_ptr);
49930         CHECK_ACCESS(this_ptr_ptr);
49931         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
49932         FREE(untag_ptr(this_ptr));
49933         Retry_free(this_ptr_conv);
49934 }
49935
49936 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
49937         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49938         *ret_copy = Retry_clone(arg);
49939         int64_t ret_ref = tag_ptr(ret_copy, true);
49940         return ret_ref;
49941 }
49942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49943         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
49944         int64_t ret_conv = Retry_clone_ptr(arg_conv);
49945         return ret_conv;
49946 }
49947
49948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49949         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
49950         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49951         *ret_copy = Retry_clone(orig_conv);
49952         int64_t ret_ref = tag_ptr(ret_copy, true);
49953         return ret_ref;
49954 }
49955
49956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
49957         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49958         *ret_copy = Retry_attempts(a);
49959         int64_t ret_ref = tag_ptr(ret_copy, true);
49960         return ret_ref;
49961 }
49962
49963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
49964         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49965         *ret_copy = Retry_timeout(a);
49966         int64_t ret_ref = tag_ptr(ret_copy, true);
49967         return ret_ref;
49968 }
49969
49970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49971         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
49972         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
49973         jboolean ret_conv = Retry_eq(a_conv, b_conv);
49974         return ret_conv;
49975 }
49976
49977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
49978         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
49979         int64_t ret_conv = Retry_hash(o_conv);
49980         return ret_conv;
49981 }
49982
49983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49984         if (!ptr_is_owned(this_ptr)) return;
49985         void* this_ptr_ptr = untag_ptr(this_ptr);
49986         CHECK_ACCESS(this_ptr_ptr);
49987         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
49988         FREE(untag_ptr(this_ptr));
49989         PaymentError_free(this_ptr_conv);
49990 }
49991
49992 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
49993         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
49994         *ret_copy = PaymentError_clone(arg);
49995         int64_t ret_ref = tag_ptr(ret_copy, true);
49996         return ret_ref;
49997 }
49998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49999         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
50000         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
50001         return ret_conv;
50002 }
50003
50004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50005         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
50006         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50007         *ret_copy = PaymentError_clone(orig_conv);
50008         int64_t ret_ref = tag_ptr(ret_copy, true);
50009         return ret_ref;
50010 }
50011
50012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
50013         LDKStr a_conv = java_to_owned_str(env, a);
50014         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50015         *ret_copy = PaymentError_invoice(a_conv);
50016         int64_t ret_ref = tag_ptr(ret_copy, true);
50017         return ret_ref;
50018 }
50019
50020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
50021         LDKLightningError a_conv;
50022         a_conv.inner = untag_ptr(a);
50023         a_conv.is_owned = ptr_is_owned(a);
50024         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50025         a_conv = LightningError_clone(&a_conv);
50026         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50027         *ret_copy = PaymentError_routing(a_conv);
50028         int64_t ret_ref = tag_ptr(ret_copy, true);
50029         return ret_ref;
50030 }
50031
50032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
50033         void* a_ptr = untag_ptr(a);
50034         CHECK_ACCESS(a_ptr);
50035         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
50036         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
50037         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
50038         *ret_copy = PaymentError_sending(a_conv);
50039         int64_t ret_ref = tag_ptr(ret_copy, true);
50040         return ret_ref;
50041 }
50042
50043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t logger, int64_t event_handler, int64_t retry) {
50044         void* payer_ptr = untag_ptr(payer);
50045         CHECK_ACCESS(payer_ptr);
50046         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
50047         if (payer_conv.free == LDKPayer_JCalls_free) {
50048                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50049                 LDKPayer_JCalls_cloned(&payer_conv);
50050         }
50051         void* router_ptr = untag_ptr(router);
50052         CHECK_ACCESS(router_ptr);
50053         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
50054         if (router_conv.free == LDKRouter_JCalls_free) {
50055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50056                 LDKRouter_JCalls_cloned(&router_conv);
50057         }
50058         void* logger_ptr = untag_ptr(logger);
50059         CHECK_ACCESS(logger_ptr);
50060         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50061         if (logger_conv.free == LDKLogger_JCalls_free) {
50062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50063                 LDKLogger_JCalls_cloned(&logger_conv);
50064         }
50065         void* event_handler_ptr = untag_ptr(event_handler);
50066         CHECK_ACCESS(event_handler_ptr);
50067         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
50068         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
50069                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50070                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
50071         }
50072         void* retry_ptr = untag_ptr(retry);
50073         CHECK_ACCESS(retry_ptr);
50074         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
50075         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
50076         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv);
50077         int64_t ret_ref = 0;
50078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50080         return ret_ref;
50081 }
50082
50083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
50084         LDKInvoicePayer this_arg_conv;
50085         this_arg_conv.inner = untag_ptr(this_arg);
50086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50088         this_arg_conv.is_owned = false;
50089         LDKInvoice invoice_conv;
50090         invoice_conv.inner = untag_ptr(invoice);
50091         invoice_conv.is_owned = ptr_is_owned(invoice);
50092         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50093         invoice_conv.is_owned = false;
50094         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
50095         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
50096         return tag_ptr(ret_conv, true);
50097 }
50098
50099 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) {
50100         LDKInvoicePayer this_arg_conv;
50101         this_arg_conv.inner = untag_ptr(this_arg);
50102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50104         this_arg_conv.is_owned = false;
50105         LDKInvoice invoice_conv;
50106         invoice_conv.inner = untag_ptr(invoice);
50107         invoice_conv.is_owned = ptr_is_owned(invoice);
50108         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
50109         invoice_conv.is_owned = false;
50110         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
50111         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
50112         return tag_ptr(ret_conv, true);
50113 }
50114
50115 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) {
50116         LDKInvoicePayer this_arg_conv;
50117         this_arg_conv.inner = untag_ptr(this_arg);
50118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50120         this_arg_conv.is_owned = false;
50121         LDKPublicKey pubkey_ref;
50122         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
50123         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
50124         LDKThirtyTwoBytes payment_preimage_ref;
50125         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
50126         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
50127         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
50128         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
50129         return tag_ptr(ret_conv, true);
50130 }
50131
50132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
50133         LDKInvoicePayer this_arg_conv;
50134         this_arg_conv.inner = untag_ptr(this_arg);
50135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50137         this_arg_conv.is_owned = false;
50138         unsigned char payment_hash_arr[32];
50139         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
50140         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
50141         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
50142         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
50143 }
50144
50145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
50146         LDKInvoicePayer this_arg_conv;
50147         this_arg_conv.inner = untag_ptr(this_arg);
50148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50150         this_arg_conv.is_owned = false;
50151         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
50152         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
50153         return tag_ptr(ret_ret, true);
50154 }
50155
50156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50157         LDKInFlightHtlcs this_obj_conv;
50158         this_obj_conv.inner = untag_ptr(this_obj);
50159         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50161         InFlightHtlcs_free(this_obj_conv);
50162 }
50163
50164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1used_1liquidity_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
50165         LDKInFlightHtlcs this_arg_conv;
50166         this_arg_conv.inner = untag_ptr(this_arg);
50167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50169         this_arg_conv.is_owned = false;
50170         LDKNodeId source_conv;
50171         source_conv.inner = untag_ptr(source);
50172         source_conv.is_owned = ptr_is_owned(source);
50173         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
50174         source_conv.is_owned = false;
50175         LDKNodeId target_conv;
50176         target_conv.inner = untag_ptr(target);
50177         target_conv.is_owned = ptr_is_owned(target);
50178         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
50179         target_conv.is_owned = false;
50180         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50181         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
50182         int64_t ret_ref = tag_ptr(ret_copy, true);
50183         return ret_ref;
50184 }
50185
50186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
50187         LDKInFlightHtlcs obj_conv;
50188         obj_conv.inner = untag_ptr(obj);
50189         obj_conv.is_owned = ptr_is_owned(obj);
50190         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50191         obj_conv.is_owned = false;
50192         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
50193         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50194         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50195         CVec_u8Z_free(ret_var);
50196         return ret_arr;
50197 }
50198
50199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50200         LDKu8slice ser_ref;
50201         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50202         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50203         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
50204         *ret_conv = InFlightHtlcs_read(ser_ref);
50205         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50206         return tag_ptr(ret_conv, true);
50207 }
50208
50209 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) {
50210         void* amt_msat_ptr = untag_ptr(amt_msat);
50211         CHECK_ACCESS(amt_msat_ptr);
50212         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50213         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50214         LDKThirtyTwoBytes payment_hash_ref;
50215         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
50216         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
50217         LDKStr description_conv = java_to_owned_str(env, description);
50218         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
50219         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
50220         if (phantom_route_hints_constr.datalen > 0)
50221                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
50222         else
50223                 phantom_route_hints_constr.data = NULL;
50224         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
50225         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
50226                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
50227                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
50228                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
50229                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
50230                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
50231                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
50232                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
50233         }
50234         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
50235         void* keys_manager_ptr = untag_ptr(keys_manager);
50236         CHECK_ACCESS(keys_manager_ptr);
50237         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
50238         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
50239                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50240                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
50241         }
50242         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
50243         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50244         *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);
50245         return tag_ptr(ret_conv, true);
50246 }
50247
50248 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) {
50249         void* amt_msat_ptr = untag_ptr(amt_msat);
50250         CHECK_ACCESS(amt_msat_ptr);
50251         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50252         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50253         LDKThirtyTwoBytes payment_hash_ref;
50254         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
50255         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
50256         LDKSha256 description_hash_conv;
50257         description_hash_conv.inner = untag_ptr(description_hash);
50258         description_hash_conv.is_owned = ptr_is_owned(description_hash);
50259         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
50260         description_hash_conv = Sha256_clone(&description_hash_conv);
50261         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
50262         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
50263         if (phantom_route_hints_constr.datalen > 0)
50264                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
50265         else
50266                 phantom_route_hints_constr.data = NULL;
50267         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
50268         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
50269                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
50270                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
50271                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
50272                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
50273                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
50274                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
50275                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
50276         }
50277         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
50278         void* keys_manager_ptr = untag_ptr(keys_manager);
50279         CHECK_ACCESS(keys_manager_ptr);
50280         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
50281         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
50282                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50283                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
50284         }
50285         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
50286         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50287         *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);
50288         return tag_ptr(ret_conv, true);
50289 }
50290
50291 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) {
50292         LDKChannelManager channelmanager_conv;
50293         channelmanager_conv.inner = untag_ptr(channelmanager);
50294         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50295         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50296         channelmanager_conv.is_owned = false;
50297         void* keys_manager_ptr = untag_ptr(keys_manager);
50298         CHECK_ACCESS(keys_manager_ptr);
50299         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
50300         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
50301                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50302                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
50303         }
50304         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
50305         void* amt_msat_ptr = untag_ptr(amt_msat);
50306         CHECK_ACCESS(amt_msat_ptr);
50307         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50308         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50309         LDKStr description_conv = java_to_owned_str(env, description);
50310         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50311         *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
50312         return tag_ptr(ret_conv, true);
50313 }
50314
50315 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) {
50316         LDKChannelManager channelmanager_conv;
50317         channelmanager_conv.inner = untag_ptr(channelmanager);
50318         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50319         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50320         channelmanager_conv.is_owned = false;
50321         void* keys_manager_ptr = untag_ptr(keys_manager);
50322         CHECK_ACCESS(keys_manager_ptr);
50323         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
50324         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
50325                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50326                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
50327         }
50328         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
50329         void* amt_msat_ptr = untag_ptr(amt_msat);
50330         CHECK_ACCESS(amt_msat_ptr);
50331         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50332         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50333         LDKSha256 description_hash_conv;
50334         description_hash_conv.inner = untag_ptr(description_hash);
50335         description_hash_conv.is_owned = ptr_is_owned(description_hash);
50336         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
50337         description_hash_conv = Sha256_clone(&description_hash_conv);
50338         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50339         *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);
50340         return tag_ptr(ret_conv, true);
50341 }
50342
50343 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) {
50344         LDKChannelManager channelmanager_conv;
50345         channelmanager_conv.inner = untag_ptr(channelmanager);
50346         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50347         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50348         channelmanager_conv.is_owned = false;
50349         void* keys_manager_ptr = untag_ptr(keys_manager);
50350         CHECK_ACCESS(keys_manager_ptr);
50351         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
50352         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
50353                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50354                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
50355         }
50356         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
50357         void* amt_msat_ptr = untag_ptr(amt_msat);
50358         CHECK_ACCESS(amt_msat_ptr);
50359         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50360         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50361         LDKSha256 description_hash_conv;
50362         description_hash_conv.inner = untag_ptr(description_hash);
50363         description_hash_conv.is_owned = ptr_is_owned(description_hash);
50364         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
50365         description_hash_conv = Sha256_clone(&description_hash_conv);
50366         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50367         *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);
50368         return tag_ptr(ret_conv, true);
50369 }
50370
50371 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) {
50372         LDKChannelManager channelmanager_conv;
50373         channelmanager_conv.inner = untag_ptr(channelmanager);
50374         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
50375         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
50376         channelmanager_conv.is_owned = false;
50377         void* keys_manager_ptr = untag_ptr(keys_manager);
50378         CHECK_ACCESS(keys_manager_ptr);
50379         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
50380         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
50381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50382                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
50383         }
50384         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
50385         void* amt_msat_ptr = untag_ptr(amt_msat);
50386         CHECK_ACCESS(amt_msat_ptr);
50387         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
50388         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
50389         LDKStr description_conv = java_to_owned_str(env, description);
50390         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
50391         *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);
50392         return tag_ptr(ret_conv, true);
50393 }
50394
50395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50396         LDKDefaultRouter this_obj_conv;
50397         this_obj_conv.inner = untag_ptr(this_obj);
50398         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50400         DefaultRouter_free(this_obj_conv);
50401 }
50402
50403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes, int64_t scorer) {
50404         LDKNetworkGraph network_graph_conv;
50405         network_graph_conv.inner = untag_ptr(network_graph);
50406         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50407         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50408         network_graph_conv.is_owned = false;
50409         void* logger_ptr = untag_ptr(logger);
50410         CHECK_ACCESS(logger_ptr);
50411         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
50412         if (logger_conv.free == LDKLogger_JCalls_free) {
50413                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50414                 LDKLogger_JCalls_cloned(&logger_conv);
50415         }
50416         LDKThirtyTwoBytes random_seed_bytes_ref;
50417         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
50418         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
50419         void* scorer_ptr = untag_ptr(scorer);
50420         CHECK_ACCESS(scorer_ptr);
50421         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
50422         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
50423                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
50424                 LDKLockableScore_JCalls_cloned(&scorer_conv);
50425         }
50426         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
50427         int64_t ret_ref = 0;
50428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50430         return ret_ref;
50431 }
50432
50433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
50434         LDKDefaultRouter this_arg_conv;
50435         this_arg_conv.inner = untag_ptr(this_arg);
50436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50438         this_arg_conv.is_owned = false;
50439         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
50440         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
50441         return tag_ptr(ret_ret, true);
50442 }
50443
50444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
50445         LDKChannelManager this_arg_conv;
50446         this_arg_conv.inner = untag_ptr(this_arg);
50447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50449         this_arg_conv.is_owned = false;
50450         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
50451         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
50452         return tag_ptr(ret_ret, true);
50453 }
50454
50455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
50456         LDKStr s_conv = java_to_owned_str(env, s);
50457         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
50458         *ret_conv = SiPrefix_from_str(s_conv);
50459         return tag_ptr(ret_conv, true);
50460 }
50461
50462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
50463         LDKStr s_conv = java_to_owned_str(env, s);
50464         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
50465         *ret_conv = Invoice_from_str(s_conv);
50466         return tag_ptr(ret_conv, true);
50467 }
50468
50469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
50470         LDKStr s_conv = java_to_owned_str(env, s);
50471         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
50472         *ret_conv = SignedRawInvoice_from_str(s_conv);
50473         return tag_ptr(ret_conv, true);
50474 }
50475
50476 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
50477         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
50478         LDKStr ret_str = ParseError_to_str(o_conv);
50479         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50480         Str_free(ret_str);
50481         return ret_conv;
50482 }
50483
50484 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
50485         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
50486         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
50487         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50488         Str_free(ret_str);
50489         return ret_conv;
50490 }
50491
50492 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
50493         LDKInvoice o_conv;
50494         o_conv.inner = untag_ptr(o);
50495         o_conv.is_owned = ptr_is_owned(o);
50496         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50497         o_conv.is_owned = false;
50498         LDKStr ret_str = Invoice_to_str(&o_conv);
50499         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50500         Str_free(ret_str);
50501         return ret_conv;
50502 }
50503
50504 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
50505         LDKSignedRawInvoice o_conv;
50506         o_conv.inner = untag_ptr(o);
50507         o_conv.is_owned = ptr_is_owned(o);
50508         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50509         o_conv.is_owned = false;
50510         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
50511         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50512         Str_free(ret_str);
50513         return ret_conv;
50514 }
50515
50516 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
50517         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
50518         LDKStr ret_str = Currency_to_str(o_conv);
50519         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50520         Str_free(ret_str);
50521         return ret_conv;
50522 }
50523
50524 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
50525         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
50526         LDKStr ret_str = SiPrefix_to_str(o_conv);
50527         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50528         Str_free(ret_str);
50529         return ret_conv;
50530 }
50531
50532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50533         LDKRapidGossipSync this_obj_conv;
50534         this_obj_conv.inner = untag_ptr(this_obj);
50535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50537         RapidGossipSync_free(this_obj_conv);
50538 }
50539
50540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
50541         LDKNetworkGraph network_graph_conv;
50542         network_graph_conv.inner = untag_ptr(network_graph);
50543         network_graph_conv.is_owned = ptr_is_owned(network_graph);
50544         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
50545         network_graph_conv.is_owned = false;
50546         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
50547         int64_t ret_ref = 0;
50548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50550         return ret_ref;
50551 }
50552
50553 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) {
50554         LDKRapidGossipSync this_arg_conv;
50555         this_arg_conv.inner = untag_ptr(this_arg);
50556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50558         this_arg_conv.is_owned = false;
50559         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
50560         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50561         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
50562         return tag_ptr(ret_conv, true);
50563 }
50564
50565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
50566         LDKRapidGossipSync this_arg_conv;
50567         this_arg_conv.inner = untag_ptr(this_arg);
50568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50570         this_arg_conv.is_owned = false;
50571         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
50572         return ret_conv;
50573 }
50574
50575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50576         if (!ptr_is_owned(this_ptr)) return;
50577         void* this_ptr_ptr = untag_ptr(this_ptr);
50578         CHECK_ACCESS(this_ptr_ptr);
50579         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
50580         FREE(untag_ptr(this_ptr));
50581         GraphSyncError_free(this_ptr_conv);
50582 }
50583
50584 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
50585         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50586         *ret_copy = GraphSyncError_clone(arg);
50587         int64_t ret_ref = tag_ptr(ret_copy, true);
50588         return ret_ref;
50589 }
50590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50591         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
50592         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
50593         return ret_conv;
50594 }
50595
50596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50597         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
50598         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50599         *ret_copy = GraphSyncError_clone(orig_conv);
50600         int64_t ret_ref = tag_ptr(ret_copy, true);
50601         return ret_ref;
50602 }
50603
50604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
50605         LDKDecodeError a_conv;
50606         a_conv.inner = untag_ptr(a);
50607         a_conv.is_owned = ptr_is_owned(a);
50608         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50609         a_conv = DecodeError_clone(&a_conv);
50610         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50611         *ret_copy = GraphSyncError_decode_error(a_conv);
50612         int64_t ret_ref = tag_ptr(ret_copy, true);
50613         return ret_ref;
50614 }
50615
50616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
50617         LDKLightningError a_conv;
50618         a_conv.inner = untag_ptr(a);
50619         a_conv.is_owned = ptr_is_owned(a);
50620         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50621         a_conv = LightningError_clone(&a_conv);
50622         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
50623         *ret_copy = GraphSyncError_lightning_error(a_conv);
50624         int64_t ret_ref = tag_ptr(ret_copy, true);
50625         return ret_ref;
50626 }
50627
50628 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) {
50629         LDKRapidGossipSync this_arg_conv;
50630         this_arg_conv.inner = untag_ptr(this_arg);
50631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50633         this_arg_conv.is_owned = false;
50634         LDKu8slice update_data_ref;
50635         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
50636         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
50637         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
50638         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
50639         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
50640         return tag_ptr(ret_conv, true);
50641 }
50642