[Java] Update auto-generated Java bindings
[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 static jclass LDKBech32Error_MissingSeparator_class = NULL;
943 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
944 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
945 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
946 static jclass LDKBech32Error_InvalidLength_class = NULL;
947 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
948 static jclass LDKBech32Error_InvalidChar_class = NULL;
949 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
950 static jclass LDKBech32Error_InvalidData_class = NULL;
951 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
952 static jclass LDKBech32Error_InvalidPadding_class = NULL;
953 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
954 static jclass LDKBech32Error_MixedCase_class = NULL;
955 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
957         LDKBech32Error_MissingSeparator_class =
958                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
959         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
960         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
961         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
962         LDKBech32Error_InvalidChecksum_class =
963                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
964         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
965         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
966         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
967         LDKBech32Error_InvalidLength_class =
968                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
969         CHECK(LDKBech32Error_InvalidLength_class != NULL);
970         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
971         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
972         LDKBech32Error_InvalidChar_class =
973                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
974         CHECK(LDKBech32Error_InvalidChar_class != NULL);
975         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
976         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
977         LDKBech32Error_InvalidData_class =
978                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
979         CHECK(LDKBech32Error_InvalidData_class != NULL);
980         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
981         CHECK(LDKBech32Error_InvalidData_meth != NULL);
982         LDKBech32Error_InvalidPadding_class =
983                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
984         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
985         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
986         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
987         LDKBech32Error_MixedCase_class =
988                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
989         CHECK(LDKBech32Error_MixedCase_class != NULL);
990         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
991         CHECK(LDKBech32Error_MixedCase_meth != NULL);
992 }
993 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
994         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
995         switch(obj->tag) {
996                 case LDKBech32Error_MissingSeparator: {
997                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
998                 }
999                 case LDKBech32Error_InvalidChecksum: {
1000                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1001                 }
1002                 case LDKBech32Error_InvalidLength: {
1003                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1004                 }
1005                 case LDKBech32Error_InvalidChar: {
1006                         int32_t invalid_char_conv = obj->invalid_char;
1007                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1008                 }
1009                 case LDKBech32Error_InvalidData: {
1010                         int8_t invalid_data_conv = obj->invalid_data;
1011                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1012                 }
1013                 case LDKBech32Error_InvalidPadding: {
1014                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1015                 }
1016                 case LDKBech32Error_MixedCase: {
1017                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1018                 }
1019                 default: abort();
1020         }
1021 }
1022 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1023         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1024         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1025         return ret;
1026 }
1027 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) {
1028         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1029         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1030         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1031         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1032         CVec_u8Z_free(ret_var);
1033         return ret_arr;
1034 }
1035
1036 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) {
1037         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1038         int64_t ret_conv = TxOut_get_value(thing_conv);
1039         return ret_conv;
1040 }
1041
1042 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1043 CHECK(owner->result_ok);
1044         return *owner->contents.result;
1045 }
1046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1047         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1048         CResult_NoneNoneZ_get_ok(owner_conv);
1049 }
1050
1051 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1052 CHECK(!owner->result_ok);
1053         return *owner->contents.err;
1054 }
1055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1056         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1057         CResult_NoneNoneZ_get_err(owner_conv);
1058 }
1059
1060 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1061 CHECK(owner->result_ok);
1062         return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
1063 }
1064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1065         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1066         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1067         int64_t ret_ref = 0;
1068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1070         return ret_ref;
1071 }
1072
1073 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1074 CHECK(!owner->result_ok);
1075         return DecodeError_clone(&*owner->contents.err);
1076 }
1077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1078         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1079         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1080         int64_t ret_ref = 0;
1081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1083         return ret_ref;
1084 }
1085
1086 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1087 CHECK(owner->result_ok);
1088         return *owner->contents.result;
1089 }
1090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1091         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1092         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1093         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1094         return ret_arr;
1095 }
1096
1097 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1098 CHECK(!owner->result_ok);
1099         return *owner->contents.err;
1100 }
1101 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1102         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1103         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1104         return ret_conv;
1105 }
1106
1107 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1108 CHECK(owner->result_ok);
1109         return *owner->contents.result;
1110 }
1111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1112         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1113         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1114         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1115         return ret_arr;
1116 }
1117
1118 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1119 CHECK(!owner->result_ok);
1120         return *owner->contents.err;
1121 }
1122 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1123         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1124         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1125         return ret_conv;
1126 }
1127
1128 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1129 CHECK(owner->result_ok);
1130         return TxCreationKeys_clone(&*owner->contents.result);
1131 }
1132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1133         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1134         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1135         int64_t ret_ref = 0;
1136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1138         return ret_ref;
1139 }
1140
1141 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1142 CHECK(!owner->result_ok);
1143         return DecodeError_clone(&*owner->contents.err);
1144 }
1145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1146         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1147         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1148         int64_t ret_ref = 0;
1149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1151         return ret_ref;
1152 }
1153
1154 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1155 CHECK(owner->result_ok);
1156         return ChannelPublicKeys_clone(&*owner->contents.result);
1157 }
1158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1159         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1160         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1161         int64_t ret_ref = 0;
1162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1164         return ret_ref;
1165 }
1166
1167 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1168 CHECK(!owner->result_ok);
1169         return DecodeError_clone(&*owner->contents.err);
1170 }
1171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1172         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1173         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1174         int64_t ret_ref = 0;
1175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1177         return ret_ref;
1178 }
1179
1180 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1181 CHECK(owner->result_ok);
1182         return TxCreationKeys_clone(&*owner->contents.result);
1183 }
1184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1185         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1186         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1187         int64_t ret_ref = 0;
1188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1190         return ret_ref;
1191 }
1192
1193 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1194 CHECK(!owner->result_ok);
1195         return *owner->contents.err;
1196 }
1197 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1198         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1199         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1200         return ret_conv;
1201 }
1202
1203 static jclass LDKCOption_u32Z_Some_class = NULL;
1204 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1205 static jclass LDKCOption_u32Z_None_class = NULL;
1206 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1208         LDKCOption_u32Z_Some_class =
1209                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1210         CHECK(LDKCOption_u32Z_Some_class != NULL);
1211         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1212         CHECK(LDKCOption_u32Z_Some_meth != NULL);
1213         LDKCOption_u32Z_None_class =
1214                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1215         CHECK(LDKCOption_u32Z_None_class != NULL);
1216         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1217         CHECK(LDKCOption_u32Z_None_meth != NULL);
1218 }
1219 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1220         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1221         switch(obj->tag) {
1222                 case LDKCOption_u32Z_Some: {
1223                         int32_t some_conv = obj->some;
1224                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1225                 }
1226                 case LDKCOption_u32Z_None: {
1227                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1228                 }
1229                 default: abort();
1230         }
1231 }
1232 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1233 CHECK(owner->result_ok);
1234         return HTLCOutputInCommitment_clone(&*owner->contents.result);
1235 }
1236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1237         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1238         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1239         int64_t ret_ref = 0;
1240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1242         return ret_ref;
1243 }
1244
1245 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1246 CHECK(!owner->result_ok);
1247         return DecodeError_clone(&*owner->contents.err);
1248 }
1249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1250         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1251         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_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 LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1259 CHECK(owner->result_ok);
1260         return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1261 }
1262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1263         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1264         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1265         int64_t ret_ref = 0;
1266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1268         return ret_ref;
1269 }
1270
1271 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1272 CHECK(!owner->result_ok);
1273         return DecodeError_clone(&*owner->contents.err);
1274 }
1275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1276         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1277         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1278         int64_t ret_ref = 0;
1279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1281         return ret_ref;
1282 }
1283
1284 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1285 CHECK(owner->result_ok);
1286         return ChannelTransactionParameters_clone(&*owner->contents.result);
1287 }
1288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1289         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1290         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1291         int64_t ret_ref = 0;
1292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1294         return ret_ref;
1295 }
1296
1297 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1298 CHECK(!owner->result_ok);
1299         return DecodeError_clone(&*owner->contents.err);
1300 }
1301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1302         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1303         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1304         int64_t ret_ref = 0;
1305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1307         return ret_ref;
1308 }
1309
1310 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1311 CHECK(owner->result_ok);
1312         return HolderCommitmentTransaction_clone(&*owner->contents.result);
1313 }
1314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1315         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1316         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1317         int64_t ret_ref = 0;
1318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1320         return ret_ref;
1321 }
1322
1323 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1324 CHECK(!owner->result_ok);
1325         return DecodeError_clone(&*owner->contents.err);
1326 }
1327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1328         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1329         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1330         int64_t ret_ref = 0;
1331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1333         return ret_ref;
1334 }
1335
1336 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1337 CHECK(owner->result_ok);
1338         return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1339 }
1340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1341         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1342         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1343         int64_t ret_ref = 0;
1344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1346         return ret_ref;
1347 }
1348
1349 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1350 CHECK(!owner->result_ok);
1351         return DecodeError_clone(&*owner->contents.err);
1352 }
1353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1354         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1355         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1356         int64_t ret_ref = 0;
1357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1359         return ret_ref;
1360 }
1361
1362 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1363 CHECK(owner->result_ok);
1364         return &*owner->contents.result;
1365 }
1366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1367         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1368         LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1369         int64_t ret_ref = 0;
1370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1371         ret_ref = tag_ptr(ret_var.inner, false);
1372         return ret_ref;
1373 }
1374
1375 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1376 CHECK(!owner->result_ok);
1377         return *owner->contents.err;
1378 }
1379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1380         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1381         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1382 }
1383
1384 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1385 CHECK(owner->result_ok);
1386         return CommitmentTransaction_clone(&*owner->contents.result);
1387 }
1388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1389         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1390         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1391         int64_t ret_ref = 0;
1392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1394         return ret_ref;
1395 }
1396
1397 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1398 CHECK(!owner->result_ok);
1399         return DecodeError_clone(&*owner->contents.err);
1400 }
1401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1402         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1403         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1404         int64_t ret_ref = 0;
1405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1407         return ret_ref;
1408 }
1409
1410 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1411 CHECK(owner->result_ok);
1412         return &*owner->contents.result;
1413 }
1414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1415         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1416         LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(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, false);
1420         return ret_ref;
1421 }
1422
1423 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1424 CHECK(!owner->result_ok);
1425         return *owner->contents.err;
1426 }
1427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1428         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1429         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1430 }
1431
1432 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1433 CHECK(owner->result_ok);
1434         return *owner->contents.result;
1435 }
1436 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1437         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1438         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1439         jobjectArray ret_arr = NULL;
1440         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1441         ;
1442         for (size_t i = 0; i < ret_var.datalen; i++) {
1443                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1444                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1445                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1446         }
1447         
1448         return ret_arr;
1449 }
1450
1451 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1452 CHECK(!owner->result_ok);
1453         return *owner->contents.err;
1454 }
1455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1456         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1457         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1458 }
1459
1460 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1461 CHECK(owner->result_ok);
1462         return ShutdownScript_clone(&*owner->contents.result);
1463 }
1464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1465         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1466         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1467         int64_t ret_ref = 0;
1468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1470         return ret_ref;
1471 }
1472
1473 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1474 CHECK(!owner->result_ok);
1475         return DecodeError_clone(&*owner->contents.err);
1476 }
1477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1478         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1479         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1480         int64_t ret_ref = 0;
1481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1483         return ret_ref;
1484 }
1485
1486 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1487 CHECK(owner->result_ok);
1488         return ShutdownScript_clone(&*owner->contents.result);
1489 }
1490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1491         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1492         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1493         int64_t ret_ref = 0;
1494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1496         return ret_ref;
1497 }
1498
1499 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1500 CHECK(!owner->result_ok);
1501         return InvalidShutdownScript_clone(&*owner->contents.err);
1502 }
1503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1504         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1505         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1506         int64_t ret_ref = 0;
1507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1509         return ret_ref;
1510 }
1511
1512 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1513 CHECK(owner->result_ok);
1514         return *owner->contents.result;
1515 }
1516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1517         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
1518         CResult_NoneErrorZ_get_ok(owner_conv);
1519 }
1520
1521 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1522 CHECK(!owner->result_ok);
1523         return *owner->contents.err;
1524 }
1525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1526         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
1527         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1528         return ret_conv;
1529 }
1530
1531 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1532 CHECK(owner->result_ok);
1533         return RouteHop_clone(&*owner->contents.result);
1534 }
1535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1536         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1537         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_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 struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1545 CHECK(!owner->result_ok);
1546         return DecodeError_clone(&*owner->contents.err);
1547 }
1548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1549         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1550         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1551         int64_t ret_ref = 0;
1552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1554         return ret_ref;
1555 }
1556
1557 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1558         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1559         for (size_t i = 0; i < ret.datalen; i++) {
1560                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1561         }
1562         return ret;
1563 }
1564 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1565         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1566         for (size_t i = 0; i < ret.datalen; i++) {
1567                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1568         }
1569         return ret;
1570 }
1571 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1572 CHECK(owner->result_ok);
1573         return Route_clone(&*owner->contents.result);
1574 }
1575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1576         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1577         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1578         int64_t ret_ref = 0;
1579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1581         return ret_ref;
1582 }
1583
1584 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1585 CHECK(!owner->result_ok);
1586         return DecodeError_clone(&*owner->contents.err);
1587 }
1588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1589         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1590         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1591         int64_t ret_ref = 0;
1592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1594         return ret_ref;
1595 }
1596
1597 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1598 CHECK(owner->result_ok);
1599         return RouteParameters_clone(&*owner->contents.result);
1600 }
1601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1602         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1603         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1604         int64_t ret_ref = 0;
1605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1607         return ret_ref;
1608 }
1609
1610 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1611 CHECK(!owner->result_ok);
1612         return DecodeError_clone(&*owner->contents.err);
1613 }
1614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1615         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1616         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(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 LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1624         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1625         for (size_t i = 0; i < ret.datalen; i++) {
1626                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1627         }
1628         return ret;
1629 }
1630 static jclass LDKCOption_u64Z_Some_class = NULL;
1631 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1632 static jclass LDKCOption_u64Z_None_class = NULL;
1633 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1635         LDKCOption_u64Z_Some_class =
1636                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1637         CHECK(LDKCOption_u64Z_Some_class != NULL);
1638         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1639         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1640         LDKCOption_u64Z_None_class =
1641                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1642         CHECK(LDKCOption_u64Z_None_class != NULL);
1643         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1644         CHECK(LDKCOption_u64Z_None_meth != NULL);
1645 }
1646 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1647         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1648         switch(obj->tag) {
1649                 case LDKCOption_u64Z_Some: {
1650                         int64_t some_conv = obj->some;
1651                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1652                 }
1653                 case LDKCOption_u64Z_None: {
1654                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1655                 }
1656                 default: abort();
1657         }
1658 }
1659 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1660         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1661         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1662         return ret;
1663 }
1664 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1665 CHECK(owner->result_ok);
1666         return PaymentParameters_clone(&*owner->contents.result);
1667 }
1668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1669         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1670         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1671         int64_t ret_ref = 0;
1672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1674         return ret_ref;
1675 }
1676
1677 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1678 CHECK(!owner->result_ok);
1679         return DecodeError_clone(&*owner->contents.err);
1680 }
1681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1682         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1683         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1684         int64_t ret_ref = 0;
1685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1687         return ret_ref;
1688 }
1689
1690 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1691         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1692         for (size_t i = 0; i < ret.datalen; i++) {
1693                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1694         }
1695         return ret;
1696 }
1697 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1698 CHECK(owner->result_ok);
1699         return RouteHint_clone(&*owner->contents.result);
1700 }
1701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1702         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1703         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1704         int64_t ret_ref = 0;
1705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1707         return ret_ref;
1708 }
1709
1710 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1711 CHECK(!owner->result_ok);
1712         return DecodeError_clone(&*owner->contents.err);
1713 }
1714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1715         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1716         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1717         int64_t ret_ref = 0;
1718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1720         return ret_ref;
1721 }
1722
1723 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1724 CHECK(owner->result_ok);
1725         return RouteHintHop_clone(&*owner->contents.result);
1726 }
1727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1728         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1729         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1730         int64_t ret_ref = 0;
1731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1733         return ret_ref;
1734 }
1735
1736 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1737 CHECK(!owner->result_ok);
1738         return DecodeError_clone(&*owner->contents.err);
1739 }
1740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1741         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1742         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1743         int64_t ret_ref = 0;
1744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1746         return ret_ref;
1747 }
1748
1749 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1750         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1751         for (size_t i = 0; i < ret.datalen; i++) {
1752                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1753         }
1754         return ret;
1755 }
1756 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1757 CHECK(owner->result_ok);
1758         return Route_clone(&*owner->contents.result);
1759 }
1760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1761         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1762         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1763         int64_t ret_ref = 0;
1764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1766         return ret_ref;
1767 }
1768
1769 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1770 CHECK(!owner->result_ok);
1771         return LightningError_clone(&*owner->contents.err);
1772 }
1773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1774         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1775         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1776         int64_t ret_ref = 0;
1777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1779         return ret_ref;
1780 }
1781
1782 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
1783 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
1784 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
1785 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
1786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
1787         LDKPaymentPurpose_InvoicePayment_class =
1788                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
1789         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
1790         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
1791         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
1792         LDKPaymentPurpose_SpontaneousPayment_class =
1793                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
1794         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
1795         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
1796         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
1797 }
1798 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1799         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1800         switch(obj->tag) {
1801                 case LDKPaymentPurpose_InvoicePayment: {
1802                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1803                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
1804                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1805                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
1806                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
1807                 }
1808                 case LDKPaymentPurpose_SpontaneousPayment: {
1809                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
1810                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
1811                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
1812                 }
1813                 default: abort();
1814         }
1815 }
1816 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1817 CHECK(owner->result_ok);
1818         return PaymentPurpose_clone(&*owner->contents.result);
1819 }
1820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1821         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1822         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1823         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1824         int64_t ret_ref = tag_ptr(ret_copy, true);
1825         return ret_ref;
1826 }
1827
1828 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1829 CHECK(!owner->result_ok);
1830         return DecodeError_clone(&*owner->contents.err);
1831 }
1832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1833         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1834         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1835         int64_t ret_ref = 0;
1836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1838         return ret_ref;
1839 }
1840
1841 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1842 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1843 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1844 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1845 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1846 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1847 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1848 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1849 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1850 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1851 static jclass LDKClosureReason_ProcessingError_class = NULL;
1852 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1853 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1854 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1855 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1856 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1858         LDKClosureReason_CounterpartyForceClosed_class =
1859                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
1860         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
1861         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
1862         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
1863         LDKClosureReason_HolderForceClosed_class =
1864                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
1865         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
1866         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
1867         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
1868         LDKClosureReason_CooperativeClosure_class =
1869                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
1870         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
1871         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
1872         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
1873         LDKClosureReason_CommitmentTxConfirmed_class =
1874                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
1875         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
1876         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
1877         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
1878         LDKClosureReason_FundingTimedOut_class =
1879                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
1880         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
1881         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
1882         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
1883         LDKClosureReason_ProcessingError_class =
1884                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
1885         CHECK(LDKClosureReason_ProcessingError_class != NULL);
1886         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
1887         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
1888         LDKClosureReason_DisconnectedPeer_class =
1889                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
1890         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
1891         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
1892         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
1893         LDKClosureReason_OutdatedChannelManager_class =
1894                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
1895         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
1896         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
1897         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
1898 }
1899 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1900         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1901         switch(obj->tag) {
1902                 case LDKClosureReason_CounterpartyForceClosed: {
1903                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1904                         jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
1905                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
1906                 }
1907                 case LDKClosureReason_HolderForceClosed: {
1908                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
1909                 }
1910                 case LDKClosureReason_CooperativeClosure: {
1911                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
1912                 }
1913                 case LDKClosureReason_CommitmentTxConfirmed: {
1914                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
1915                 }
1916                 case LDKClosureReason_FundingTimedOut: {
1917                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
1918                 }
1919                 case LDKClosureReason_ProcessingError: {
1920                         LDKStr err_str = obj->processing_error.err;
1921                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1922                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
1923                 }
1924                 case LDKClosureReason_DisconnectedPeer: {
1925                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
1926                 }
1927                 case LDKClosureReason_OutdatedChannelManager: {
1928                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
1929                 }
1930                 default: abort();
1931         }
1932 }
1933 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
1934 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
1935 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
1936 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
1937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
1938         LDKCOption_ClosureReasonZ_Some_class =
1939                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
1940         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
1941         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
1942         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
1943         LDKCOption_ClosureReasonZ_None_class =
1944                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
1945         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
1946         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
1947         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
1948 }
1949 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1950         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1951         switch(obj->tag) {
1952                 case LDKCOption_ClosureReasonZ_Some: {
1953                         int64_t some_ref = tag_ptr(&obj->some, false);
1954                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
1955                 }
1956                 case LDKCOption_ClosureReasonZ_None: {
1957                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
1958                 }
1959                 default: abort();
1960         }
1961 }
1962 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1963 CHECK(owner->result_ok);
1964         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1965 }
1966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1967         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1968         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1969         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1970         int64_t ret_ref = tag_ptr(ret_copy, true);
1971         return ret_ref;
1972 }
1973
1974 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1975 CHECK(!owner->result_ok);
1976         return DecodeError_clone(&*owner->contents.err);
1977 }
1978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1979         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1980         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1981         int64_t ret_ref = 0;
1982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1984         return ret_ref;
1985 }
1986
1987 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
1988 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
1989 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
1990 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
1991 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
1992 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
1993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
1994         LDKHTLCDestination_NextHopChannel_class =
1995                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
1996         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
1997         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
1998         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
1999         LDKHTLCDestination_UnknownNextHop_class =
2000                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
2001         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
2002         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
2003         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
2004         LDKHTLCDestination_FailedPayment_class =
2005                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
2006         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
2007         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
2008         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
2009 }
2010 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2011         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2012         switch(obj->tag) {
2013                 case LDKHTLCDestination_NextHopChannel: {
2014                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2015                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
2016                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2017                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
2018                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
2019                 }
2020                 case LDKHTLCDestination_UnknownNextHop: {
2021                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2022                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
2023                 }
2024                 case LDKHTLCDestination_FailedPayment: {
2025                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2026                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
2027                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
2028                 }
2029                 default: abort();
2030         }
2031 }
2032 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
2033 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
2034 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
2035 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
2036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
2037         LDKCOption_HTLCDestinationZ_Some_class =
2038                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
2039         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
2040         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
2041         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
2042         LDKCOption_HTLCDestinationZ_None_class =
2043                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
2044         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
2045         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
2046         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
2047 }
2048 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2049         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2050         switch(obj->tag) {
2051                 case LDKCOption_HTLCDestinationZ_Some: {
2052                         int64_t some_ref = tag_ptr(&obj->some, false);
2053                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
2054                 }
2055                 case LDKCOption_HTLCDestinationZ_None: {
2056                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
2057                 }
2058                 default: abort();
2059         }
2060 }
2061 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2062 CHECK(owner->result_ok);
2063         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2064 }
2065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2066         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2067         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2068         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
2069         int64_t ret_ref = tag_ptr(ret_copy, true);
2070         return ret_ref;
2071 }
2072
2073 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2074 CHECK(!owner->result_ok);
2075         return DecodeError_clone(&*owner->contents.err);
2076 }
2077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2078         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2079         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2080         int64_t ret_ref = 0;
2081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2083         return ret_ref;
2084 }
2085
2086 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2087 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2088 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2089 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2090 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2091 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2093         LDKNetworkUpdate_ChannelUpdateMessage_class =
2094                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2095         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2096         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2097         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2098         LDKNetworkUpdate_ChannelFailure_class =
2099                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2100         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2101         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2102         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2103         LDKNetworkUpdate_NodeFailure_class =
2104                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2105         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2106         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2107         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2108 }
2109 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2110         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2111         switch(obj->tag) {
2112                 case LDKNetworkUpdate_ChannelUpdateMessage: {
2113                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2114                         int64_t msg_ref = 0;
2115                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2116                         msg_ref = tag_ptr(msg_var.inner, false);
2117                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2118                 }
2119                 case LDKNetworkUpdate_ChannelFailure: {
2120                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2121                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2122                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2123                 }
2124                 case LDKNetworkUpdate_NodeFailure: {
2125                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2126                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2127                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
2128                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2129                 }
2130                 default: abort();
2131         }
2132 }
2133 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2134 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2135 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2136 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2138         LDKCOption_NetworkUpdateZ_Some_class =
2139                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2140         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2141         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2142         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2143         LDKCOption_NetworkUpdateZ_None_class =
2144                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2145         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2146         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2147         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2148 }
2149 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2150         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2151         switch(obj->tag) {
2152                 case LDKCOption_NetworkUpdateZ_Some: {
2153                         int64_t some_ref = tag_ptr(&obj->some, false);
2154                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2155                 }
2156                 case LDKCOption_NetworkUpdateZ_None: {
2157                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2158                 }
2159                 default: abort();
2160         }
2161 }
2162 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2163 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2164 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2165 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2166 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2167 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2169         LDKSpendableOutputDescriptor_StaticOutput_class =
2170                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2171         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2172         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2173         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2174         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2175                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2176         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2177         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2178         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2179         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2180                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2181         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2182         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2183         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2184 }
2185 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2186         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2187         switch(obj->tag) {
2188                 case LDKSpendableOutputDescriptor_StaticOutput: {
2189                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2190                         int64_t outpoint_ref = 0;
2191                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2192                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2193                         LDKTxOut* output_ref = &obj->static_output.output;
2194                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2195                 }
2196                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2197                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2198                         int64_t delayed_payment_output_ref = 0;
2199                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2200                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2201                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2202                 }
2203                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2204                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2205                         int64_t static_payment_output_ref = 0;
2206                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2207                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2208                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2209                 }
2210                 default: abort();
2211         }
2212 }
2213 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2214         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2215         for (size_t i = 0; i < ret.datalen; i++) {
2216                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2217         }
2218         return ret;
2219 }
2220 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2221 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2222 static jclass LDKEvent_PaymentReceived_class = NULL;
2223 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2224 static jclass LDKEvent_PaymentClaimed_class = NULL;
2225 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
2226 static jclass LDKEvent_PaymentSent_class = NULL;
2227 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2228 static jclass LDKEvent_PaymentFailed_class = NULL;
2229 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2230 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2231 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2232 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2233 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2234 static jclass LDKEvent_ProbeSuccessful_class = NULL;
2235 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
2236 static jclass LDKEvent_ProbeFailed_class = NULL;
2237 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
2238 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2239 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2240 static jclass LDKEvent_SpendableOutputs_class = NULL;
2241 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2242 static jclass LDKEvent_PaymentForwarded_class = NULL;
2243 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2244 static jclass LDKEvent_ChannelClosed_class = NULL;
2245 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2246 static jclass LDKEvent_DiscardFunding_class = NULL;
2247 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2248 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2249 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2250 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
2251 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
2252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2253         LDKEvent_FundingGenerationReady_class =
2254                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2255         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2256         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[BJ)V");
2257         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2258         LDKEvent_PaymentReceived_class =
2259                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2260         CHECK(LDKEvent_PaymentReceived_class != NULL);
2261         LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2262         CHECK(LDKEvent_PaymentReceived_meth != NULL);
2263         LDKEvent_PaymentClaimed_class =
2264                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
2265         CHECK(LDKEvent_PaymentClaimed_class != NULL);
2266         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([BJJ)V");
2267         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
2268         LDKEvent_PaymentSent_class =
2269                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2270         CHECK(LDKEvent_PaymentSent_class != NULL);
2271         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2272         CHECK(LDKEvent_PaymentSent_meth != NULL);
2273         LDKEvent_PaymentFailed_class =
2274                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2275         CHECK(LDKEvent_PaymentFailed_class != NULL);
2276         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2277         CHECK(LDKEvent_PaymentFailed_meth != NULL);
2278         LDKEvent_PaymentPathSuccessful_class =
2279                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2280         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2281         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2282         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2283         LDKEvent_PaymentPathFailed_class =
2284                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2285         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2286         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2287         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2288         LDKEvent_ProbeSuccessful_class =
2289                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
2290         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
2291         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[B[J)V");
2292         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
2293         LDKEvent_ProbeFailed_class =
2294                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
2295         CHECK(LDKEvent_ProbeFailed_class != NULL);
2296         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[B[JJ)V");
2297         CHECK(LDKEvent_ProbeFailed_meth != NULL);
2298         LDKEvent_PendingHTLCsForwardable_class =
2299                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2300         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2301         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2302         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2303         LDKEvent_SpendableOutputs_class =
2304                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2305         CHECK(LDKEvent_SpendableOutputs_class != NULL);
2306         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2307         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2308         LDKEvent_PaymentForwarded_class =
2309                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2310         CHECK(LDKEvent_PaymentForwarded_class != NULL);
2311         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
2312         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2313         LDKEvent_ChannelClosed_class =
2314                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2315         CHECK(LDKEvent_ChannelClosed_class != NULL);
2316         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2317         CHECK(LDKEvent_ChannelClosed_meth != NULL);
2318         LDKEvent_DiscardFunding_class =
2319                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2320         CHECK(LDKEvent_DiscardFunding_class != NULL);
2321         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2322         CHECK(LDKEvent_DiscardFunding_meth != NULL);
2323         LDKEvent_OpenChannelRequest_class =
2324                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2325         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2326         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2327         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2328         LDKEvent_HTLCHandlingFailed_class =
2329                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
2330         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
2331         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
2332         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
2333 }
2334 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2335         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2336         switch(obj->tag) {
2337                 case LDKEvent_FundingGenerationReady: {
2338                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2339                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2340                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2341                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
2342                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2343                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2344                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2345                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2346                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
2347                         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);
2348                 }
2349                 case LDKEvent_PaymentReceived: {
2350                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2351                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2352                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
2353                         int64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
2354                         return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2355                 }
2356                 case LDKEvent_PaymentClaimed: {
2357                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2358                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
2359                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2360                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
2361                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2362                 }
2363                 case LDKEvent_PaymentSent: {
2364                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2365                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2366                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2367                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2368                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2369                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2370                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
2371                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2372                 }
2373                 case LDKEvent_PaymentFailed: {
2374                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2375                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2376                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2377                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2378                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2379                 }
2380                 case LDKEvent_PaymentPathSuccessful: {
2381                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2382                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2383                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2384                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2385                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2386                         int64_tArray path_arr = NULL;
2387                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2388                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2389                         for (size_t k = 0; k < path_var.datalen; k++) {
2390                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2391                                 int64_t path_conv_10_ref = 0;
2392                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2393                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2394                                 path_arr_ptr[k] = path_conv_10_ref;
2395                         }
2396                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2397                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2398                 }
2399                 case LDKEvent_PaymentPathFailed: {
2400                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2401                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2402                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2403                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2404                         jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
2405                         int64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
2406                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
2407                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2408                         int64_tArray path_arr = NULL;
2409                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2410                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2411                         for (size_t k = 0; k < path_var.datalen; k++) {
2412                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2413                                 int64_t path_conv_10_ref = 0;
2414                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2415                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2416                                 path_arr_ptr[k] = path_conv_10_ref;
2417                         }
2418                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2419                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
2420                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2421                         int64_t retry_ref = 0;
2422                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2423                         retry_ref = tag_ptr(retry_var.inner, false);
2424                         return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, rejected_by_dest_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref);
2425                 }
2426                 case LDKEvent_ProbeSuccessful: {
2427                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2428                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
2429                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2430                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
2431                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
2432                         int64_tArray path_arr = NULL;
2433                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2434                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2435                         for (size_t k = 0; k < path_var.datalen; k++) {
2436                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2437                                 int64_t path_conv_10_ref = 0;
2438                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2439                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2440                                 path_arr_ptr[k] = path_conv_10_ref;
2441                         }
2442                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2443                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2444                 }
2445                 case LDKEvent_ProbeFailed: {
2446                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2447                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
2448                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2449                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
2450                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
2451                         int64_tArray path_arr = NULL;
2452                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2453                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2454                         for (size_t k = 0; k < path_var.datalen; k++) {
2455                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2456                                 int64_t path_conv_10_ref = 0;
2457                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2458                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2459                                 path_arr_ptr[k] = path_conv_10_ref;
2460                         }
2461                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2462                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
2463                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref);
2464                 }
2465                 case LDKEvent_PendingHTLCsForwardable: {
2466                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2467                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
2468                 }
2469                 case LDKEvent_SpendableOutputs: {
2470                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2471                         int64_tArray outputs_arr = NULL;
2472                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2473                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2474                         for (size_t b = 0; b < outputs_var.datalen; b++) {
2475                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
2476                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
2477                         }
2478                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2479                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2480                 }
2481                 case LDKEvent_PaymentForwarded: {
2482                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2483                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
2484                         int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
2485                         (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
2486                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2487                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2488                         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);
2489                 }
2490                 case LDKEvent_ChannelClosed: {
2491                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2492                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2493                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
2494                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2495                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
2496                 }
2497                 case LDKEvent_DiscardFunding: {
2498                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2499                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2500                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2501                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2502                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2503                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2504                 }
2505                 case LDKEvent_OpenChannelRequest: {
2506                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2507                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2508                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2509                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2510                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2511                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2512                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2513                         int64_t channel_type_ref = 0;
2514                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2515                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2516                         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);
2517                 }
2518                 case LDKEvent_HTLCHandlingFailed: {
2519                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2520                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
2521                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2522                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
2523                 }
2524                 default: abort();
2525         }
2526 }
2527 static jclass LDKCOption_EventZ_Some_class = NULL;
2528 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2529 static jclass LDKCOption_EventZ_None_class = NULL;
2530 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2532         LDKCOption_EventZ_Some_class =
2533                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2534         CHECK(LDKCOption_EventZ_Some_class != NULL);
2535         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2536         CHECK(LDKCOption_EventZ_Some_meth != NULL);
2537         LDKCOption_EventZ_None_class =
2538                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2539         CHECK(LDKCOption_EventZ_None_class != NULL);
2540         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2541         CHECK(LDKCOption_EventZ_None_meth != NULL);
2542 }
2543 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2544         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2545         switch(obj->tag) {
2546                 case LDKCOption_EventZ_Some: {
2547                         int64_t some_ref = tag_ptr(&obj->some, false);
2548                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2549                 }
2550                 case LDKCOption_EventZ_None: {
2551                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2552                 }
2553                 default: abort();
2554         }
2555 }
2556 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2557 CHECK(owner->result_ok);
2558         return COption_EventZ_clone(&*owner->contents.result);
2559 }
2560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2561         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2562         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2563         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2564         int64_t ret_ref = tag_ptr(ret_copy, true);
2565         return ret_ref;
2566 }
2567
2568 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2569 CHECK(!owner->result_ok);
2570         return DecodeError_clone(&*owner->contents.err);
2571 }
2572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2573         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2574         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2575         int64_t ret_ref = 0;
2576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2578         return ret_ref;
2579 }
2580
2581 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2582 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2583 static jclass LDKErrorAction_IgnoreError_class = NULL;
2584 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2585 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2586 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2587 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2588 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2589 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2590 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2591 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2592 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2594         LDKErrorAction_DisconnectPeer_class =
2595                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2596         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2597         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2598         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2599         LDKErrorAction_IgnoreError_class =
2600                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2601         CHECK(LDKErrorAction_IgnoreError_class != NULL);
2602         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2603         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2604         LDKErrorAction_IgnoreAndLog_class =
2605                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2606         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2607         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2608         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2609         LDKErrorAction_IgnoreDuplicateGossip_class =
2610                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2611         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2612         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2613         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2614         LDKErrorAction_SendErrorMessage_class =
2615                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2616         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2617         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2618         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2619         LDKErrorAction_SendWarningMessage_class =
2620                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2621         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2622         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2623         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2624 }
2625 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2626         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2627         switch(obj->tag) {
2628                 case LDKErrorAction_DisconnectPeer: {
2629                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2630                         int64_t msg_ref = 0;
2631                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2632                         msg_ref = tag_ptr(msg_var.inner, false);
2633                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2634                 }
2635                 case LDKErrorAction_IgnoreError: {
2636                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2637                 }
2638                 case LDKErrorAction_IgnoreAndLog: {
2639                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2640                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2641                 }
2642                 case LDKErrorAction_IgnoreDuplicateGossip: {
2643                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2644                 }
2645                 case LDKErrorAction_SendErrorMessage: {
2646                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2647                         int64_t msg_ref = 0;
2648                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2649                         msg_ref = tag_ptr(msg_var.inner, false);
2650                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2651                 }
2652                 case LDKErrorAction_SendWarningMessage: {
2653                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2654                         int64_t msg_ref = 0;
2655                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2656                         msg_ref = tag_ptr(msg_var.inner, false);
2657                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2658                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2659                 }
2660                 default: abort();
2661         }
2662 }
2663 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2664 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2665 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2666 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2667 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2668 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2669 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2670 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2671 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
2672 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
2673 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2674 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2675 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2676 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2677 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2678 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2679 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2680 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2681 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2682 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2683 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2684 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2685 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2686 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2687 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2688 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2689 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2690 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2691 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2692 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2693 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2694 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2695 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2696 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2697 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2698 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2699 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2700 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2701 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2702 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2704         LDKMessageSendEvent_SendAcceptChannel_class =
2705                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2706         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2707         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2708         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2709         LDKMessageSendEvent_SendOpenChannel_class =
2710                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2711         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2712         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2713         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2714         LDKMessageSendEvent_SendFundingCreated_class =
2715                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2716         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2717         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2718         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2719         LDKMessageSendEvent_SendFundingSigned_class =
2720                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2721         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2722         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2723         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2724         LDKMessageSendEvent_SendChannelReady_class =
2725                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
2726         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
2727         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
2728         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
2729         LDKMessageSendEvent_SendAnnouncementSignatures_class =
2730                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2731         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2732         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2733         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2734         LDKMessageSendEvent_UpdateHTLCs_class =
2735                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2736         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2737         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2738         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2739         LDKMessageSendEvent_SendRevokeAndACK_class =
2740                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2741         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2742         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2743         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2744         LDKMessageSendEvent_SendClosingSigned_class =
2745                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2746         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2747         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2748         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2749         LDKMessageSendEvent_SendShutdown_class =
2750                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2751         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2752         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2753         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2754         LDKMessageSendEvent_SendChannelReestablish_class =
2755                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2756         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2757         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2758         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2759         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2760                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2761         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2762         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2763         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2764         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2765                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2766         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2767         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2768         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2769         LDKMessageSendEvent_BroadcastChannelUpdate_class =
2770                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2771         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2772         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2773         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2774         LDKMessageSendEvent_SendChannelUpdate_class =
2775                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2776         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2777         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2778         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2779         LDKMessageSendEvent_HandleError_class =
2780                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2781         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2782         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2783         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2784         LDKMessageSendEvent_SendChannelRangeQuery_class =
2785                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2786         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2787         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2788         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2789         LDKMessageSendEvent_SendShortIdsQuery_class =
2790                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2791         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2792         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2793         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2794         LDKMessageSendEvent_SendReplyChannelRange_class =
2795                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2796         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2797         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2798         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2799         LDKMessageSendEvent_SendGossipTimestampFilter_class =
2800                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2801         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2802         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2803         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2804 }
2805 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2806         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2807         switch(obj->tag) {
2808                 case LDKMessageSendEvent_SendAcceptChannel: {
2809                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2810                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2811                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2812                         int64_t msg_ref = 0;
2813                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2814                         msg_ref = tag_ptr(msg_var.inner, false);
2815                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2816                 }
2817                 case LDKMessageSendEvent_SendOpenChannel: {
2818                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2819                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2820                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2821                         int64_t msg_ref = 0;
2822                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2823                         msg_ref = tag_ptr(msg_var.inner, false);
2824                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2825                 }
2826                 case LDKMessageSendEvent_SendFundingCreated: {
2827                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2828                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2829                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2830                         int64_t msg_ref = 0;
2831                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2832                         msg_ref = tag_ptr(msg_var.inner, false);
2833                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2834                 }
2835                 case LDKMessageSendEvent_SendFundingSigned: {
2836                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2837                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2838                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2839                         int64_t msg_ref = 0;
2840                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2841                         msg_ref = tag_ptr(msg_var.inner, false);
2842                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2843                 }
2844                 case LDKMessageSendEvent_SendChannelReady: {
2845                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2846                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
2847                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2848                         int64_t msg_ref = 0;
2849                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2850                         msg_ref = tag_ptr(msg_var.inner, false);
2851                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
2852                 }
2853                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2854                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2855                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2856                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2857                         int64_t msg_ref = 0;
2858                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2859                         msg_ref = tag_ptr(msg_var.inner, false);
2860                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2861                 }
2862                 case LDKMessageSendEvent_UpdateHTLCs: {
2863                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2864                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2865                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2866                         int64_t updates_ref = 0;
2867                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2868                         updates_ref = tag_ptr(updates_var.inner, false);
2869                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2870                 }
2871                 case LDKMessageSendEvent_SendRevokeAndACK: {
2872                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2873                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2874                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2875                         int64_t msg_ref = 0;
2876                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2877                         msg_ref = tag_ptr(msg_var.inner, false);
2878                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2879                 }
2880                 case LDKMessageSendEvent_SendClosingSigned: {
2881                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2882                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2883                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2884                         int64_t msg_ref = 0;
2885                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2886                         msg_ref = tag_ptr(msg_var.inner, false);
2887                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2888                 }
2889                 case LDKMessageSendEvent_SendShutdown: {
2890                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2891                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2892                         LDKShutdown msg_var = obj->send_shutdown.msg;
2893                         int64_t msg_ref = 0;
2894                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2895                         msg_ref = tag_ptr(msg_var.inner, false);
2896                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2897                 }
2898                 case LDKMessageSendEvent_SendChannelReestablish: {
2899                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2900                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2901                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2902                         int64_t msg_ref = 0;
2903                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2904                         msg_ref = tag_ptr(msg_var.inner, false);
2905                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2906                 }
2907                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2908                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2909                         int64_t msg_ref = 0;
2910                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2911                         msg_ref = tag_ptr(msg_var.inner, false);
2912                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2913                         int64_t update_msg_ref = 0;
2914                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2915                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2916                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2917                 }
2918                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2919                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2920                         int64_t msg_ref = 0;
2921                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2922                         msg_ref = tag_ptr(msg_var.inner, false);
2923                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2924                 }
2925                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2926                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2927                         int64_t msg_ref = 0;
2928                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2929                         msg_ref = tag_ptr(msg_var.inner, false);
2930                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2931                 }
2932                 case LDKMessageSendEvent_SendChannelUpdate: {
2933                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2934                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2935                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2936                         int64_t msg_ref = 0;
2937                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2938                         msg_ref = tag_ptr(msg_var.inner, false);
2939                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2940                 }
2941                 case LDKMessageSendEvent_HandleError: {
2942                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2943                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2944                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2945                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2946                 }
2947                 case LDKMessageSendEvent_SendChannelRangeQuery: {
2948                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2949                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
2950                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2951                         int64_t msg_ref = 0;
2952                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2953                         msg_ref = tag_ptr(msg_var.inner, false);
2954                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
2955                 }
2956                 case LDKMessageSendEvent_SendShortIdsQuery: {
2957                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2958                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
2959                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2960                         int64_t msg_ref = 0;
2961                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2962                         msg_ref = tag_ptr(msg_var.inner, false);
2963                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
2964                 }
2965                 case LDKMessageSendEvent_SendReplyChannelRange: {
2966                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2967                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
2968                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2969                         int64_t msg_ref = 0;
2970                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2971                         msg_ref = tag_ptr(msg_var.inner, false);
2972                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
2973                 }
2974                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
2975                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2976                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
2977                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2978                         int64_t msg_ref = 0;
2979                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2980                         msg_ref = tag_ptr(msg_var.inner, false);
2981                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
2982                 }
2983                 default: abort();
2984         }
2985 }
2986 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2987         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2988         for (size_t i = 0; i < ret.datalen; i++) {
2989                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2990         }
2991         return ret;
2992 }
2993 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2994 CHECK(owner->result_ok);
2995         return TxOut_clone(&*owner->contents.result);
2996 }
2997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2998         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2999         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3000         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3001         return tag_ptr(ret_ref, true);
3002 }
3003
3004 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3005 CHECK(!owner->result_ok);
3006         return AccessError_clone(&*owner->contents.err);
3007 }
3008 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3009         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
3010         jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
3011         return ret_conv;
3012 }
3013
3014 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3015         return owner->a;
3016 }
3017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3018         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3019         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3020         return ret_conv;
3021 }
3022
3023 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3024         return owner->b;
3025 }
3026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3027         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3028         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3029         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3030         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3031         return ret_arr;
3032 }
3033
3034 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3035         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3036         for (size_t i = 0; i < ret.datalen; i++) {
3037                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3038         }
3039         return ret;
3040 }
3041 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
3042         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
3043         for (size_t i = 0; i < ret.datalen; i++) {
3044                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3045         }
3046         return ret;
3047 }
3048 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3049 CHECK(owner->result_ok);
3050         return *owner->contents.result;
3051 }
3052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3053         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3054         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3055 }
3056
3057 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3058 CHECK(!owner->result_ok);
3059         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3060 }
3061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3062         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3063         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3064         return ret_conv;
3065 }
3066
3067 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
3068 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
3069 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
3070 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
3071 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
3072 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
3073 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
3074 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
3075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
3076         LDKMonitorEvent_HTLCEvent_class =
3077                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
3078         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
3079         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
3080         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
3081         LDKMonitorEvent_CommitmentTxConfirmed_class =
3082                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
3083         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
3084         LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
3085         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
3086         LDKMonitorEvent_UpdateCompleted_class =
3087                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
3088         CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
3089         LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
3090         CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
3091         LDKMonitorEvent_UpdateFailed_class =
3092                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
3093         CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
3094         LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
3095         CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
3096 }
3097 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3098         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3099         switch(obj->tag) {
3100                 case LDKMonitorEvent_HTLCEvent: {
3101                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3102                         int64_t htlc_event_ref = 0;
3103                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3104                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3105                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
3106                 }
3107                 case LDKMonitorEvent_CommitmentTxConfirmed: {
3108                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3109                         int64_t commitment_tx_confirmed_ref = 0;
3110                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3111                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
3112                         return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
3113                 }
3114                 case LDKMonitorEvent_UpdateCompleted: {
3115                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
3116                         int64_t funding_txo_ref = 0;
3117                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3118                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3119                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
3120                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
3121                 }
3122                 case LDKMonitorEvent_UpdateFailed: {
3123                         LDKOutPoint update_failed_var = obj->update_failed;
3124                         int64_t update_failed_ref = 0;
3125                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3126                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
3127                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
3128                 }
3129                 default: abort();
3130         }
3131 }
3132 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3133         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3134         for (size_t i = 0; i < ret.datalen; i++) {
3135                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3136         }
3137         return ret;
3138 }
3139 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3140         return OutPoint_clone(&owner->a);
3141 }
3142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3143         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3144         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3145         int64_t ret_ref = 0;
3146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3148         return ret_ref;
3149 }
3150
3151 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3152         return CVec_MonitorEventZ_clone(&owner->b);
3153 }
3154 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3155         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3156         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3157         int64_tArray ret_arr = NULL;
3158         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3159         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3160         for (size_t o = 0; o < ret_var.datalen; o++) {
3161                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3162                 *ret_conv_14_copy = ret_var.data[o];
3163                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3164                 ret_arr_ptr[o] = ret_conv_14_ref;
3165         }
3166         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3167         FREE(ret_var.data);
3168         return ret_arr;
3169 }
3170
3171 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3172         return owner->c;
3173 }
3174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3175         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3176         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3177         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
3178         return ret_arr;
3179 }
3180
3181 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3182         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3183         for (size_t i = 0; i < ret.datalen; i++) {
3184                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3185         }
3186         return ret;
3187 }
3188 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
3189 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
3190 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
3191 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
3192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
3193         LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
3194                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
3195         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
3196         LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
3197         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
3198         LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
3199                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
3200         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
3201         LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
3202         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
3203 }
3204 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3205         LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(ptr);
3206         switch(obj->tag) {
3207                 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3208                         LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3209                         *some_conv = obj->some;
3210                         *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3211                         return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, tag_ptr(some_conv, true));
3212                 }
3213                 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3214                         return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
3215                 }
3216                 default: abort();
3217         }
3218 }
3219 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3220 CHECK(owner->result_ok);
3221         return FixedPenaltyScorer_clone(&*owner->contents.result);
3222 }
3223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3224         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3225         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3226         int64_t ret_ref = 0;
3227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3229         return ret_ref;
3230 }
3231
3232 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3233 CHECK(!owner->result_ok);
3234         return DecodeError_clone(&*owner->contents.err);
3235 }
3236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3237         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3238         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3239         int64_t ret_ref = 0;
3240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3242         return ret_ref;
3243 }
3244
3245 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3246         return owner->a;
3247 }
3248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3249         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3250         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3251         return ret_conv;
3252 }
3253
3254 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3255         return owner->b;
3256 }
3257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3258         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3259         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3260         return ret_conv;
3261 }
3262
3263 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
3264 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
3265 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
3266 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
3267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
3268         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
3269                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
3270         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
3271         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
3272         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
3273         LDKCOption_C2Tuple_u64u64ZZ_None_class =
3274                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
3275         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
3276         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
3277         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
3278 }
3279 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3280         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3281         switch(obj->tag) {
3282                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
3283                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3284                         *some_conv = obj->some;
3285                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3286                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
3287                 }
3288                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
3289                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
3290                 }
3291                 default: abort();
3292         }
3293 }
3294 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3295         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3296         for (size_t i = 0; i < ret.datalen; i++) {
3297                 ret.data[i] = NodeId_clone(&orig->data[i]);
3298         }
3299         return ret;
3300 }
3301 typedef struct LDKLogger_JCalls {
3302         atomic_size_t refcnt;
3303         JavaVM *vm;
3304         jweak o;
3305         jmethodID log_meth;
3306 } LDKLogger_JCalls;
3307 static void LDKLogger_JCalls_free(void* this_arg) {
3308         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3309         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3310                 JNIEnv *env;
3311                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3312                 if (get_jenv_res == JNI_EDETACHED) {
3313                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3314                 } else {
3315                         DO_ASSERT(get_jenv_res == JNI_OK);
3316                 }
3317                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3318                 if (get_jenv_res == JNI_EDETACHED) {
3319                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3320                 }
3321                 FREE(j_calls);
3322         }
3323 }
3324 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3325         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3326         JNIEnv *env;
3327         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3328         if (get_jenv_res == JNI_EDETACHED) {
3329                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3330         } else {
3331                 DO_ASSERT(get_jenv_res == JNI_OK);
3332         }
3333         LDKRecord record_var = *record;
3334         int64_t record_ref = 0;
3335         record_var = Record_clone(&record_var);
3336         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3337         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3338         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3339         CHECK(obj != NULL);
3340         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
3341         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3342                 (*env)->ExceptionDescribe(env);
3343                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
3344         }
3345         if (get_jenv_res == JNI_EDETACHED) {
3346                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3347         }
3348 }
3349 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3350         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3351         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3352 }
3353 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3354         jclass c = (*env)->GetObjectClass(env, o);
3355         CHECK(c != NULL);
3356         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3357         atomic_init(&calls->refcnt, 1);
3358         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3359         calls->o = (*env)->NewWeakGlobalRef(env, o);
3360         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
3361         CHECK(calls->log_meth != NULL);
3362
3363         LDKLogger ret = {
3364                 .this_arg = (void*) calls,
3365                 .log = log_LDKLogger_jcall,
3366                 .free = LDKLogger_JCalls_free,
3367         };
3368         return ret;
3369 }
3370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3371         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3372         *res_ptr = LDKLogger_init(env, clz, o);
3373         return tag_ptr(res_ptr, true);
3374 }
3375 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3376 CHECK(owner->result_ok);
3377         return &*owner->contents.result;
3378 }
3379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3380         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3381         LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3382         int64_t ret_ref = 0;
3383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3384         ret_ref = tag_ptr(ret_var.inner, false);
3385         return ret_ref;
3386 }
3387
3388 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3389 CHECK(!owner->result_ok);
3390         return DecodeError_clone(&*owner->contents.err);
3391 }
3392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3393         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3394         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3395         int64_t ret_ref = 0;
3396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3398         return ret_ref;
3399 }
3400
3401 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3402 CHECK(owner->result_ok);
3403         return InitFeatures_clone(&*owner->contents.result);
3404 }
3405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3406         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3407         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3408         int64_t ret_ref = 0;
3409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3411         return ret_ref;
3412 }
3413
3414 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3415 CHECK(!owner->result_ok);
3416         return DecodeError_clone(&*owner->contents.err);
3417 }
3418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3419         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3420         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3421         int64_t ret_ref = 0;
3422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3424         return ret_ref;
3425 }
3426
3427 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3428 CHECK(owner->result_ok);
3429         return ChannelFeatures_clone(&*owner->contents.result);
3430 }
3431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3432         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3433         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3434         int64_t ret_ref = 0;
3435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3437         return ret_ref;
3438 }
3439
3440 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3441 CHECK(!owner->result_ok);
3442         return DecodeError_clone(&*owner->contents.err);
3443 }
3444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3445         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3446         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3447         int64_t ret_ref = 0;
3448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3450         return ret_ref;
3451 }
3452
3453 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3454 CHECK(owner->result_ok);
3455         return NodeFeatures_clone(&*owner->contents.result);
3456 }
3457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3458         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3459         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3460         int64_t ret_ref = 0;
3461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3463         return ret_ref;
3464 }
3465
3466 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3467 CHECK(!owner->result_ok);
3468         return DecodeError_clone(&*owner->contents.err);
3469 }
3470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3471         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3472         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3473         int64_t ret_ref = 0;
3474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3476         return ret_ref;
3477 }
3478
3479 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3480 CHECK(owner->result_ok);
3481         return InvoiceFeatures_clone(&*owner->contents.result);
3482 }
3483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3484         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3485         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3486         int64_t ret_ref = 0;
3487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3489         return ret_ref;
3490 }
3491
3492 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3493 CHECK(!owner->result_ok);
3494         return DecodeError_clone(&*owner->contents.err);
3495 }
3496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3497         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3498         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3499         int64_t ret_ref = 0;
3500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3502         return ret_ref;
3503 }
3504
3505 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3506 CHECK(owner->result_ok);
3507         return ChannelTypeFeatures_clone(&*owner->contents.result);
3508 }
3509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3510         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3511         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3512         int64_t ret_ref = 0;
3513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3515         return ret_ref;
3516 }
3517
3518 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3519 CHECK(!owner->result_ok);
3520         return DecodeError_clone(&*owner->contents.err);
3521 }
3522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3523         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3524         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3525         int64_t ret_ref = 0;
3526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3528         return ret_ref;
3529 }
3530
3531 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3532 CHECK(owner->result_ok);
3533         return NodeId_clone(&*owner->contents.result);
3534 }
3535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3536         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3537         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3538         int64_t ret_ref = 0;
3539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3541         return ret_ref;
3542 }
3543
3544 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3545 CHECK(!owner->result_ok);
3546         return DecodeError_clone(&*owner->contents.err);
3547 }
3548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3549         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3550         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3551         int64_t ret_ref = 0;
3552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3554         return ret_ref;
3555 }
3556
3557 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3558 CHECK(owner->result_ok);
3559         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3560 }
3561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3562         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3563         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3564         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3565         int64_t ret_ref = tag_ptr(ret_copy, true);
3566         return ret_ref;
3567 }
3568
3569 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3570 CHECK(!owner->result_ok);
3571         return DecodeError_clone(&*owner->contents.err);
3572 }
3573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3574         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3575         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3576         int64_t ret_ref = 0;
3577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3579         return ret_ref;
3580 }
3581
3582 typedef struct LDKAccess_JCalls {
3583         atomic_size_t refcnt;
3584         JavaVM *vm;
3585         jweak o;
3586         jmethodID get_utxo_meth;
3587 } LDKAccess_JCalls;
3588 static void LDKAccess_JCalls_free(void* this_arg) {
3589         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3590         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3591                 JNIEnv *env;
3592                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3593                 if (get_jenv_res == JNI_EDETACHED) {
3594                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3595                 } else {
3596                         DO_ASSERT(get_jenv_res == JNI_OK);
3597                 }
3598                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3599                 if (get_jenv_res == JNI_EDETACHED) {
3600                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3601                 }
3602                 FREE(j_calls);
3603         }
3604 }
3605 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3606         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3607         JNIEnv *env;
3608         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3609         if (get_jenv_res == JNI_EDETACHED) {
3610                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3611         } else {
3612                 DO_ASSERT(get_jenv_res == JNI_OK);
3613         }
3614         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3615         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3616         int64_t short_channel_id_conv = short_channel_id;
3617         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3618         CHECK(obj != NULL);
3619         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
3620         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3621                 (*env)->ExceptionDescribe(env);
3622                 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
3623         }
3624         void* ret_ptr = untag_ptr(ret);
3625         CHECK_ACCESS(ret_ptr);
3626         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3627         FREE(untag_ptr(ret));
3628         if (get_jenv_res == JNI_EDETACHED) {
3629                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3630         }
3631         return ret_conv;
3632 }
3633 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3634         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3635         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3636 }
3637 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3638         jclass c = (*env)->GetObjectClass(env, o);
3639         CHECK(c != NULL);
3640         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3641         atomic_init(&calls->refcnt, 1);
3642         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3643         calls->o = (*env)->NewWeakGlobalRef(env, o);
3644         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3645         CHECK(calls->get_utxo_meth != NULL);
3646
3647         LDKAccess ret = {
3648                 .this_arg = (void*) calls,
3649                 .get_utxo = get_utxo_LDKAccess_jcall,
3650                 .free = LDKAccess_JCalls_free,
3651         };
3652         return ret;
3653 }
3654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3655         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3656         *res_ptr = LDKAccess_init(env, clz, o);
3657         return tag_ptr(res_ptr, true);
3658 }
3659 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) {
3660         void* this_arg_ptr = untag_ptr(this_arg);
3661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3662         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3663         unsigned char genesis_hash_arr[32];
3664         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3665         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3666         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3667         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3668         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3669         return tag_ptr(ret_conv, true);
3670 }
3671
3672 static jclass LDKCOption_AccessZ_Some_class = NULL;
3673 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
3674 static jclass LDKCOption_AccessZ_None_class = NULL;
3675 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
3676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
3677         LDKCOption_AccessZ_Some_class =
3678                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
3679         CHECK(LDKCOption_AccessZ_Some_class != NULL);
3680         LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
3681         CHECK(LDKCOption_AccessZ_Some_meth != NULL);
3682         LDKCOption_AccessZ_None_class =
3683                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
3684         CHECK(LDKCOption_AccessZ_None_class != NULL);
3685         LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
3686         CHECK(LDKCOption_AccessZ_None_meth != NULL);
3687 }
3688 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3689         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3690         switch(obj->tag) {
3691                 case LDKCOption_AccessZ_Some: {
3692                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3693                         *some_ret = obj->some;
3694                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3695                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3696                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3697                                 LDKAccess_JCalls_cloned(&(*some_ret));
3698                         }
3699                         return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, tag_ptr(some_ret, true));
3700                 }
3701                 case LDKCOption_AccessZ_None: {
3702                         return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
3703                 }
3704                 default: abort();
3705         }
3706 }
3707 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3708 CHECK(owner->result_ok);
3709         return *owner->contents.result;
3710 }
3711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3712         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3713         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3714         return ret_conv;
3715 }
3716
3717 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3718 CHECK(!owner->result_ok);
3719         return LightningError_clone(&*owner->contents.err);
3720 }
3721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3722         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3723         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3724         int64_t ret_ref = 0;
3725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3727         return ret_ref;
3728 }
3729
3730 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3731         return ChannelAnnouncement_clone(&owner->a);
3732 }
3733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3734         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3735         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3736         int64_t ret_ref = 0;
3737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3739         return ret_ref;
3740 }
3741
3742 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3743         return ChannelUpdate_clone(&owner->b);
3744 }
3745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3746         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3747         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3748         int64_t ret_ref = 0;
3749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3751         return ret_ref;
3752 }
3753
3754 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3755         return ChannelUpdate_clone(&owner->c);
3756 }
3757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3758         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3759         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3760         int64_t ret_ref = 0;
3761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3763         return ret_ref;
3764 }
3765
3766 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3767         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3768         for (size_t i = 0; i < ret.datalen; i++) {
3769                 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3770         }
3771         return ret;
3772 }
3773 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3774         LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3775         for (size_t i = 0; i < ret.datalen; i++) {
3776                 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3777         }
3778         return ret;
3779 }
3780 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3781 CHECK(owner->result_ok);
3782         return *owner->contents.result;
3783 }
3784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3785         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3786         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3787 }
3788
3789 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3790 CHECK(!owner->result_ok);
3791         return LightningError_clone(&*owner->contents.err);
3792 }
3793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3794         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3795         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3796         int64_t ret_ref = 0;
3797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3799         return ret_ref;
3800 }
3801
3802 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3803 CHECK(owner->result_ok);
3804         return ChannelUpdateInfo_clone(&*owner->contents.result);
3805 }
3806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3807         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3808         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3809         int64_t ret_ref = 0;
3810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3812         return ret_ref;
3813 }
3814
3815 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3816 CHECK(!owner->result_ok);
3817         return DecodeError_clone(&*owner->contents.err);
3818 }
3819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3820         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3821         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3822         int64_t ret_ref = 0;
3823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3825         return ret_ref;
3826 }
3827
3828 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3829 CHECK(owner->result_ok);
3830         return ChannelInfo_clone(&*owner->contents.result);
3831 }
3832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3833         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3834         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3835         int64_t ret_ref = 0;
3836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3838         return ret_ref;
3839 }
3840
3841 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3842 CHECK(!owner->result_ok);
3843         return DecodeError_clone(&*owner->contents.err);
3844 }
3845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3846         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3847         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3848         int64_t ret_ref = 0;
3849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3851         return ret_ref;
3852 }
3853
3854 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3855 CHECK(owner->result_ok);
3856         return RoutingFees_clone(&*owner->contents.result);
3857 }
3858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3859         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3860         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3861         int64_t ret_ref = 0;
3862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3864         return ret_ref;
3865 }
3866
3867 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3868 CHECK(!owner->result_ok);
3869         return DecodeError_clone(&*owner->contents.err);
3870 }
3871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3872         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3873         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3874         int64_t ret_ref = 0;
3875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3877         return ret_ref;
3878 }
3879
3880 static jclass LDKNetAddress_IPv4_class = NULL;
3881 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3882 static jclass LDKNetAddress_IPv6_class = NULL;
3883 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3884 static jclass LDKNetAddress_OnionV2_class = NULL;
3885 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3886 static jclass LDKNetAddress_OnionV3_class = NULL;
3887 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3888 static jclass LDKNetAddress_Hostname_class = NULL;
3889 static jmethodID LDKNetAddress_Hostname_meth = NULL;
3890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3891         LDKNetAddress_IPv4_class =
3892                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
3893         CHECK(LDKNetAddress_IPv4_class != NULL);
3894         LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3895         CHECK(LDKNetAddress_IPv4_meth != NULL);
3896         LDKNetAddress_IPv6_class =
3897                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
3898         CHECK(LDKNetAddress_IPv6_class != NULL);
3899         LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3900         CHECK(LDKNetAddress_IPv6_meth != NULL);
3901         LDKNetAddress_OnionV2_class =
3902                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
3903         CHECK(LDKNetAddress_OnionV2_class != NULL);
3904         LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
3905         CHECK(LDKNetAddress_OnionV2_meth != NULL);
3906         LDKNetAddress_OnionV3_class =
3907                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
3908         CHECK(LDKNetAddress_OnionV3_class != NULL);
3909         LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3910         CHECK(LDKNetAddress_OnionV3_meth != NULL);
3911         LDKNetAddress_Hostname_class =
3912                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
3913         CHECK(LDKNetAddress_Hostname_class != NULL);
3914         LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
3915         CHECK(LDKNetAddress_Hostname_meth != NULL);
3916 }
3917 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3918         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3919         switch(obj->tag) {
3920                 case LDKNetAddress_IPv4: {
3921                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3922                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3923                         int16_t port_conv = obj->i_pv4.port;
3924                         return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
3925                 }
3926                 case LDKNetAddress_IPv6: {
3927                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3928                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3929                         int16_t port_conv = obj->i_pv6.port;
3930                         return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
3931                 }
3932                 case LDKNetAddress_OnionV2: {
3933                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
3934                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
3935                         return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
3936                 }
3937                 case LDKNetAddress_OnionV3: {
3938                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3939                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3940                         int16_t checksum_conv = obj->onion_v3.checksum;
3941                         int8_t version_conv = obj->onion_v3.version;
3942                         int16_t port_conv = obj->onion_v3.port;
3943                         return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
3944                 }
3945                 case LDKNetAddress_Hostname: {
3946                         LDKHostname hostname_var = obj->hostname.hostname;
3947                         int64_t hostname_ref = 0;
3948                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3949                         hostname_ref = tag_ptr(hostname_var.inner, false);
3950                         int16_t port_conv = obj->hostname.port;
3951                         return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
3952                 }
3953                 default: abort();
3954         }
3955 }
3956 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3957         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3958         for (size_t i = 0; i < ret.datalen; i++) {
3959                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3960         }
3961         return ret;
3962 }
3963 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3964 CHECK(owner->result_ok);
3965         return NodeAnnouncementInfo_clone(&*owner->contents.result);
3966 }
3967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3968         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3969         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3977 CHECK(!owner->result_ok);
3978         return DecodeError_clone(&*owner->contents.err);
3979 }
3980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3981         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3982         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3983         int64_t ret_ref = 0;
3984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3986         return ret_ref;
3987 }
3988
3989 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3990 CHECK(owner->result_ok);
3991         return NodeAlias_clone(&*owner->contents.result);
3992 }
3993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3994         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3995         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3996         int64_t ret_ref = 0;
3997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3999         return ret_ref;
4000 }
4001
4002 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4003 CHECK(!owner->result_ok);
4004         return DecodeError_clone(&*owner->contents.err);
4005 }
4006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4007         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4008         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4009         int64_t ret_ref = 0;
4010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4012         return ret_ref;
4013 }
4014
4015 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4016 CHECK(owner->result_ok);
4017         return NodeInfo_clone(&*owner->contents.result);
4018 }
4019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4020         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4021         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4022         int64_t ret_ref = 0;
4023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4025         return ret_ref;
4026 }
4027
4028 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4029 CHECK(!owner->result_ok);
4030         return DecodeError_clone(&*owner->contents.err);
4031 }
4032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4033         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4034         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4035         int64_t ret_ref = 0;
4036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4038         return ret_ref;
4039 }
4040
4041 static inline struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4042 CHECK(owner->result_ok);
4043         return &*owner->contents.result;
4044 }
4045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4046         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4047         LDKNetworkGraph ret_var = *CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4048         int64_t ret_ref = 0;
4049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4050         ret_ref = tag_ptr(ret_var.inner, false);
4051         return ret_ref;
4052 }
4053
4054 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4055 CHECK(!owner->result_ok);
4056         return DecodeError_clone(&*owner->contents.err);
4057 }
4058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4059         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4060         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4061         int64_t ret_ref = 0;
4062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4064         return ret_ref;
4065 }
4066
4067 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4068 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4069 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4070 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4072         LDKCOption_CVec_NetAddressZZ_Some_class =
4073                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4074         CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4075         LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4076         CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4077         LDKCOption_CVec_NetAddressZZ_None_class =
4078                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4079         CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4080         LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4081         CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4082 }
4083 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4084         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4085         switch(obj->tag) {
4086                 case LDKCOption_CVec_NetAddressZZ_Some: {
4087                         LDKCVec_NetAddressZ some_var = obj->some;
4088                         int64_tArray some_arr = NULL;
4089                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
4090                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4091                         for (size_t m = 0; m < some_var.datalen; m++) {
4092                                 int64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
4093                                 some_arr_ptr[m] = some_conv_12_ref;
4094                         }
4095                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4096                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4097                 }
4098                 case LDKCOption_CVec_NetAddressZZ_None: {
4099                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4100                 }
4101                 default: abort();
4102         }
4103 }
4104 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4105 CHECK(owner->result_ok);
4106         return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
4107 }
4108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4109         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4110         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4111         int64_t ret_ref = 0;
4112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4114         return ret_ref;
4115 }
4116
4117 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4118 CHECK(!owner->result_ok);
4119         return DecodeError_clone(&*owner->contents.err);
4120 }
4121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4122         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4123         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4124         int64_t ret_ref = 0;
4125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4127         return ret_ref;
4128 }
4129
4130 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4131 CHECK(owner->result_ok);
4132         return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
4133 }
4134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4135         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4136         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4137         int64_t ret_ref = 0;
4138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4140         return ret_ref;
4141 }
4142
4143 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4144 CHECK(!owner->result_ok);
4145         return DecodeError_clone(&*owner->contents.err);
4146 }
4147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4148         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4149         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4150         int64_t ret_ref = 0;
4151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4153         return ret_ref;
4154 }
4155
4156 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4157 CHECK(owner->result_ok);
4158         return SpendableOutputDescriptor_clone(&*owner->contents.result);
4159 }
4160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4161         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4162         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4163         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4164         int64_t ret_ref = tag_ptr(ret_copy, true);
4165         return ret_ref;
4166 }
4167
4168 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4169 CHECK(!owner->result_ok);
4170         return DecodeError_clone(&*owner->contents.err);
4171 }
4172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4173         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4174         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4175         int64_t ret_ref = 0;
4176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4178         return ret_ref;
4179 }
4180
4181 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4182         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4183         for (size_t i = 0; i < ret.datalen; i++) {
4184                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4185         }
4186         return ret;
4187 }
4188 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4189         return owner->a;
4190 }
4191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4192         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4193         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4194         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4195         return ret_arr;
4196 }
4197
4198 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4199         return owner->b;
4200 }
4201 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4202         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4203         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4204         jobjectArray ret_arr = NULL;
4205         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4206         ;
4207         for (size_t i = 0; i < ret_var.datalen; i++) {
4208                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4209                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
4210                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4211         }
4212         
4213         return ret_arr;
4214 }
4215
4216 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4217 CHECK(owner->result_ok);
4218         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4219 }
4220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4221         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4222         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4223         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4224         return tag_ptr(ret_conv, true);
4225 }
4226
4227 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4228 CHECK(!owner->result_ok);
4229         return *owner->contents.err;
4230 }
4231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4232         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4233         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4234 }
4235
4236 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4237 CHECK(owner->result_ok);
4238         return *owner->contents.result;
4239 }
4240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4241         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4242         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4243         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
4244         return ret_arr;
4245 }
4246
4247 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4248 CHECK(!owner->result_ok);
4249         return *owner->contents.err;
4250 }
4251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4252         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4253         CResult_SignatureNoneZ_get_err(owner_conv);
4254 }
4255
4256 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4257         return owner->a;
4258 }
4259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4260         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
4261         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4262         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
4263         return ret_arr;
4264 }
4265
4266 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4267         return owner->b;
4268 }
4269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4270         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
4271         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4272         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
4273         return ret_arr;
4274 }
4275
4276 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4277 CHECK(owner->result_ok);
4278         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
4279 }
4280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4281         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
4282         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
4283         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
4284         return tag_ptr(ret_conv, true);
4285 }
4286
4287 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4288 CHECK(!owner->result_ok);
4289         return *owner->contents.err;
4290 }
4291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4292         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
4293         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
4294 }
4295
4296 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4297 CHECK(owner->result_ok);
4298         return *owner->contents.result;
4299 }
4300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4301         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
4302         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4303         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
4304         return ret_arr;
4305 }
4306
4307 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4308 CHECK(!owner->result_ok);
4309         return *owner->contents.err;
4310 }
4311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4312         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
4313         CResult_SecretKeyNoneZ_get_err(owner_conv);
4314 }
4315
4316 typedef struct LDKBaseSign_JCalls {
4317         atomic_size_t refcnt;
4318         JavaVM *vm;
4319         jweak o;
4320         jmethodID get_per_commitment_point_meth;
4321         jmethodID release_commitment_secret_meth;
4322         jmethodID validate_holder_commitment_meth;
4323         jmethodID channel_keys_id_meth;
4324         jmethodID sign_counterparty_commitment_meth;
4325         jmethodID validate_counterparty_revocation_meth;
4326         jmethodID sign_holder_commitment_and_htlcs_meth;
4327         jmethodID sign_justice_revoked_output_meth;
4328         jmethodID sign_justice_revoked_htlc_meth;
4329         jmethodID sign_counterparty_htlc_transaction_meth;
4330         jmethodID sign_closing_transaction_meth;
4331         jmethodID sign_channel_announcement_meth;
4332         jmethodID ready_channel_meth;
4333 } LDKBaseSign_JCalls;
4334 static void LDKBaseSign_JCalls_free(void* this_arg) {
4335         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_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 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4352         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_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         int64_t idx_conv = idx;
4361         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4362         CHECK(obj != NULL);
4363         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
4364         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4365                 (*env)->ExceptionDescribe(env);
4366                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
4367         }
4368         LDKPublicKey ret_ref;
4369         CHECK((*env)->GetArrayLength(env, ret) == 33);
4370         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
4371         if (get_jenv_res == JNI_EDETACHED) {
4372                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4373         }
4374         return ret_ref;
4375 }
4376 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4377         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4378         JNIEnv *env;
4379         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4380         if (get_jenv_res == JNI_EDETACHED) {
4381                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4382         } else {
4383                 DO_ASSERT(get_jenv_res == JNI_OK);
4384         }
4385         int64_t idx_conv = idx;
4386         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4387         CHECK(obj != NULL);
4388         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
4389         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4390                 (*env)->ExceptionDescribe(env);
4391                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
4392         }
4393         LDKThirtyTwoBytes ret_ref;
4394         CHECK((*env)->GetArrayLength(env, ret) == 32);
4395         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4396         if (get_jenv_res == JNI_EDETACHED) {
4397                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4398         }
4399         return ret_ref;
4400 }
4401 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4402         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4403         JNIEnv *env;
4404         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4405         if (get_jenv_res == JNI_EDETACHED) {
4406                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4407         } else {
4408                 DO_ASSERT(get_jenv_res == JNI_OK);
4409         }
4410         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4411         int64_t holder_tx_ref = 0;
4412         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4413         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4414         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
4415         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4416         jobjectArray preimages_arr = NULL;
4417         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4418         ;
4419         for (size_t i = 0; i < preimages_var.datalen; i++) {
4420                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4421                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4422                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4423         }
4424         
4425         FREE(preimages_var.data);
4426         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4427         CHECK(obj != NULL);
4428         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
4429         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4430                 (*env)->ExceptionDescribe(env);
4431                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
4432         }
4433         void* ret_ptr = untag_ptr(ret);
4434         CHECK_ACCESS(ret_ptr);
4435         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4436         FREE(untag_ptr(ret));
4437         if (get_jenv_res == JNI_EDETACHED) {
4438                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4439         }
4440         return ret_conv;
4441 }
4442 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4443         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4444         JNIEnv *env;
4445         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4446         if (get_jenv_res == JNI_EDETACHED) {
4447                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4448         } else {
4449                 DO_ASSERT(get_jenv_res == JNI_OK);
4450         }
4451         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4452         CHECK(obj != NULL);
4453         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
4454         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4455                 (*env)->ExceptionDescribe(env);
4456                 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
4457         }
4458         LDKThirtyTwoBytes ret_ref;
4459         CHECK((*env)->GetArrayLength(env, ret) == 32);
4460         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4461         if (get_jenv_res == JNI_EDETACHED) {
4462                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4463         }
4464         return ret_ref;
4465 }
4466 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4467         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4468         JNIEnv *env;
4469         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4470         if (get_jenv_res == JNI_EDETACHED) {
4471                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4472         } else {
4473                 DO_ASSERT(get_jenv_res == JNI_OK);
4474         }
4475         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4476         int64_t commitment_tx_ref = 0;
4477         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4478         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4479         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4480         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4481         jobjectArray preimages_arr = NULL;
4482         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4483         ;
4484         for (size_t i = 0; i < preimages_var.datalen; i++) {
4485                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4486                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4487                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4488         }
4489         
4490         FREE(preimages_var.data);
4491         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4492         CHECK(obj != NULL);
4493         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
4494         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4495                 (*env)->ExceptionDescribe(env);
4496                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
4497         }
4498         void* ret_ptr = untag_ptr(ret);
4499         CHECK_ACCESS(ret_ptr);
4500         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4501         FREE(untag_ptr(ret));
4502         if (get_jenv_res == JNI_EDETACHED) {
4503                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4504         }
4505         return ret_conv;
4506 }
4507 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4508         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4509         JNIEnv *env;
4510         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4511         if (get_jenv_res == JNI_EDETACHED) {
4512                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4513         } else {
4514                 DO_ASSERT(get_jenv_res == JNI_OK);
4515         }
4516         int64_t idx_conv = idx;
4517         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
4518         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
4519         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4520         CHECK(obj != NULL);
4521         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
4522         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4523                 (*env)->ExceptionDescribe(env);
4524                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
4525         }
4526         void* ret_ptr = untag_ptr(ret);
4527         CHECK_ACCESS(ret_ptr);
4528         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4529         FREE(untag_ptr(ret));
4530         if (get_jenv_res == JNI_EDETACHED) {
4531                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4532         }
4533         return ret_conv;
4534 }
4535 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4536         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4537         JNIEnv *env;
4538         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4539         if (get_jenv_res == JNI_EDETACHED) {
4540                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4541         } else {
4542                 DO_ASSERT(get_jenv_res == JNI_OK);
4543         }
4544         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4545         int64_t commitment_tx_ref = 0;
4546         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4547         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4548         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4549         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4550         CHECK(obj != NULL);
4551         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
4552         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4553                 (*env)->ExceptionDescribe(env);
4554                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
4555         }
4556         void* ret_ptr = untag_ptr(ret);
4557         CHECK_ACCESS(ret_ptr);
4558         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4559         FREE(untag_ptr(ret));
4560         if (get_jenv_res == JNI_EDETACHED) {
4561                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4562         }
4563         return ret_conv;
4564 }
4565 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]) {
4566         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4567         JNIEnv *env;
4568         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4569         if (get_jenv_res == JNI_EDETACHED) {
4570                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4571         } else {
4572                 DO_ASSERT(get_jenv_res == JNI_OK);
4573         }
4574         LDKTransaction justice_tx_var = justice_tx;
4575         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4576         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4577         Transaction_free(justice_tx_var);
4578         int64_t input_conv = input;
4579         int64_t amount_conv = amount;
4580         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4581         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4582         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4583         CHECK(obj != NULL);
4584         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);
4585         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4586                 (*env)->ExceptionDescribe(env);
4587                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
4588         }
4589         void* ret_ptr = untag_ptr(ret);
4590         CHECK_ACCESS(ret_ptr);
4591         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4592         FREE(untag_ptr(ret));
4593         if (get_jenv_res == JNI_EDETACHED) {
4594                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4595         }
4596         return ret_conv;
4597 }
4598 LDKCResult_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) {
4599         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4600         JNIEnv *env;
4601         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4602         if (get_jenv_res == JNI_EDETACHED) {
4603                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4604         } else {
4605                 DO_ASSERT(get_jenv_res == JNI_OK);
4606         }
4607         LDKTransaction justice_tx_var = justice_tx;
4608         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4609         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4610         Transaction_free(justice_tx_var);
4611         int64_t input_conv = input;
4612         int64_t amount_conv = amount;
4613         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4614         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4615         LDKHTLCOutputInCommitment htlc_var = *htlc;
4616         int64_t htlc_ref = 0;
4617         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4618         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4619         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4620         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4621         CHECK(obj != NULL);
4622         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);
4623         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4624                 (*env)->ExceptionDescribe(env);
4625                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
4626         }
4627         void* ret_ptr = untag_ptr(ret);
4628         CHECK_ACCESS(ret_ptr);
4629         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4630         FREE(untag_ptr(ret));
4631         if (get_jenv_res == JNI_EDETACHED) {
4632                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4633         }
4634         return ret_conv;
4635 }
4636 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) {
4637         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4638         JNIEnv *env;
4639         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4640         if (get_jenv_res == JNI_EDETACHED) {
4641                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4642         } else {
4643                 DO_ASSERT(get_jenv_res == JNI_OK);
4644         }
4645         LDKTransaction htlc_tx_var = htlc_tx;
4646         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4647         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4648         Transaction_free(htlc_tx_var);
4649         int64_t input_conv = input;
4650         int64_t amount_conv = amount;
4651         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4652         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4653         LDKHTLCOutputInCommitment htlc_var = *htlc;
4654         int64_t htlc_ref = 0;
4655         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4656         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4657         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4658         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4659         CHECK(obj != NULL);
4660         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);
4661         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4662                 (*env)->ExceptionDescribe(env);
4663                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4664         }
4665         void* ret_ptr = untag_ptr(ret);
4666         CHECK_ACCESS(ret_ptr);
4667         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4668         FREE(untag_ptr(ret));
4669         if (get_jenv_res == JNI_EDETACHED) {
4670                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4671         }
4672         return ret_conv;
4673 }
4674 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4675         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4676         JNIEnv *env;
4677         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4678         if (get_jenv_res == JNI_EDETACHED) {
4679                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4680         } else {
4681                 DO_ASSERT(get_jenv_res == JNI_OK);
4682         }
4683         LDKClosingTransaction closing_tx_var = *closing_tx;
4684         int64_t closing_tx_ref = 0;
4685         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4686         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4687         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4688         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4689         CHECK(obj != NULL);
4690         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4691         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4692                 (*env)->ExceptionDescribe(env);
4693                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4694         }
4695         void* ret_ptr = untag_ptr(ret);
4696         CHECK_ACCESS(ret_ptr);
4697         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4698         FREE(untag_ptr(ret));
4699         if (get_jenv_res == JNI_EDETACHED) {
4700                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4701         }
4702         return ret_conv;
4703 }
4704 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4705         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4706         JNIEnv *env;
4707         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4708         if (get_jenv_res == JNI_EDETACHED) {
4709                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4710         } else {
4711                 DO_ASSERT(get_jenv_res == JNI_OK);
4712         }
4713         LDKUnsignedChannelAnnouncement msg_var = *msg;
4714         int64_t msg_ref = 0;
4715         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4716         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4717         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4718         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4719         CHECK(obj != NULL);
4720         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4721         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4722                 (*env)->ExceptionDescribe(env);
4723                 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4724         }
4725         void* ret_ptr = untag_ptr(ret);
4726         CHECK_ACCESS(ret_ptr);
4727         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4728         FREE(untag_ptr(ret));
4729         if (get_jenv_res == JNI_EDETACHED) {
4730                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4731         }
4732         return ret_conv;
4733 }
4734 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4735         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4736         JNIEnv *env;
4737         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4738         if (get_jenv_res == JNI_EDETACHED) {
4739                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4740         } else {
4741                 DO_ASSERT(get_jenv_res == JNI_OK);
4742         }
4743         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4744         int64_t channel_parameters_ref = 0;
4745         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4746         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4747         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4748         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4749         CHECK(obj != NULL);
4750         (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4751         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4752                 (*env)->ExceptionDescribe(env);
4753                 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4754         }
4755         if (get_jenv_res == JNI_EDETACHED) {
4756                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4757         }
4758 }
4759 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4760         jclass c = (*env)->GetObjectClass(env, o);
4761         CHECK(c != NULL);
4762         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4763         atomic_init(&calls->refcnt, 1);
4764         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4765         calls->o = (*env)->NewWeakGlobalRef(env, o);
4766         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4767         CHECK(calls->get_per_commitment_point_meth != NULL);
4768         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4769         CHECK(calls->release_commitment_secret_meth != NULL);
4770         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4771         CHECK(calls->validate_holder_commitment_meth != NULL);
4772         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4773         CHECK(calls->channel_keys_id_meth != NULL);
4774         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4775         CHECK(calls->sign_counterparty_commitment_meth != NULL);
4776         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4777         CHECK(calls->validate_counterparty_revocation_meth != NULL);
4778         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4779         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4780         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4781         CHECK(calls->sign_justice_revoked_output_meth != NULL);
4782         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4783         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4784         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4785         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4786         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4787         CHECK(calls->sign_closing_transaction_meth != NULL);
4788         calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4789         CHECK(calls->sign_channel_announcement_meth != NULL);
4790         calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4791         CHECK(calls->ready_channel_meth != NULL);
4792
4793         LDKChannelPublicKeys pubkeys_conv;
4794         pubkeys_conv.inner = untag_ptr(pubkeys);
4795         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4796         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4797
4798         LDKBaseSign ret = {
4799                 .this_arg = (void*) calls,
4800                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4801                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4802                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4803                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4804                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4805                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4806                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4807                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4808                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4809                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4810                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4811                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4812                 .ready_channel = ready_channel_LDKBaseSign_jcall,
4813                 .free = LDKBaseSign_JCalls_free,
4814                 .pubkeys = pubkeys_conv,
4815                 .set_pubkeys = NULL,
4816         };
4817         return ret;
4818 }
4819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4820         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4821         *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
4822         return tag_ptr(res_ptr, true);
4823 }
4824 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) {
4825         void* this_arg_ptr = untag_ptr(this_arg);
4826         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4827         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4828         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4829         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
4830         return ret_arr;
4831 }
4832
4833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4834         void* this_arg_ptr = untag_ptr(this_arg);
4835         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4836         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4837         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4838         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
4839         return ret_arr;
4840 }
4841
4842 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) {
4843         void* this_arg_ptr = untag_ptr(this_arg);
4844         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4845         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4846         LDKHolderCommitmentTransaction holder_tx_conv;
4847         holder_tx_conv.inner = untag_ptr(holder_tx);
4848         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4849         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4850         holder_tx_conv.is_owned = false;
4851         LDKCVec_PaymentPreimageZ preimages_constr;
4852         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4853         if (preimages_constr.datalen > 0)
4854                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4855         else
4856                 preimages_constr.data = NULL;
4857         for (size_t i = 0; i < preimages_constr.datalen; i++) {
4858                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4859                 LDKThirtyTwoBytes preimages_conv_8_ref;
4860                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4861                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4862                 preimages_constr.data[i] = preimages_conv_8_ref;
4863         }
4864         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4865         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4866         return tag_ptr(ret_conv, true);
4867 }
4868
4869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4870         void* this_arg_ptr = untag_ptr(this_arg);
4871         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4872         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4873         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4874         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
4875         return ret_arr;
4876 }
4877
4878 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) {
4879         void* this_arg_ptr = untag_ptr(this_arg);
4880         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4881         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4882         LDKCommitmentTransaction commitment_tx_conv;
4883         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4884         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4885         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4886         commitment_tx_conv.is_owned = false;
4887         LDKCVec_PaymentPreimageZ preimages_constr;
4888         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4889         if (preimages_constr.datalen > 0)
4890                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4891         else
4892                 preimages_constr.data = NULL;
4893         for (size_t i = 0; i < preimages_constr.datalen; i++) {
4894                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4895                 LDKThirtyTwoBytes preimages_conv_8_ref;
4896                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4897                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4898                 preimages_constr.data[i] = preimages_conv_8_ref;
4899         }
4900         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4901         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4902         return tag_ptr(ret_conv, true);
4903 }
4904
4905 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) {
4906         void* this_arg_ptr = untag_ptr(this_arg);
4907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4908         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4909         unsigned char secret_arr[32];
4910         CHECK((*env)->GetArrayLength(env, secret) == 32);
4911         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
4912         unsigned char (*secret_ref)[32] = &secret_arr;
4913         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4914         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4915         return tag_ptr(ret_conv, true);
4916 }
4917
4918 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) {
4919         void* this_arg_ptr = untag_ptr(this_arg);
4920         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4921         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4922         LDKHolderCommitmentTransaction commitment_tx_conv;
4923         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4924         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4925         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4926         commitment_tx_conv.is_owned = false;
4927         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4928         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4929         return tag_ptr(ret_conv, true);
4930 }
4931
4932 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) {
4933         void* this_arg_ptr = untag_ptr(this_arg);
4934         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4935         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4936         LDKTransaction justice_tx_ref;
4937         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4938         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4939         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4940         justice_tx_ref.data_is_owned = true;
4941         unsigned char per_commitment_key_arr[32];
4942         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4943         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4944         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4945         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4946         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4947         return tag_ptr(ret_conv, true);
4948 }
4949
4950 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) {
4951         void* this_arg_ptr = untag_ptr(this_arg);
4952         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4953         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4954         LDKTransaction justice_tx_ref;
4955         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4956         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4957         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4958         justice_tx_ref.data_is_owned = true;
4959         unsigned char per_commitment_key_arr[32];
4960         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4961         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4962         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4963         LDKHTLCOutputInCommitment htlc_conv;
4964         htlc_conv.inner = untag_ptr(htlc);
4965         htlc_conv.is_owned = ptr_is_owned(htlc);
4966         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4967         htlc_conv.is_owned = false;
4968         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4969         *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);
4970         return tag_ptr(ret_conv, true);
4971 }
4972
4973 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) {
4974         void* this_arg_ptr = untag_ptr(this_arg);
4975         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4976         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4977         LDKTransaction htlc_tx_ref;
4978         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
4979         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4980         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
4981         htlc_tx_ref.data_is_owned = true;
4982         LDKPublicKey per_commitment_point_ref;
4983         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
4984         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
4985         LDKHTLCOutputInCommitment htlc_conv;
4986         htlc_conv.inner = untag_ptr(htlc);
4987         htlc_conv.is_owned = ptr_is_owned(htlc);
4988         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4989         htlc_conv.is_owned = false;
4990         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4991         *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);
4992         return tag_ptr(ret_conv, true);
4993 }
4994
4995 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) {
4996         void* this_arg_ptr = untag_ptr(this_arg);
4997         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4998         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4999         LDKClosingTransaction closing_tx_conv;
5000         closing_tx_conv.inner = untag_ptr(closing_tx);
5001         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
5002         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5003         closing_tx_conv.is_owned = false;
5004         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5005         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5006         return tag_ptr(ret_conv, true);
5007 }
5008
5009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5010         void* this_arg_ptr = untag_ptr(this_arg);
5011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5012         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5013         LDKUnsignedChannelAnnouncement msg_conv;
5014         msg_conv.inner = untag_ptr(msg);
5015         msg_conv.is_owned = ptr_is_owned(msg);
5016         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5017         msg_conv.is_owned = false;
5018         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5019         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5020         return tag_ptr(ret_conv, true);
5021 }
5022
5023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5024         void* this_arg_ptr = untag_ptr(this_arg);
5025         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5026         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5027         LDKChannelTransactionParameters channel_parameters_conv;
5028         channel_parameters_conv.inner = untag_ptr(channel_parameters);
5029         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
5030         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5031         channel_parameters_conv.is_owned = false;
5032         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5033 }
5034
5035 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5036         if (this_arg->set_pubkeys != NULL)
5037                 this_arg->set_pubkeys(this_arg);
5038         return this_arg->pubkeys;
5039 }
5040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5041         void* this_arg_ptr = untag_ptr(this_arg);
5042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5043         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5044         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5045         int64_t ret_ref = 0;
5046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5048         return ret_ref;
5049 }
5050
5051 typedef struct LDKSign_JCalls {
5052         atomic_size_t refcnt;
5053         JavaVM *vm;
5054         jweak o;
5055         LDKBaseSign_JCalls* BaseSign;
5056         jmethodID write_meth;
5057 } LDKSign_JCalls;
5058 static void LDKSign_JCalls_free(void* this_arg) {
5059         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5060         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5061                 JNIEnv *env;
5062                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5063                 if (get_jenv_res == JNI_EDETACHED) {
5064                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5065                 } else {
5066                         DO_ASSERT(get_jenv_res == JNI_OK);
5067                 }
5068                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5069                 if (get_jenv_res == JNI_EDETACHED) {
5070                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5071                 }
5072                 FREE(j_calls);
5073         }
5074 }
5075 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5076         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5077         JNIEnv *env;
5078         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5079         if (get_jenv_res == JNI_EDETACHED) {
5080                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5081         } else {
5082                 DO_ASSERT(get_jenv_res == JNI_OK);
5083         }
5084         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5085         CHECK(obj != NULL);
5086         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5087         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5088                 (*env)->ExceptionDescribe(env);
5089                 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5090         }
5091         LDKCVec_u8Z ret_ref;
5092         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5093         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5094         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5095         if (get_jenv_res == JNI_EDETACHED) {
5096                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5097         }
5098         return ret_ref;
5099 }
5100 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5101         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5102         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5103         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5104 }
5105 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5106         jclass c = (*env)->GetObjectClass(env, o);
5107         CHECK(c != NULL);
5108         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5109         atomic_init(&calls->refcnt, 1);
5110         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5111         calls->o = (*env)->NewWeakGlobalRef(env, o);
5112         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5113         CHECK(calls->write_meth != NULL);
5114
5115         LDKChannelPublicKeys pubkeys_conv;
5116         pubkeys_conv.inner = untag_ptr(pubkeys);
5117         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
5118         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5119
5120         LDKSign ret = {
5121                 .this_arg = (void*) calls,
5122                 .write = write_LDKSign_jcall,
5123                 .cloned = LDKSign_JCalls_cloned,
5124                 .free = LDKSign_JCalls_free,
5125                 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5126         };
5127         calls->BaseSign = ret.BaseSign.this_arg;
5128         return ret;
5129 }
5130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5131         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5132         *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5133         return tag_ptr(res_ptr, true);
5134 }
5135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5136         LDKSign *inp = (LDKSign *)untag_ptr(arg);
5137         return tag_ptr(&inp->BaseSign, false);
5138 }
5139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5140         void* this_arg_ptr = untag_ptr(this_arg);
5141         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5142         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5143         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5144         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5145         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5146         CVec_u8Z_free(ret_var);
5147         return ret_arr;
5148 }
5149
5150 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5151 CHECK(owner->result_ok);
5152         return Sign_clone(&*owner->contents.result);
5153 }
5154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5155         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
5156         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5157         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5158         return tag_ptr(ret_ret, true);
5159 }
5160
5161 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5162 CHECK(!owner->result_ok);
5163         return DecodeError_clone(&*owner->contents.err);
5164 }
5165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5166         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
5167         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5168         int64_t ret_ref = 0;
5169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5171         return ret_ref;
5172 }
5173
5174 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5175 CHECK(owner->result_ok);
5176         return *owner->contents.result;
5177 }
5178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5179         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5180         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5181         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5182         return ret_arr;
5183 }
5184
5185 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5186 CHECK(!owner->result_ok);
5187         return *owner->contents.err;
5188 }
5189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5190         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5191         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5192 }
5193
5194 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5195         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5196         for (size_t i = 0; i < ret.datalen; i++) {
5197                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5198         }
5199         return ret;
5200 }
5201 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5202 CHECK(owner->result_ok);
5203         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5204 }
5205 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5206         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
5207         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5208         jobjectArray ret_arr = NULL;
5209         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5210         ;
5211         for (size_t i = 0; i < ret_var.datalen; i++) {
5212                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
5213                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
5214                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
5215                 CVec_u8Z_free(ret_conv_8_var);
5216                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5217         }
5218         
5219         FREE(ret_var.data);
5220         return ret_arr;
5221 }
5222
5223 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5224 CHECK(!owner->result_ok);
5225         return *owner->contents.err;
5226 }
5227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5228         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
5229         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5230 }
5231
5232 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5233 CHECK(owner->result_ok);
5234         return InMemorySigner_clone(&*owner->contents.result);
5235 }
5236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5237         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
5238         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5239         int64_t ret_ref = 0;
5240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5242         return ret_ref;
5243 }
5244
5245 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5246 CHECK(!owner->result_ok);
5247         return DecodeError_clone(&*owner->contents.err);
5248 }
5249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5250         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
5251         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5252         int64_t ret_ref = 0;
5253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5255         return ret_ref;
5256 }
5257
5258 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5259         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5260         for (size_t i = 0; i < ret.datalen; i++) {
5261                 ret.data[i] = TxOut_clone(&orig->data[i]);
5262         }
5263         return ret;
5264 }
5265 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5266 CHECK(owner->result_ok);
5267         return *owner->contents.result;
5268 }
5269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5270         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
5271         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5272         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5273         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5274         return ret_arr;
5275 }
5276
5277 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5278 CHECK(!owner->result_ok);
5279         return *owner->contents.err;
5280 }
5281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5282         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
5283         CResult_TransactionNoneZ_get_err(owner_conv);
5284 }
5285
5286 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5287         return ThirtyTwoBytes_clone(&owner->a);
5288 }
5289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5290         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
5291         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5292         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
5293         return ret_arr;
5294 }
5295
5296 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5297         return ChannelMonitor_clone(&owner->b);
5298 }
5299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5300         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
5301         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5302         int64_t ret_ref = 0;
5303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5305         return ret_ref;
5306 }
5307
5308 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
5309         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
5310         for (size_t i = 0; i < ret.datalen; i++) {
5311                 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
5312         }
5313         return ret;
5314 }
5315 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5316 CHECK(owner->result_ok);
5317         return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
5318 }
5319 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5320         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
5321         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
5322         int64_tArray ret_arr = NULL;
5323         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5324         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5325         for (size_t j = 0; j < ret_var.datalen; j++) {
5326                 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5327                 *ret_conv_35_conv = ret_var.data[j];
5328                 ret_arr_ptr[j] = tag_ptr(ret_conv_35_conv, true);
5329         }
5330         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5331         FREE(ret_var.data);
5332         return ret_arr;
5333 }
5334
5335 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5336 CHECK(!owner->result_ok);
5337         return *owner->contents.err;
5338 }
5339 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5340         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
5341         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
5342         return ret_conv;
5343 }
5344
5345 static jclass LDKCOption_u16Z_Some_class = NULL;
5346 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
5347 static jclass LDKCOption_u16Z_None_class = NULL;
5348 static jmethodID LDKCOption_u16Z_None_meth = NULL;
5349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
5350         LDKCOption_u16Z_Some_class =
5351                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
5352         CHECK(LDKCOption_u16Z_Some_class != NULL);
5353         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
5354         CHECK(LDKCOption_u16Z_Some_meth != NULL);
5355         LDKCOption_u16Z_None_class =
5356                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
5357         CHECK(LDKCOption_u16Z_None_class != NULL);
5358         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
5359         CHECK(LDKCOption_u16Z_None_meth != NULL);
5360 }
5361 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5362         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
5363         switch(obj->tag) {
5364                 case LDKCOption_u16Z_Some: {
5365                         int16_t some_conv = obj->some;
5366                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
5367                 }
5368                 case LDKCOption_u16Z_None: {
5369                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
5370                 }
5371                 default: abort();
5372         }
5373 }
5374 static jclass LDKAPIError_APIMisuseError_class = NULL;
5375 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
5376 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
5377 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
5378 static jclass LDKAPIError_RouteError_class = NULL;
5379 static jmethodID LDKAPIError_RouteError_meth = NULL;
5380 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
5381 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
5382 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
5383 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
5384 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
5385 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
5386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
5387         LDKAPIError_APIMisuseError_class =
5388                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
5389         CHECK(LDKAPIError_APIMisuseError_class != NULL);
5390         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
5391         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
5392         LDKAPIError_FeeRateTooHigh_class =
5393                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
5394         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
5395         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
5396         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
5397         LDKAPIError_RouteError_class =
5398                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
5399         CHECK(LDKAPIError_RouteError_class != NULL);
5400         LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
5401         CHECK(LDKAPIError_RouteError_meth != NULL);
5402         LDKAPIError_ChannelUnavailable_class =
5403                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
5404         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
5405         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
5406         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
5407         LDKAPIError_MonitorUpdateFailed_class =
5408                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
5409         CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
5410         LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
5411         CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
5412         LDKAPIError_IncompatibleShutdownScript_class =
5413                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
5414         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
5415         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
5416         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
5417 }
5418 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5419         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
5420         switch(obj->tag) {
5421                 case LDKAPIError_APIMisuseError: {
5422                         LDKStr err_str = obj->api_misuse_error.err;
5423                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5424                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
5425                 }
5426                 case LDKAPIError_FeeRateTooHigh: {
5427                         LDKStr err_str = obj->fee_rate_too_high.err;
5428                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5429                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
5430                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
5431                 }
5432                 case LDKAPIError_RouteError: {
5433                         LDKStr err_str = obj->route_error.err;
5434                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5435                         return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
5436                 }
5437                 case LDKAPIError_ChannelUnavailable: {
5438                         LDKStr err_str = obj->channel_unavailable.err;
5439                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5440                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
5441                 }
5442                 case LDKAPIError_MonitorUpdateFailed: {
5443                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
5444                 }
5445                 case LDKAPIError_IncompatibleShutdownScript: {
5446                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5447                         int64_t script_ref = 0;
5448                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5449                         script_ref = tag_ptr(script_var.inner, false);
5450                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
5451                 }
5452                 default: abort();
5453         }
5454 }
5455 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5456 CHECK(owner->result_ok);
5457         return *owner->contents.result;
5458 }
5459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5460         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
5461         CResult_NoneAPIErrorZ_get_ok(owner_conv);
5462 }
5463
5464 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5465 CHECK(!owner->result_ok);
5466         return APIError_clone(&*owner->contents.err);
5467 }
5468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5469         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
5470         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5471         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5472         int64_t ret_ref = tag_ptr(ret_copy, true);
5473         return ret_ref;
5474 }
5475
5476 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5477         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5478         for (size_t i = 0; i < ret.datalen; i++) {
5479                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5480         }
5481         return ret;
5482 }
5483 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5484         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5485         for (size_t i = 0; i < ret.datalen; i++) {
5486                 ret.data[i] = APIError_clone(&orig->data[i]);
5487         }
5488         return ret;
5489 }
5490 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5491 CHECK(owner->result_ok);
5492         return ThirtyTwoBytes_clone(&*owner->contents.result);
5493 }
5494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5495         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5496         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5497         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
5498         return ret_arr;
5499 }
5500
5501 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5502 CHECK(!owner->result_ok);
5503         return APIError_clone(&*owner->contents.err);
5504 }
5505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5506         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5507         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5508         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5509         int64_t ret_ref = tag_ptr(ret_copy, true);
5510         return ret_ref;
5511 }
5512
5513 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
5514 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
5515 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
5516 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
5517 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
5518 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
5519 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
5520 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
5521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
5522         LDKPaymentSendFailure_ParameterError_class =
5523                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
5524         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
5525         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
5526         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
5527         LDKPaymentSendFailure_PathParameterError_class =
5528                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
5529         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
5530         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
5531         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
5532         LDKPaymentSendFailure_AllFailedRetrySafe_class =
5533                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
5534         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
5535         LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
5536         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
5537         LDKPaymentSendFailure_PartialFailure_class =
5538                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
5539         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
5540         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
5541         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
5542 }
5543 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5544         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5545         switch(obj->tag) {
5546                 case LDKPaymentSendFailure_ParameterError: {
5547                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5548                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
5549                 }
5550                 case LDKPaymentSendFailure_PathParameterError: {
5551                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5552                         int64_tArray path_parameter_error_arr = NULL;
5553                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
5554                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
5555                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5556                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5557                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5558                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5559                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5560                         }
5561                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
5562                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
5563                 }
5564                 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5565                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5566                         int64_tArray all_failed_retry_safe_arr = NULL;
5567                         all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
5568                         int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
5569                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5570                                 int64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
5571                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5572                         }
5573                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
5574                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
5575                 }
5576                 case LDKPaymentSendFailure_PartialFailure: {
5577                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5578                         int64_tArray results_arr = NULL;
5579                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
5580                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
5581                         for (size_t w = 0; w < results_var.datalen; w++) {
5582                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5583                                 *results_conv_22_conv = results_var.data[w];
5584                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5585                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5586                         }
5587                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
5588                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5589                         int64_t failed_paths_retry_ref = 0;
5590                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5591                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5592                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5593                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
5594                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5595                 }
5596                 default: abort();
5597         }
5598 }
5599 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5600 CHECK(owner->result_ok);
5601         return ThirtyTwoBytes_clone(&*owner->contents.result);
5602 }
5603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5604         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
5605         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5606         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5607         return ret_arr;
5608 }
5609
5610 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5611 CHECK(!owner->result_ok);
5612         return PaymentSendFailure_clone(&*owner->contents.err);
5613 }
5614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5615         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
5616         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5617         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5618         int64_t ret_ref = tag_ptr(ret_copy, true);
5619         return ret_ref;
5620 }
5621
5622 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5623 CHECK(owner->result_ok);
5624         return *owner->contents.result;
5625 }
5626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5627         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5628         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5629 }
5630
5631 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5632 CHECK(!owner->result_ok);
5633         return PaymentSendFailure_clone(&*owner->contents.err);
5634 }
5635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5636         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5637         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5638         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5639         int64_t ret_ref = tag_ptr(ret_copy, true);
5640         return ret_ref;
5641 }
5642
5643 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5644         return ThirtyTwoBytes_clone(&owner->a);
5645 }
5646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5647         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5648         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5649         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5650         return ret_arr;
5651 }
5652
5653 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5654         return ThirtyTwoBytes_clone(&owner->b);
5655 }
5656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5657         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5658         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5659         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5660         return ret_arr;
5661 }
5662
5663 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5664 CHECK(owner->result_ok);
5665         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5666 }
5667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5668         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5669         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5670         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5671         return tag_ptr(ret_conv, true);
5672 }
5673
5674 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5675 CHECK(!owner->result_ok);
5676         return PaymentSendFailure_clone(&*owner->contents.err);
5677 }
5678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5679         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5680         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5681         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5682         int64_t ret_ref = tag_ptr(ret_copy, true);
5683         return ret_ref;
5684 }
5685
5686 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5687         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5688         for (size_t i = 0; i < ret.datalen; i++) {
5689                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5690         }
5691         return ret;
5692 }
5693 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5694         return ThirtyTwoBytes_clone(&owner->a);
5695 }
5696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5697         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5698         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5699         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5700         return ret_arr;
5701 }
5702
5703 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5704         return ThirtyTwoBytes_clone(&owner->b);
5705 }
5706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5707         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5708         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5709         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5710         return ret_arr;
5711 }
5712
5713 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5714 CHECK(owner->result_ok);
5715         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5716 }
5717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5718         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5719         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5720         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5721         return tag_ptr(ret_conv, true);
5722 }
5723
5724 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5725 CHECK(!owner->result_ok);
5726         return *owner->contents.err;
5727 }
5728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5729         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5730         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5731 }
5732
5733 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5734 CHECK(owner->result_ok);
5735         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5736 }
5737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5738         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5739         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5740         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5741         return tag_ptr(ret_conv, true);
5742 }
5743
5744 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5745 CHECK(!owner->result_ok);
5746         return APIError_clone(&*owner->contents.err);
5747 }
5748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5749         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5750         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5751         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5752         int64_t ret_ref = tag_ptr(ret_copy, true);
5753         return ret_ref;
5754 }
5755
5756 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5757 CHECK(owner->result_ok);
5758         return ThirtyTwoBytes_clone(&*owner->contents.result);
5759 }
5760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5761         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5762         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5763         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5764         return ret_arr;
5765 }
5766
5767 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5768 CHECK(!owner->result_ok);
5769         return *owner->contents.err;
5770 }
5771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5772         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5773         CResult_PaymentSecretNoneZ_get_err(owner_conv);
5774 }
5775
5776 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5777 CHECK(owner->result_ok);
5778         return ThirtyTwoBytes_clone(&*owner->contents.result);
5779 }
5780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5781         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5782         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5783         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5784         return ret_arr;
5785 }
5786
5787 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5788 CHECK(!owner->result_ok);
5789         return APIError_clone(&*owner->contents.err);
5790 }
5791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5792         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5793         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5794         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5795         int64_t ret_ref = tag_ptr(ret_copy, true);
5796         return ret_ref;
5797 }
5798
5799 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5800 CHECK(owner->result_ok);
5801         return ThirtyTwoBytes_clone(&*owner->contents.result);
5802 }
5803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5804         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5805         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5806         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
5807         return ret_arr;
5808 }
5809
5810 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5811 CHECK(!owner->result_ok);
5812         return APIError_clone(&*owner->contents.err);
5813 }
5814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5815         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5816         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5817         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5818         int64_t ret_ref = tag_ptr(ret_copy, true);
5819         return ret_ref;
5820 }
5821
5822 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5823 CHECK(owner->result_ok);
5824         return CounterpartyForwardingInfo_clone(&*owner->contents.result);
5825 }
5826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5827         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5828         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5829         int64_t ret_ref = 0;
5830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5832         return ret_ref;
5833 }
5834
5835 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5836 CHECK(!owner->result_ok);
5837         return DecodeError_clone(&*owner->contents.err);
5838 }
5839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5840         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5841         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5842         int64_t ret_ref = 0;
5843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5845         return ret_ref;
5846 }
5847
5848 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5849 CHECK(owner->result_ok);
5850         return ChannelCounterparty_clone(&*owner->contents.result);
5851 }
5852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5853         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5854         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5855         int64_t ret_ref = 0;
5856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5858         return ret_ref;
5859 }
5860
5861 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5862 CHECK(!owner->result_ok);
5863         return DecodeError_clone(&*owner->contents.err);
5864 }
5865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5866         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5867         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5868         int64_t ret_ref = 0;
5869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5871         return ret_ref;
5872 }
5873
5874 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5875 CHECK(owner->result_ok);
5876         return ChannelDetails_clone(&*owner->contents.result);
5877 }
5878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5879         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5880         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5881         int64_t ret_ref = 0;
5882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5884         return ret_ref;
5885 }
5886
5887 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5888 CHECK(!owner->result_ok);
5889         return DecodeError_clone(&*owner->contents.err);
5890 }
5891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5892         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5893         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5894         int64_t ret_ref = 0;
5895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5897         return ret_ref;
5898 }
5899
5900 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5901 CHECK(owner->result_ok);
5902         return PhantomRouteHints_clone(&*owner->contents.result);
5903 }
5904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5905         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5906         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5907         int64_t ret_ref = 0;
5908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5910         return ret_ref;
5911 }
5912
5913 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5914 CHECK(!owner->result_ok);
5915         return DecodeError_clone(&*owner->contents.err);
5916 }
5917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5918         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5919         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5920         int64_t ret_ref = 0;
5921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5923         return ret_ref;
5924 }
5925
5926 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5927         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5928         for (size_t i = 0; i < ret.datalen; i++) {
5929                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5930         }
5931         return ret;
5932 }
5933 typedef struct LDKWatch_JCalls {
5934         atomic_size_t refcnt;
5935         JavaVM *vm;
5936         jweak o;
5937         jmethodID watch_channel_meth;
5938         jmethodID update_channel_meth;
5939         jmethodID release_pending_monitor_events_meth;
5940 } LDKWatch_JCalls;
5941 static void LDKWatch_JCalls_free(void* this_arg) {
5942         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5943         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5944                 JNIEnv *env;
5945                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5946                 if (get_jenv_res == JNI_EDETACHED) {
5947                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5948                 } else {
5949                         DO_ASSERT(get_jenv_res == JNI_OK);
5950                 }
5951                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5952                 if (get_jenv_res == JNI_EDETACHED) {
5953                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5954                 }
5955                 FREE(j_calls);
5956         }
5957 }
5958 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5959         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5960         JNIEnv *env;
5961         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5962         if (get_jenv_res == JNI_EDETACHED) {
5963                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5964         } else {
5965                 DO_ASSERT(get_jenv_res == JNI_OK);
5966         }
5967         LDKOutPoint funding_txo_var = funding_txo;
5968         int64_t funding_txo_ref = 0;
5969         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5970         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5971         LDKChannelMonitor monitor_var = monitor;
5972         int64_t monitor_ref = 0;
5973         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5974         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5975         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5976         CHECK(obj != NULL);
5977         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
5978         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5979                 (*env)->ExceptionDescribe(env);
5980                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
5981         }
5982         void* ret_ptr = untag_ptr(ret);
5983         CHECK_ACCESS(ret_ptr);
5984         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5985         FREE(untag_ptr(ret));
5986         if (get_jenv_res == JNI_EDETACHED) {
5987                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5988         }
5989         return ret_conv;
5990 }
5991 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5992         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5993         JNIEnv *env;
5994         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5995         if (get_jenv_res == JNI_EDETACHED) {
5996                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5997         } else {
5998                 DO_ASSERT(get_jenv_res == JNI_OK);
5999         }
6000         LDKOutPoint funding_txo_var = funding_txo;
6001         int64_t funding_txo_ref = 0;
6002         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6003         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6004         LDKChannelMonitorUpdate update_var = update;
6005         int64_t update_ref = 0;
6006         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6007         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6008         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6009         CHECK(obj != NULL);
6010         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6011         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6012                 (*env)->ExceptionDescribe(env);
6013                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6014         }
6015         void* ret_ptr = untag_ptr(ret);
6016         CHECK_ACCESS(ret_ptr);
6017         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6018         FREE(untag_ptr(ret));
6019         if (get_jenv_res == JNI_EDETACHED) {
6020                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6021         }
6022         return ret_conv;
6023 }
6024 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6025         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6026         JNIEnv *env;
6027         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6028         if (get_jenv_res == JNI_EDETACHED) {
6029                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6030         } else {
6031                 DO_ASSERT(get_jenv_res == JNI_OK);
6032         }
6033         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6034         CHECK(obj != NULL);
6035         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6036         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6037                 (*env)->ExceptionDescribe(env);
6038                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6039         }
6040         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6041         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6042         if (ret_constr.datalen > 0)
6043                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6044         else
6045                 ret_constr.data = NULL;
6046         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6047         for (size_t x = 0; x < ret_constr.datalen; x++) {
6048                 int64_t ret_conv_49 = ret_vals[x];
6049                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6050                 CHECK_ACCESS(ret_conv_49_ptr);
6051                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6052                 FREE(untag_ptr(ret_conv_49));
6053                 ret_constr.data[x] = ret_conv_49_conv;
6054         }
6055         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6056         if (get_jenv_res == JNI_EDETACHED) {
6057                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6058         }
6059         return ret_constr;
6060 }
6061 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6062         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6063         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6064 }
6065 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6066         jclass c = (*env)->GetObjectClass(env, o);
6067         CHECK(c != NULL);
6068         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6069         atomic_init(&calls->refcnt, 1);
6070         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6071         calls->o = (*env)->NewWeakGlobalRef(env, o);
6072         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6073         CHECK(calls->watch_channel_meth != NULL);
6074         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6075         CHECK(calls->update_channel_meth != NULL);
6076         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6077         CHECK(calls->release_pending_monitor_events_meth != NULL);
6078
6079         LDKWatch ret = {
6080                 .this_arg = (void*) calls,
6081                 .watch_channel = watch_channel_LDKWatch_jcall,
6082                 .update_channel = update_channel_LDKWatch_jcall,
6083                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6084                 .free = LDKWatch_JCalls_free,
6085         };
6086         return ret;
6087 }
6088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6089         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6090         *res_ptr = LDKWatch_init(env, clz, o);
6091         return tag_ptr(res_ptr, true);
6092 }
6093 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) {
6094         void* this_arg_ptr = untag_ptr(this_arg);
6095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6096         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6097         LDKOutPoint funding_txo_conv;
6098         funding_txo_conv.inner = untag_ptr(funding_txo);
6099         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6100         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6101         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6102         LDKChannelMonitor monitor_conv;
6103         monitor_conv.inner = untag_ptr(monitor);
6104         monitor_conv.is_owned = ptr_is_owned(monitor);
6105         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6106         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6107         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6108         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6109         return tag_ptr(ret_conv, true);
6110 }
6111
6112 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) {
6113         void* this_arg_ptr = untag_ptr(this_arg);
6114         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6115         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6116         LDKOutPoint funding_txo_conv;
6117         funding_txo_conv.inner = untag_ptr(funding_txo);
6118         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6119         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6120         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6121         LDKChannelMonitorUpdate update_conv;
6122         update_conv.inner = untag_ptr(update);
6123         update_conv.is_owned = ptr_is_owned(update);
6124         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6125         update_conv = ChannelMonitorUpdate_clone(&update_conv);
6126         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6127         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6128         return tag_ptr(ret_conv, true);
6129 }
6130
6131 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6132         void* this_arg_ptr = untag_ptr(this_arg);
6133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6134         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6135         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6136         int64_tArray ret_arr = NULL;
6137         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6138         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6139         for (size_t x = 0; x < ret_var.datalen; x++) {
6140                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6141                 *ret_conv_49_conv = ret_var.data[x];
6142                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6143         }
6144         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6145         FREE(ret_var.data);
6146         return ret_arr;
6147 }
6148
6149 typedef struct LDKBroadcasterInterface_JCalls {
6150         atomic_size_t refcnt;
6151         JavaVM *vm;
6152         jweak o;
6153         jmethodID broadcast_transaction_meth;
6154 } LDKBroadcasterInterface_JCalls;
6155 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6156         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6157         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6158                 JNIEnv *env;
6159                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6160                 if (get_jenv_res == JNI_EDETACHED) {
6161                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6162                 } else {
6163                         DO_ASSERT(get_jenv_res == JNI_OK);
6164                 }
6165                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6166                 if (get_jenv_res == JNI_EDETACHED) {
6167                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6168                 }
6169                 FREE(j_calls);
6170         }
6171 }
6172 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6173         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6174         JNIEnv *env;
6175         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6176         if (get_jenv_res == JNI_EDETACHED) {
6177                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6178         } else {
6179                 DO_ASSERT(get_jenv_res == JNI_OK);
6180         }
6181         LDKTransaction tx_var = tx;
6182         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
6183         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
6184         Transaction_free(tx_var);
6185         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6186         CHECK(obj != NULL);
6187         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
6188         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6189                 (*env)->ExceptionDescribe(env);
6190                 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
6191         }
6192         if (get_jenv_res == JNI_EDETACHED) {
6193                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6194         }
6195 }
6196 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6197         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6198         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6199 }
6200 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
6201         jclass c = (*env)->GetObjectClass(env, o);
6202         CHECK(c != NULL);
6203         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6204         atomic_init(&calls->refcnt, 1);
6205         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6206         calls->o = (*env)->NewWeakGlobalRef(env, o);
6207         calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
6208         CHECK(calls->broadcast_transaction_meth != NULL);
6209
6210         LDKBroadcasterInterface ret = {
6211                 .this_arg = (void*) calls,
6212                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6213                 .free = LDKBroadcasterInterface_JCalls_free,
6214         };
6215         return ret;
6216 }
6217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6218         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6219         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
6220         return tag_ptr(res_ptr, true);
6221 }
6222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
6223         void* this_arg_ptr = untag_ptr(this_arg);
6224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6225         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6226         LDKTransaction tx_ref;
6227         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
6228         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6229         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
6230         tx_ref.data_is_owned = true;
6231         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6232 }
6233
6234 typedef struct LDKKeysInterface_JCalls {
6235         atomic_size_t refcnt;
6236         JavaVM *vm;
6237         jweak o;
6238         jmethodID get_node_secret_meth;
6239         jmethodID get_destination_script_meth;
6240         jmethodID get_shutdown_scriptpubkey_meth;
6241         jmethodID get_channel_signer_meth;
6242         jmethodID get_secure_random_bytes_meth;
6243         jmethodID read_chan_signer_meth;
6244         jmethodID sign_invoice_meth;
6245         jmethodID get_inbound_payment_key_material_meth;
6246 } LDKKeysInterface_JCalls;
6247 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6248         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6249         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6250                 JNIEnv *env;
6251                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6252                 if (get_jenv_res == JNI_EDETACHED) {
6253                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6254                 } else {
6255                         DO_ASSERT(get_jenv_res == JNI_OK);
6256                 }
6257                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6258                 if (get_jenv_res == JNI_EDETACHED) {
6259                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6260                 }
6261                 FREE(j_calls);
6262         }
6263 }
6264 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
6265         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6266         JNIEnv *env;
6267         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6268         if (get_jenv_res == JNI_EDETACHED) {
6269                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6270         } else {
6271                 DO_ASSERT(get_jenv_res == JNI_OK);
6272         }
6273         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
6274         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6275         CHECK(obj != NULL);
6276         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
6277         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6278                 (*env)->ExceptionDescribe(env);
6279                 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
6280         }
6281         void* ret_ptr = untag_ptr(ret);
6282         CHECK_ACCESS(ret_ptr);
6283         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
6284         FREE(untag_ptr(ret));
6285         if (get_jenv_res == JNI_EDETACHED) {
6286                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6287         }
6288         return ret_conv;
6289 }
6290 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6291         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6292         JNIEnv *env;
6293         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6294         if (get_jenv_res == JNI_EDETACHED) {
6295                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6296         } else {
6297                 DO_ASSERT(get_jenv_res == JNI_OK);
6298         }
6299         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6300         CHECK(obj != NULL);
6301         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
6302         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6303                 (*env)->ExceptionDescribe(env);
6304                 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
6305         }
6306         LDKCVec_u8Z ret_ref;
6307         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6308         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6309         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6310         if (get_jenv_res == JNI_EDETACHED) {
6311                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6312         }
6313         return ret_ref;
6314 }
6315 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6316         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6317         JNIEnv *env;
6318         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6319         if (get_jenv_res == JNI_EDETACHED) {
6320                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6321         } else {
6322                 DO_ASSERT(get_jenv_res == JNI_OK);
6323         }
6324         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6325         CHECK(obj != NULL);
6326         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
6327         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6328                 (*env)->ExceptionDescribe(env);
6329                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
6330         }
6331         LDKShutdownScript ret_conv;
6332         ret_conv.inner = untag_ptr(ret);
6333         ret_conv.is_owned = ptr_is_owned(ret);
6334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6335         if (get_jenv_res == JNI_EDETACHED) {
6336                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6337         }
6338         return ret_conv;
6339 }
6340 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6341         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6342         JNIEnv *env;
6343         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6344         if (get_jenv_res == JNI_EDETACHED) {
6345                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6346         } else {
6347                 DO_ASSERT(get_jenv_res == JNI_OK);
6348         }
6349         jboolean inbound_conv = inbound;
6350         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6351         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6352         CHECK(obj != NULL);
6353         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
6354         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6355                 (*env)->ExceptionDescribe(env);
6356                 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
6357         }
6358         void* ret_ptr = untag_ptr(ret);
6359         CHECK_ACCESS(ret_ptr);
6360         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6361         FREE(untag_ptr(ret));
6362         if (get_jenv_res == JNI_EDETACHED) {
6363                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6364         }
6365         return ret_conv;
6366 }
6367 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6368         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6369         JNIEnv *env;
6370         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6371         if (get_jenv_res == JNI_EDETACHED) {
6372                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6373         } else {
6374                 DO_ASSERT(get_jenv_res == JNI_OK);
6375         }
6376         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6377         CHECK(obj != NULL);
6378         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
6379         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6380                 (*env)->ExceptionDescribe(env);
6381                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
6382         }
6383         LDKThirtyTwoBytes ret_ref;
6384         CHECK((*env)->GetArrayLength(env, ret) == 32);
6385         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6386         if (get_jenv_res == JNI_EDETACHED) {
6387                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6388         }
6389         return ret_ref;
6390 }
6391 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6392         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6393         JNIEnv *env;
6394         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6395         if (get_jenv_res == JNI_EDETACHED) {
6396                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6397         } else {
6398                 DO_ASSERT(get_jenv_res == JNI_OK);
6399         }
6400         LDKu8slice reader_var = reader;
6401         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
6402         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
6403         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6404         CHECK(obj != NULL);
6405         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
6406         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6407                 (*env)->ExceptionDescribe(env);
6408                 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
6409         }
6410         void* ret_ptr = untag_ptr(ret);
6411         CHECK_ACCESS(ret_ptr);
6412         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6413         FREE(untag_ptr(ret));
6414         if (get_jenv_res == JNI_EDETACHED) {
6415                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6416         }
6417         return ret_conv;
6418 }
6419 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6420         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6421         JNIEnv *env;
6422         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6423         if (get_jenv_res == JNI_EDETACHED) {
6424                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6425         } else {
6426                 DO_ASSERT(get_jenv_res == JNI_OK);
6427         }
6428         LDKu8slice hrp_bytes_var = hrp_bytes;
6429         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6430         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
6431         LDKCVec_u5Z invoice_data_var = invoice_data;
6432         jobjectArray invoice_data_arr = NULL;
6433         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
6434         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
6435         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6436                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6437                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6438         }
6439         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
6440         FREE(invoice_data_var.data);
6441         jclass receipient_conv = LDKRecipient_to_java(env, receipient);
6442         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6443         CHECK(obj != NULL);
6444         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
6445         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6446                 (*env)->ExceptionDescribe(env);
6447                 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
6448         }
6449         void* ret_ptr = untag_ptr(ret);
6450         CHECK_ACCESS(ret_ptr);
6451         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6452         FREE(untag_ptr(ret));
6453         if (get_jenv_res == JNI_EDETACHED) {
6454                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6455         }
6456         return ret_conv;
6457 }
6458 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6459         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6460         JNIEnv *env;
6461         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6462         if (get_jenv_res == JNI_EDETACHED) {
6463                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6464         } else {
6465                 DO_ASSERT(get_jenv_res == JNI_OK);
6466         }
6467         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6468         CHECK(obj != NULL);
6469         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
6470         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6471                 (*env)->ExceptionDescribe(env);
6472                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
6473         }
6474         LDKThirtyTwoBytes ret_ref;
6475         CHECK((*env)->GetArrayLength(env, ret) == 32);
6476         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6477         if (get_jenv_res == JNI_EDETACHED) {
6478                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6479         }
6480         return ret_ref;
6481 }
6482 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6483         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6484         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6485 }
6486 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6487         jclass c = (*env)->GetObjectClass(env, o);
6488         CHECK(c != NULL);
6489         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6490         atomic_init(&calls->refcnt, 1);
6491         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6492         calls->o = (*env)->NewWeakGlobalRef(env, o);
6493         calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6494         CHECK(calls->get_node_secret_meth != NULL);
6495         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6496         CHECK(calls->get_destination_script_meth != NULL);
6497         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6498         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6499         calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6500         CHECK(calls->get_channel_signer_meth != NULL);
6501         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6502         CHECK(calls->get_secure_random_bytes_meth != NULL);
6503         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6504         CHECK(calls->read_chan_signer_meth != NULL);
6505         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6506         CHECK(calls->sign_invoice_meth != NULL);
6507         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6508         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6509
6510         LDKKeysInterface ret = {
6511                 .this_arg = (void*) calls,
6512                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6513                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6514                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6515                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6516                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6517                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6518                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6519                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6520                 .free = LDKKeysInterface_JCalls_free,
6521         };
6522         return ret;
6523 }
6524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6525         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6526         *res_ptr = LDKKeysInterface_init(env, clz, o);
6527         return tag_ptr(res_ptr, true);
6528 }
6529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6530         void* this_arg_ptr = untag_ptr(this_arg);
6531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6532         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6533         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6534         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6535         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6536         return tag_ptr(ret_conv, true);
6537 }
6538
6539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6540         void* this_arg_ptr = untag_ptr(this_arg);
6541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6542         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6543         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6544         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6545         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6546         CVec_u8Z_free(ret_var);
6547         return ret_arr;
6548 }
6549
6550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6551         void* this_arg_ptr = untag_ptr(this_arg);
6552         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6553         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6554         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6555         int64_t ret_ref = 0;
6556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6558         return ret_ref;
6559 }
6560
6561 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) {
6562         void* this_arg_ptr = untag_ptr(this_arg);
6563         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6564         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6565         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6566         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6567         return tag_ptr(ret_ret, true);
6568 }
6569
6570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6571         void* this_arg_ptr = untag_ptr(this_arg);
6572         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6573         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6574         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6575         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6576         return ret_arr;
6577 }
6578
6579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6580         void* this_arg_ptr = untag_ptr(this_arg);
6581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6582         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6583         LDKu8slice reader_ref;
6584         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6585         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6586         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6587         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6588         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6589         return tag_ptr(ret_conv, true);
6590 }
6591
6592 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) {
6593         void* this_arg_ptr = untag_ptr(this_arg);
6594         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6595         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6596         LDKu8slice hrp_bytes_ref;
6597         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6598         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6599         LDKCVec_u5Z invoice_data_constr;
6600         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6601         if (invoice_data_constr.datalen > 0)
6602                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6603         else
6604                 invoice_data_constr.data = NULL;
6605         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6606         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6607                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6608                 
6609                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6610         }
6611         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6612         LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6613         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6614         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6615         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6616         return tag_ptr(ret_conv, true);
6617 }
6618
6619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6620         void* this_arg_ptr = untag_ptr(this_arg);
6621         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6622         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6623         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6624         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6625         return ret_arr;
6626 }
6627
6628 typedef struct LDKFeeEstimator_JCalls {
6629         atomic_size_t refcnt;
6630         JavaVM *vm;
6631         jweak o;
6632         jmethodID get_est_sat_per_1000_weight_meth;
6633 } LDKFeeEstimator_JCalls;
6634 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6635         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6636         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6637                 JNIEnv *env;
6638                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6639                 if (get_jenv_res == JNI_EDETACHED) {
6640                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6641                 } else {
6642                         DO_ASSERT(get_jenv_res == JNI_OK);
6643                 }
6644                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6645                 if (get_jenv_res == JNI_EDETACHED) {
6646                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6647                 }
6648                 FREE(j_calls);
6649         }
6650 }
6651 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6652         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6653         JNIEnv *env;
6654         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6655         if (get_jenv_res == JNI_EDETACHED) {
6656                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6657         } else {
6658                 DO_ASSERT(get_jenv_res == JNI_OK);
6659         }
6660         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6661         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6662         CHECK(obj != NULL);
6663         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6664         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6665                 (*env)->ExceptionDescribe(env);
6666                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6667         }
6668         if (get_jenv_res == JNI_EDETACHED) {
6669                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6670         }
6671         return ret;
6672 }
6673 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6674         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6675         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6676 }
6677 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6678         jclass c = (*env)->GetObjectClass(env, o);
6679         CHECK(c != NULL);
6680         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6681         atomic_init(&calls->refcnt, 1);
6682         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6683         calls->o = (*env)->NewWeakGlobalRef(env, o);
6684         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6685         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6686
6687         LDKFeeEstimator ret = {
6688                 .this_arg = (void*) calls,
6689                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6690                 .free = LDKFeeEstimator_JCalls_free,
6691         };
6692         return ret;
6693 }
6694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6695         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6696         *res_ptr = LDKFeeEstimator_init(env, clz, o);
6697         return tag_ptr(res_ptr, true);
6698 }
6699 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) {
6700         void* this_arg_ptr = untag_ptr(this_arg);
6701         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6702         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6703         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6704         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6705         return ret_conv;
6706 }
6707
6708 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6709         return ThirtyTwoBytes_clone(&owner->a);
6710 }
6711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6712         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6713         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6714         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6715         return ret_arr;
6716 }
6717
6718 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6719         return &owner->b;
6720 }
6721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6722         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6723         LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6724         int64_t ret_ref = 0;
6725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6726         ret_ref = tag_ptr(ret_var.inner, false);
6727         return ret_ref;
6728 }
6729
6730 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6731 CHECK(owner->result_ok);
6732         return &*owner->contents.result;
6733 }
6734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6735         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6736         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6737         return ret_ret;
6738 }
6739
6740 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6741 CHECK(!owner->result_ok);
6742         return DecodeError_clone(&*owner->contents.err);
6743 }
6744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6745         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6746         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6747         int64_t ret_ref = 0;
6748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6750         return ret_ref;
6751 }
6752
6753 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6754 CHECK(owner->result_ok);
6755         return ChannelConfig_clone(&*owner->contents.result);
6756 }
6757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6758         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6759         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6760         int64_t ret_ref = 0;
6761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6763         return ret_ref;
6764 }
6765
6766 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6767 CHECK(!owner->result_ok);
6768         return DecodeError_clone(&*owner->contents.err);
6769 }
6770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6771         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6772         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6773         int64_t ret_ref = 0;
6774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6776         return ret_ref;
6777 }
6778
6779 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6780 CHECK(owner->result_ok);
6781         return OutPoint_clone(&*owner->contents.result);
6782 }
6783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6784         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6785         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6786         int64_t ret_ref = 0;
6787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6789         return ret_ref;
6790 }
6791
6792 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6793 CHECK(!owner->result_ok);
6794         return DecodeError_clone(&*owner->contents.err);
6795 }
6796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6797         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6798         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6799         int64_t ret_ref = 0;
6800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6802         return ret_ref;
6803 }
6804
6805 typedef struct LDKType_JCalls {
6806         atomic_size_t refcnt;
6807         JavaVM *vm;
6808         jweak o;
6809         jmethodID type_id_meth;
6810         jmethodID debug_str_meth;
6811         jmethodID write_meth;
6812 } LDKType_JCalls;
6813 static void LDKType_JCalls_free(void* this_arg) {
6814         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6815         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6816                 JNIEnv *env;
6817                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6818                 if (get_jenv_res == JNI_EDETACHED) {
6819                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6820                 } else {
6821                         DO_ASSERT(get_jenv_res == JNI_OK);
6822                 }
6823                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6824                 if (get_jenv_res == JNI_EDETACHED) {
6825                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6826                 }
6827                 FREE(j_calls);
6828         }
6829 }
6830 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6831         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6832         JNIEnv *env;
6833         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6834         if (get_jenv_res == JNI_EDETACHED) {
6835                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6836         } else {
6837                 DO_ASSERT(get_jenv_res == JNI_OK);
6838         }
6839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6840         CHECK(obj != NULL);
6841         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
6842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6843                 (*env)->ExceptionDescribe(env);
6844                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
6845         }
6846         if (get_jenv_res == JNI_EDETACHED) {
6847                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6848         }
6849         return ret;
6850 }
6851 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6852         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6853         JNIEnv *env;
6854         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6855         if (get_jenv_res == JNI_EDETACHED) {
6856                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6857         } else {
6858                 DO_ASSERT(get_jenv_res == JNI_OK);
6859         }
6860         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6861         CHECK(obj != NULL);
6862         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
6863         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6864                 (*env)->ExceptionDescribe(env);
6865                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
6866         }
6867         LDKStr ret_conv = java_to_owned_str(env, ret);
6868         if (get_jenv_res == JNI_EDETACHED) {
6869                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6870         }
6871         return ret_conv;
6872 }
6873 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6874         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6875         JNIEnv *env;
6876         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6877         if (get_jenv_res == JNI_EDETACHED) {
6878                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6879         } else {
6880                 DO_ASSERT(get_jenv_res == JNI_OK);
6881         }
6882         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6883         CHECK(obj != NULL);
6884         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6885         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6886                 (*env)->ExceptionDescribe(env);
6887                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
6888         }
6889         LDKCVec_u8Z ret_ref;
6890         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6891         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6892         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6893         if (get_jenv_res == JNI_EDETACHED) {
6894                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6895         }
6896         return ret_ref;
6897 }
6898 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6899         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6900         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6901 }
6902 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
6903         jclass c = (*env)->GetObjectClass(env, o);
6904         CHECK(c != NULL);
6905         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6906         atomic_init(&calls->refcnt, 1);
6907         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6908         calls->o = (*env)->NewWeakGlobalRef(env, o);
6909         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
6910         CHECK(calls->type_id_meth != NULL);
6911         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
6912         CHECK(calls->debug_str_meth != NULL);
6913         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
6914         CHECK(calls->write_meth != NULL);
6915
6916         LDKType ret = {
6917                 .this_arg = (void*) calls,
6918                 .type_id = type_id_LDKType_jcall,
6919                 .debug_str = debug_str_LDKType_jcall,
6920                 .write = write_LDKType_jcall,
6921                 .cloned = LDKType_JCalls_cloned,
6922                 .free = LDKType_JCalls_free,
6923         };
6924         return ret;
6925 }
6926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
6927         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6928         *res_ptr = LDKType_init(env, clz, o);
6929         return tag_ptr(res_ptr, true);
6930 }
6931 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
6932         void* this_arg_ptr = untag_ptr(this_arg);
6933         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6934         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6935         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6936         return ret_conv;
6937 }
6938
6939 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
6940         void* this_arg_ptr = untag_ptr(this_arg);
6941         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6942         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6943         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6944         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6945         Str_free(ret_str);
6946         return ret_conv;
6947 }
6948
6949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
6950         void* this_arg_ptr = untag_ptr(this_arg);
6951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6952         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6953         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6954         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6955         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6956         CVec_u8Z_free(ret_var);
6957         return ret_arr;
6958 }
6959
6960 static jclass LDKCOption_TypeZ_Some_class = NULL;
6961 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
6962 static jclass LDKCOption_TypeZ_None_class = NULL;
6963 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
6964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
6965         LDKCOption_TypeZ_Some_class =
6966                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
6967         CHECK(LDKCOption_TypeZ_Some_class != NULL);
6968         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
6969         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
6970         LDKCOption_TypeZ_None_class =
6971                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
6972         CHECK(LDKCOption_TypeZ_None_class != NULL);
6973         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
6974         CHECK(LDKCOption_TypeZ_None_meth != NULL);
6975 }
6976 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6977         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
6978         switch(obj->tag) {
6979                 case LDKCOption_TypeZ_Some: {
6980                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6981                         *some_ret = Type_clone(&obj->some);
6982                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
6983                 }
6984                 case LDKCOption_TypeZ_None: {
6985                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
6986                 }
6987                 default: abort();
6988         }
6989 }
6990 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6991 CHECK(owner->result_ok);
6992         return COption_TypeZ_clone(&*owner->contents.result);
6993 }
6994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6995         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
6996         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6997         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6998         int64_t ret_ref = tag_ptr(ret_copy, true);
6999         return ret_ref;
7000 }
7001
7002 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7003 CHECK(!owner->result_ok);
7004         return DecodeError_clone(&*owner->contents.err);
7005 }
7006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7007         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7008         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7009         int64_t ret_ref = 0;
7010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7012         return ret_ref;
7013 }
7014
7015 static jclass LDKPaymentError_Invoice_class = NULL;
7016 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7017 static jclass LDKPaymentError_Routing_class = NULL;
7018 static jmethodID LDKPaymentError_Routing_meth = NULL;
7019 static jclass LDKPaymentError_Sending_class = NULL;
7020 static jmethodID LDKPaymentError_Sending_meth = NULL;
7021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7022         LDKPaymentError_Invoice_class =
7023                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7024         CHECK(LDKPaymentError_Invoice_class != NULL);
7025         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7026         CHECK(LDKPaymentError_Invoice_meth != NULL);
7027         LDKPaymentError_Routing_class =
7028                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7029         CHECK(LDKPaymentError_Routing_class != NULL);
7030         LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7031         CHECK(LDKPaymentError_Routing_meth != NULL);
7032         LDKPaymentError_Sending_class =
7033                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7034         CHECK(LDKPaymentError_Sending_class != NULL);
7035         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7036         CHECK(LDKPaymentError_Sending_meth != NULL);
7037 }
7038 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7039         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7040         switch(obj->tag) {
7041                 case LDKPaymentError_Invoice: {
7042                         LDKStr invoice_str = obj->invoice;
7043                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7044                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7045                 }
7046                 case LDKPaymentError_Routing: {
7047                         LDKLightningError routing_var = obj->routing;
7048                         int64_t routing_ref = 0;
7049                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7050                         routing_ref = tag_ptr(routing_var.inner, false);
7051                         return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7052                 }
7053                 case LDKPaymentError_Sending: {
7054                         int64_t sending_ref = tag_ptr(&obj->sending, false);
7055                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7056                 }
7057                 default: abort();
7058         }
7059 }
7060 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7061 CHECK(owner->result_ok);
7062         return ThirtyTwoBytes_clone(&*owner->contents.result);
7063 }
7064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7065         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7066         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7067         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7068         return ret_arr;
7069 }
7070
7071 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7072 CHECK(!owner->result_ok);
7073         return PaymentError_clone(&*owner->contents.err);
7074 }
7075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7076         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7077         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7078         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7079         int64_t ret_ref = tag_ptr(ret_copy, true);
7080         return ret_ref;
7081 }
7082
7083 static jclass LDKParseError_Bech32Error_class = NULL;
7084 static jmethodID LDKParseError_Bech32Error_meth = NULL;
7085 static jclass LDKParseError_ParseAmountError_class = NULL;
7086 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
7087 static jclass LDKParseError_MalformedSignature_class = NULL;
7088 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
7089 static jclass LDKParseError_BadPrefix_class = NULL;
7090 static jmethodID LDKParseError_BadPrefix_meth = NULL;
7091 static jclass LDKParseError_UnknownCurrency_class = NULL;
7092 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
7093 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
7094 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
7095 static jclass LDKParseError_MalformedHRP_class = NULL;
7096 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
7097 static jclass LDKParseError_TooShortDataPart_class = NULL;
7098 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
7099 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
7100 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
7101 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
7102 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
7103 static jclass LDKParseError_PaddingError_class = NULL;
7104 static jmethodID LDKParseError_PaddingError_meth = NULL;
7105 static jclass LDKParseError_IntegerOverflowError_class = NULL;
7106 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
7107 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
7108 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
7109 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
7110 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
7111 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
7112 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
7113 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
7114 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
7115 static jclass LDKParseError_InvalidSliceLength_class = NULL;
7116 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
7117 static jclass LDKParseError_Skip_class = NULL;
7118 static jmethodID LDKParseError_Skip_meth = NULL;
7119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
7120         LDKParseError_Bech32Error_class =
7121                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
7122         CHECK(LDKParseError_Bech32Error_class != NULL);
7123         LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
7124         CHECK(LDKParseError_Bech32Error_meth != NULL);
7125         LDKParseError_ParseAmountError_class =
7126                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
7127         CHECK(LDKParseError_ParseAmountError_class != NULL);
7128         LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
7129         CHECK(LDKParseError_ParseAmountError_meth != NULL);
7130         LDKParseError_MalformedSignature_class =
7131                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
7132         CHECK(LDKParseError_MalformedSignature_class != NULL);
7133         LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
7134         CHECK(LDKParseError_MalformedSignature_meth != NULL);
7135         LDKParseError_BadPrefix_class =
7136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
7137         CHECK(LDKParseError_BadPrefix_class != NULL);
7138         LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
7139         CHECK(LDKParseError_BadPrefix_meth != NULL);
7140         LDKParseError_UnknownCurrency_class =
7141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
7142         CHECK(LDKParseError_UnknownCurrency_class != NULL);
7143         LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
7144         CHECK(LDKParseError_UnknownCurrency_meth != NULL);
7145         LDKParseError_UnknownSiPrefix_class =
7146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
7147         CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
7148         LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
7149         CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
7150         LDKParseError_MalformedHRP_class =
7151                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
7152         CHECK(LDKParseError_MalformedHRP_class != NULL);
7153         LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
7154         CHECK(LDKParseError_MalformedHRP_meth != NULL);
7155         LDKParseError_TooShortDataPart_class =
7156                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
7157         CHECK(LDKParseError_TooShortDataPart_class != NULL);
7158         LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
7159         CHECK(LDKParseError_TooShortDataPart_meth != NULL);
7160         LDKParseError_UnexpectedEndOfTaggedFields_class =
7161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
7162         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
7163         LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
7164         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
7165         LDKParseError_DescriptionDecodeError_class =
7166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
7167         CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
7168         LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
7169         CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
7170         LDKParseError_PaddingError_class =
7171                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
7172         CHECK(LDKParseError_PaddingError_class != NULL);
7173         LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
7174         CHECK(LDKParseError_PaddingError_meth != NULL);
7175         LDKParseError_IntegerOverflowError_class =
7176                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
7177         CHECK(LDKParseError_IntegerOverflowError_class != NULL);
7178         LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
7179         CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
7180         LDKParseError_InvalidSegWitProgramLength_class =
7181                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
7182         CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
7183         LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
7184         CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
7185         LDKParseError_InvalidPubKeyHashLength_class =
7186                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
7187         CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
7188         LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
7189         CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
7190         LDKParseError_InvalidScriptHashLength_class =
7191                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
7192         CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
7193         LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
7194         CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
7195         LDKParseError_InvalidRecoveryId_class =
7196                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
7197         CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
7198         LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
7199         CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
7200         LDKParseError_InvalidSliceLength_class =
7201                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
7202         CHECK(LDKParseError_InvalidSliceLength_class != NULL);
7203         LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
7204         CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
7205         LDKParseError_Skip_class =
7206                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
7207         CHECK(LDKParseError_Skip_class != NULL);
7208         LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
7209         CHECK(LDKParseError_Skip_meth != NULL);
7210 }
7211 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7212         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7213         switch(obj->tag) {
7214                 case LDKParseError_Bech32Error: {
7215                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
7216                         return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
7217                 }
7218                 case LDKParseError_ParseAmountError: {
7219                         /*obj->parse_amount_error*/
7220                         return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
7221                 }
7222                 case LDKParseError_MalformedSignature: {
7223                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
7224                         return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
7225                 }
7226                 case LDKParseError_BadPrefix: {
7227                         return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
7228                 }
7229                 case LDKParseError_UnknownCurrency: {
7230                         return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
7231                 }
7232                 case LDKParseError_UnknownSiPrefix: {
7233                         return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
7234                 }
7235                 case LDKParseError_MalformedHRP: {
7236                         return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
7237                 }
7238                 case LDKParseError_TooShortDataPart: {
7239                         return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
7240                 }
7241                 case LDKParseError_UnexpectedEndOfTaggedFields: {
7242                         return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
7243                 }
7244                 case LDKParseError_DescriptionDecodeError: {
7245                         /*obj->description_decode_error*/
7246                         return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
7247                 }
7248                 case LDKParseError_PaddingError: {
7249                         return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
7250                 }
7251                 case LDKParseError_IntegerOverflowError: {
7252                         return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
7253                 }
7254                 case LDKParseError_InvalidSegWitProgramLength: {
7255                         return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
7256                 }
7257                 case LDKParseError_InvalidPubKeyHashLength: {
7258                         return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
7259                 }
7260                 case LDKParseError_InvalidScriptHashLength: {
7261                         return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
7262                 }
7263                 case LDKParseError_InvalidRecoveryId: {
7264                         return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
7265                 }
7266                 case LDKParseError_InvalidSliceLength: {
7267                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7268                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
7269                         return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
7270                 }
7271                 case LDKParseError_Skip: {
7272                         return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
7273                 }
7274                 default: abort();
7275         }
7276 }
7277 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7278 CHECK(owner->result_ok);
7279         return SiPrefix_clone(&*owner->contents.result);
7280 }
7281 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7282         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7283         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7284         return ret_conv;
7285 }
7286
7287 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7288 CHECK(!owner->result_ok);
7289         return ParseError_clone(&*owner->contents.err);
7290 }
7291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7292         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7293         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7294         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7295         int64_t ret_ref = tag_ptr(ret_copy, true);
7296         return ret_ref;
7297 }
7298
7299 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7300 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7301 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7302 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7304         LDKParseOrSemanticError_ParseError_class =
7305                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7306         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7307         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7308         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7309         LDKParseOrSemanticError_SemanticError_class =
7310                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7311         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7312         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7313         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7314 }
7315 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7316         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7317         switch(obj->tag) {
7318                 case LDKParseOrSemanticError_ParseError: {
7319                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
7320                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7321                 }
7322                 case LDKParseOrSemanticError_SemanticError: {
7323                         jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7324                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7325                 }
7326                 default: abort();
7327         }
7328 }
7329 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7330 CHECK(owner->result_ok);
7331         return Invoice_clone(&*owner->contents.result);
7332 }
7333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7334         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7335         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7336         int64_t ret_ref = 0;
7337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7339         return ret_ref;
7340 }
7341
7342 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7343 CHECK(!owner->result_ok);
7344         return ParseOrSemanticError_clone(&*owner->contents.err);
7345 }
7346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7347         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7348         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7349         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7350         int64_t ret_ref = tag_ptr(ret_copy, true);
7351         return ret_ref;
7352 }
7353
7354 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7355 CHECK(owner->result_ok);
7356         return SignedRawInvoice_clone(&*owner->contents.result);
7357 }
7358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7359         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7360         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7361         int64_t ret_ref = 0;
7362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7364         return ret_ref;
7365 }
7366
7367 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7368 CHECK(!owner->result_ok);
7369         return ParseError_clone(&*owner->contents.err);
7370 }
7371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7372         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7373         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7374         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7375         int64_t ret_ref = tag_ptr(ret_copy, true);
7376         return ret_ref;
7377 }
7378
7379 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7380         return RawInvoice_clone(&owner->a);
7381 }
7382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7383         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7384         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7385         int64_t ret_ref = 0;
7386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7388         return ret_ref;
7389 }
7390
7391 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7392         return ThirtyTwoBytes_clone(&owner->b);
7393 }
7394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7395         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7396         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7397         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
7398         return ret_arr;
7399 }
7400
7401 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7402         return InvoiceSignature_clone(&owner->c);
7403 }
7404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7405         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7406         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7407         int64_t ret_ref = 0;
7408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7410         return ret_ref;
7411 }
7412
7413 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7414 CHECK(owner->result_ok);
7415         return PayeePubKey_clone(&*owner->contents.result);
7416 }
7417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7418         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7419         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7420         int64_t ret_ref = 0;
7421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7423         return ret_ref;
7424 }
7425
7426 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7427 CHECK(!owner->result_ok);
7428         return *owner->contents.err;
7429 }
7430 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7431         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7432         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7433         return ret_conv;
7434 }
7435
7436 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7437         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7438         for (size_t i = 0; i < ret.datalen; i++) {
7439                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7440         }
7441         return ret;
7442 }
7443 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7444 CHECK(owner->result_ok);
7445         return PositiveTimestamp_clone(&*owner->contents.result);
7446 }
7447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7448         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7449         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7450         int64_t ret_ref = 0;
7451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7453         return ret_ref;
7454 }
7455
7456 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7457 CHECK(!owner->result_ok);
7458         return CreationError_clone(&*owner->contents.err);
7459 }
7460 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7461         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7462         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7463         return ret_conv;
7464 }
7465
7466 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7467 CHECK(owner->result_ok);
7468         return *owner->contents.result;
7469 }
7470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7471         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7472         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7473 }
7474
7475 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7476 CHECK(!owner->result_ok);
7477         return SemanticError_clone(&*owner->contents.err);
7478 }
7479 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7480         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7481         jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
7482         return ret_conv;
7483 }
7484
7485 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7486 CHECK(owner->result_ok);
7487         return Invoice_clone(&*owner->contents.result);
7488 }
7489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7490         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7491         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7492         int64_t ret_ref = 0;
7493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7495         return ret_ref;
7496 }
7497
7498 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7499 CHECK(!owner->result_ok);
7500         return SemanticError_clone(&*owner->contents.err);
7501 }
7502 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7503         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7504         jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7505         return ret_conv;
7506 }
7507
7508 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7509 CHECK(owner->result_ok);
7510         return Description_clone(&*owner->contents.result);
7511 }
7512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7513         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7514         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7515         int64_t ret_ref = 0;
7516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7518         return ret_ref;
7519 }
7520
7521 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7522 CHECK(!owner->result_ok);
7523         return CreationError_clone(&*owner->contents.err);
7524 }
7525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7526         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7527         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7528         return ret_conv;
7529 }
7530
7531 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7532 CHECK(owner->result_ok);
7533         return PrivateRoute_clone(&*owner->contents.result);
7534 }
7535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7536         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7537         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7538         int64_t ret_ref = 0;
7539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7541         return ret_ref;
7542 }
7543
7544 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7545 CHECK(!owner->result_ok);
7546         return CreationError_clone(&*owner->contents.err);
7547 }
7548 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7549         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7550         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7551         return ret_conv;
7552 }
7553
7554 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7555 CHECK(owner->result_ok);
7556         return *owner->contents.result;
7557 }
7558 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7559         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7560         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7561         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7562         return ret_conv;
7563 }
7564
7565 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7566 CHECK(!owner->result_ok);
7567         return *owner->contents.err;
7568 }
7569 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7570         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7571         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
7572         return ret_conv;
7573 }
7574
7575 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7576 CHECK(owner->result_ok);
7577         return ChannelMonitorUpdate_clone(&*owner->contents.result);
7578 }
7579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7580         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7581         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7582         int64_t ret_ref = 0;
7583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7585         return ret_ref;
7586 }
7587
7588 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7589 CHECK(!owner->result_ok);
7590         return DecodeError_clone(&*owner->contents.err);
7591 }
7592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7593         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7594         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7595         int64_t ret_ref = 0;
7596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7598         return ret_ref;
7599 }
7600
7601 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
7602 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
7603 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
7604 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
7605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
7606         LDKCOption_MonitorEventZ_Some_class =
7607                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
7608         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7609         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7610         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7611         LDKCOption_MonitorEventZ_None_class =
7612                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7613         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7614         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7615         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7616 }
7617 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7618         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7619         switch(obj->tag) {
7620                 case LDKCOption_MonitorEventZ_Some: {
7621                         int64_t some_ref = tag_ptr(&obj->some, false);
7622                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7623                 }
7624                 case LDKCOption_MonitorEventZ_None: {
7625                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7626                 }
7627                 default: abort();
7628         }
7629 }
7630 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7631 CHECK(owner->result_ok);
7632         return COption_MonitorEventZ_clone(&*owner->contents.result);
7633 }
7634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7635         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7636         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7637         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7638         int64_t ret_ref = tag_ptr(ret_copy, true);
7639         return ret_ref;
7640 }
7641
7642 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7643 CHECK(!owner->result_ok);
7644         return DecodeError_clone(&*owner->contents.err);
7645 }
7646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7647         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7648         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7649         int64_t ret_ref = 0;
7650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7652         return ret_ref;
7653 }
7654
7655 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7656 CHECK(owner->result_ok);
7657         return HTLCUpdate_clone(&*owner->contents.result);
7658 }
7659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7660         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7661         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7662         int64_t ret_ref = 0;
7663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7665         return ret_ref;
7666 }
7667
7668 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7669 CHECK(!owner->result_ok);
7670         return DecodeError_clone(&*owner->contents.err);
7671 }
7672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7673         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7674         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7675         int64_t ret_ref = 0;
7676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7678         return ret_ref;
7679 }
7680
7681 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7682         return OutPoint_clone(&owner->a);
7683 }
7684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7685         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7686         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7687         int64_t ret_ref = 0;
7688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7690         return ret_ref;
7691 }
7692
7693 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7694         return CVec_u8Z_clone(&owner->b);
7695 }
7696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7697         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7698         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7699         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7700         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7701         CVec_u8Z_free(ret_var);
7702         return ret_arr;
7703 }
7704
7705 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7706         return owner->a;
7707 }
7708 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7709         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7710         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
7711         return ret_conv;
7712 }
7713
7714 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7715         return CVec_u8Z_clone(&owner->b);
7716 }
7717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7718         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7719         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7720         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7721         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7722         CVec_u8Z_free(ret_var);
7723         return ret_arr;
7724 }
7725
7726 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7727         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7728         for (size_t i = 0; i < ret.datalen; i++) {
7729                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7730         }
7731         return ret;
7732 }
7733 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7734         return ThirtyTwoBytes_clone(&owner->a);
7735 }
7736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7737         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7738         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7739         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
7740         return ret_arr;
7741 }
7742
7743 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7744         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7745 }
7746 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7747         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7748         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7749         int64_tArray ret_arr = NULL;
7750         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7751         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7752         for (size_t v = 0; v < ret_var.datalen; v++) {
7753                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7754                 *ret_conv_21_conv = ret_var.data[v];
7755                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
7756         }
7757         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7758         FREE(ret_var.data);
7759         return ret_arr;
7760 }
7761
7762 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
7763         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 };
7764         for (size_t i = 0; i < ret.datalen; i++) {
7765                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
7766         }
7767         return ret;
7768 }
7769 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
7770         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
7771         for (size_t i = 0; i < ret.datalen; i++) {
7772                 ret.data[i] = Event_clone(&orig->data[i]);
7773         }
7774         return ret;
7775 }
7776 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7777         return owner->a;
7778 }
7779 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7780         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7781         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7782         return ret_conv;
7783 }
7784
7785 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7786         return TxOut_clone(&owner->b);
7787 }
7788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7789         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7790         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7791         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7792         return tag_ptr(ret_ref, true);
7793 }
7794
7795 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7796         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7797         for (size_t i = 0; i < ret.datalen; i++) {
7798                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7799         }
7800         return ret;
7801 }
7802 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7803         return ThirtyTwoBytes_clone(&owner->a);
7804 }
7805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7806         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7807         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
7809         return ret_arr;
7810 }
7811
7812 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7813         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7814 }
7815 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7816         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7817         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7818         int64_tArray ret_arr = NULL;
7819         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7820         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7821         for (size_t u = 0; u < ret_var.datalen; u++) {
7822                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7823                 *ret_conv_20_conv = ret_var.data[u];
7824                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7825         }
7826         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7827         FREE(ret_var.data);
7828         return ret_arr;
7829 }
7830
7831 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
7832         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 };
7833         for (size_t i = 0; i < ret.datalen; i++) {
7834                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7835         }
7836         return ret;
7837 }
7838 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
7839 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
7840 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
7841 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
7842 static jclass LDKBalance_ContentiousClaimable_class = NULL;
7843 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
7844 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
7845 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
7846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
7847         LDKBalance_ClaimableOnChannelClose_class =
7848                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
7849         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
7850         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
7851         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
7852         LDKBalance_ClaimableAwaitingConfirmations_class =
7853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
7854         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
7855         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
7856         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
7857         LDKBalance_ContentiousClaimable_class =
7858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
7859         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
7860         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
7861         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
7862         LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
7863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
7864         CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
7865         LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
7866         CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
7867 }
7868 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7869         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7870         switch(obj->tag) {
7871                 case LDKBalance_ClaimableOnChannelClose: {
7872                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
7873                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
7874                 }
7875                 case LDKBalance_ClaimableAwaitingConfirmations: {
7876                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
7877                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7878                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
7879                 }
7880                 case LDKBalance_ContentiousClaimable: {
7881                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
7882                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7883                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
7884                 }
7885                 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
7886                         int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
7887                         int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
7888                         return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
7889                 }
7890                 default: abort();
7891         }
7892 }
7893 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7894         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7895         for (size_t i = 0; i < ret.datalen; i++) {
7896                 ret.data[i] = Balance_clone(&orig->data[i]);
7897         }
7898         return ret;
7899 }
7900 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7901 CHECK(owner->result_ok);
7902         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
7903 }
7904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7905         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7906         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7907         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7908         return tag_ptr(ret_conv, true);
7909 }
7910
7911 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7912 CHECK(!owner->result_ok);
7913         return DecodeError_clone(&*owner->contents.err);
7914 }
7915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7916         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
7917         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7918         int64_t ret_ref = 0;
7919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7921         return ret_ref;
7922 }
7923
7924 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7925         return owner->a;
7926 }
7927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7928         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7929         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7930         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
7931         return ret_arr;
7932 }
7933
7934 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7935         return Type_clone(&owner->b);
7936 }
7937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7938         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
7939         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7940         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7941         return tag_ptr(ret_ret, true);
7942 }
7943
7944 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7945         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7946         for (size_t i = 0; i < ret.datalen; i++) {
7947                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7948         }
7949         return ret;
7950 }
7951 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
7952 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
7953 static jclass LDKCOption_NetAddressZ_None_class = NULL;
7954 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
7955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
7956         LDKCOption_NetAddressZ_Some_class =
7957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
7958         CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
7959         LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
7960         CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
7961         LDKCOption_NetAddressZ_None_class =
7962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
7963         CHECK(LDKCOption_NetAddressZ_None_class != NULL);
7964         LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
7965         CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
7966 }
7967 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7968         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
7969         switch(obj->tag) {
7970                 case LDKCOption_NetAddressZ_Some: {
7971                         int64_t some_ref = tag_ptr(&obj->some, false);
7972                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
7973                 }
7974                 case LDKCOption_NetAddressZ_None: {
7975                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
7976                 }
7977                 default: abort();
7978         }
7979 }
7980 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7981 CHECK(owner->result_ok);
7982         return CVec_u8Z_clone(&*owner->contents.result);
7983 }
7984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7985         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7986         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7987         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7988         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7989         CVec_u8Z_free(ret_var);
7990         return ret_arr;
7991 }
7992
7993 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7994 CHECK(!owner->result_ok);
7995         return PeerHandleError_clone(&*owner->contents.err);
7996 }
7997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7998         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
7999         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8000         int64_t ret_ref = 0;
8001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8003         return ret_ref;
8004 }
8005
8006 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8007 CHECK(owner->result_ok);
8008         return *owner->contents.result;
8009 }
8010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8011         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8012         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8013 }
8014
8015 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8016 CHECK(!owner->result_ok);
8017         return PeerHandleError_clone(&*owner->contents.err);
8018 }
8019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8020         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8021         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8022         int64_t ret_ref = 0;
8023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8025         return ret_ref;
8026 }
8027
8028 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8029 CHECK(owner->result_ok);
8030         return *owner->contents.result;
8031 }
8032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8033         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8034         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8035         return ret_conv;
8036 }
8037
8038 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8039 CHECK(!owner->result_ok);
8040         return PeerHandleError_clone(&*owner->contents.err);
8041 }
8042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8043         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8044         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8045         int64_t ret_ref = 0;
8046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8048         return ret_ref;
8049 }
8050
8051 static jclass LDKGraphSyncError_DecodeError_class = NULL;
8052 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
8053 static jclass LDKGraphSyncError_LightningError_class = NULL;
8054 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
8055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
8056         LDKGraphSyncError_DecodeError_class =
8057                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
8058         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
8059         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
8060         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
8061         LDKGraphSyncError_LightningError_class =
8062                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
8063         CHECK(LDKGraphSyncError_LightningError_class != NULL);
8064         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
8065         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
8066 }
8067 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8068         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8069         switch(obj->tag) {
8070                 case LDKGraphSyncError_DecodeError: {
8071                         LDKDecodeError decode_error_var = obj->decode_error;
8072                         int64_t decode_error_ref = 0;
8073                         CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
8074                         decode_error_ref = tag_ptr(decode_error_var.inner, false);
8075                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
8076                 }
8077                 case LDKGraphSyncError_LightningError: {
8078                         LDKLightningError lightning_error_var = obj->lightning_error;
8079                         int64_t lightning_error_ref = 0;
8080                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8081                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8082                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
8083                 }
8084                 default: abort();
8085         }
8086 }
8087 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8088 CHECK(owner->result_ok);
8089         return *owner->contents.result;
8090 }
8091 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8092         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8093         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8094         return ret_conv;
8095 }
8096
8097 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8098 CHECK(!owner->result_ok);
8099         return GraphSyncError_clone(&*owner->contents.err);
8100 }
8101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8102         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8103         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8104         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8105         int64_t ret_ref = tag_ptr(ret_copy, true);
8106         return ret_ref;
8107 }
8108
8109 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8110 CHECK(owner->result_ok);
8111         return NetAddress_clone(&*owner->contents.result);
8112 }
8113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8114         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8115         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8116         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8117         int64_t ret_ref = tag_ptr(ret_copy, true);
8118         return ret_ref;
8119 }
8120
8121 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8122 CHECK(!owner->result_ok);
8123         return DecodeError_clone(&*owner->contents.err);
8124 }
8125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8126         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8127         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8128         int64_t ret_ref = 0;
8129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8131         return ret_ref;
8132 }
8133
8134 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8135         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8136         for (size_t i = 0; i < ret.datalen; i++) {
8137                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8138         }
8139         return ret;
8140 }
8141 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8142         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8143         for (size_t i = 0; i < ret.datalen; i++) {
8144                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8145         }
8146         return ret;
8147 }
8148 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8149         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8150         for (size_t i = 0; i < ret.datalen; i++) {
8151                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8152         }
8153         return ret;
8154 }
8155 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8156         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8157         for (size_t i = 0; i < ret.datalen; i++) {
8158                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8159         }
8160         return ret;
8161 }
8162 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8163 CHECK(owner->result_ok);
8164         return AcceptChannel_clone(&*owner->contents.result);
8165 }
8166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8167         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8168         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8169         int64_t ret_ref = 0;
8170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8172         return ret_ref;
8173 }
8174
8175 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8176 CHECK(!owner->result_ok);
8177         return DecodeError_clone(&*owner->contents.err);
8178 }
8179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8180         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8181         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8182         int64_t ret_ref = 0;
8183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8185         return ret_ref;
8186 }
8187
8188 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8189 CHECK(owner->result_ok);
8190         return AnnouncementSignatures_clone(&*owner->contents.result);
8191 }
8192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8193         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8194         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8195         int64_t ret_ref = 0;
8196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8198         return ret_ref;
8199 }
8200
8201 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8202 CHECK(!owner->result_ok);
8203         return DecodeError_clone(&*owner->contents.err);
8204 }
8205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8206         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8207         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8208         int64_t ret_ref = 0;
8209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8211         return ret_ref;
8212 }
8213
8214 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8215 CHECK(owner->result_ok);
8216         return ChannelReestablish_clone(&*owner->contents.result);
8217 }
8218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8219         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8220         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8221         int64_t ret_ref = 0;
8222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8224         return ret_ref;
8225 }
8226
8227 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8228 CHECK(!owner->result_ok);
8229         return DecodeError_clone(&*owner->contents.err);
8230 }
8231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8232         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8233         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8234         int64_t ret_ref = 0;
8235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8237         return ret_ref;
8238 }
8239
8240 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8241 CHECK(owner->result_ok);
8242         return ClosingSigned_clone(&*owner->contents.result);
8243 }
8244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8245         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8246         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8247         int64_t ret_ref = 0;
8248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8250         return ret_ref;
8251 }
8252
8253 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8254 CHECK(!owner->result_ok);
8255         return DecodeError_clone(&*owner->contents.err);
8256 }
8257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8258         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8259         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8260         int64_t ret_ref = 0;
8261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8263         return ret_ref;
8264 }
8265
8266 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8267 CHECK(owner->result_ok);
8268         return ClosingSignedFeeRange_clone(&*owner->contents.result);
8269 }
8270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8271         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8272         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8273         int64_t ret_ref = 0;
8274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8276         return ret_ref;
8277 }
8278
8279 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8280 CHECK(!owner->result_ok);
8281         return DecodeError_clone(&*owner->contents.err);
8282 }
8283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8284         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8285         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8286         int64_t ret_ref = 0;
8287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8289         return ret_ref;
8290 }
8291
8292 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8293 CHECK(owner->result_ok);
8294         return CommitmentSigned_clone(&*owner->contents.result);
8295 }
8296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8297         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8298         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8299         int64_t ret_ref = 0;
8300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8302         return ret_ref;
8303 }
8304
8305 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8306 CHECK(!owner->result_ok);
8307         return DecodeError_clone(&*owner->contents.err);
8308 }
8309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8310         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8311         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8312         int64_t ret_ref = 0;
8313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8315         return ret_ref;
8316 }
8317
8318 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8319 CHECK(owner->result_ok);
8320         return FundingCreated_clone(&*owner->contents.result);
8321 }
8322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8323         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8324         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8325         int64_t ret_ref = 0;
8326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8328         return ret_ref;
8329 }
8330
8331 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8332 CHECK(!owner->result_ok);
8333         return DecodeError_clone(&*owner->contents.err);
8334 }
8335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8336         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8337         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8338         int64_t ret_ref = 0;
8339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8341         return ret_ref;
8342 }
8343
8344 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8345 CHECK(owner->result_ok);
8346         return FundingSigned_clone(&*owner->contents.result);
8347 }
8348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8349         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8350         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8351         int64_t ret_ref = 0;
8352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8354         return ret_ref;
8355 }
8356
8357 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8358 CHECK(!owner->result_ok);
8359         return DecodeError_clone(&*owner->contents.err);
8360 }
8361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8362         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8363         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8364         int64_t ret_ref = 0;
8365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8367         return ret_ref;
8368 }
8369
8370 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8371 CHECK(owner->result_ok);
8372         return ChannelReady_clone(&*owner->contents.result);
8373 }
8374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8375         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8376         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8377         int64_t ret_ref = 0;
8378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8380         return ret_ref;
8381 }
8382
8383 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8384 CHECK(!owner->result_ok);
8385         return DecodeError_clone(&*owner->contents.err);
8386 }
8387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8388         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8389         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8390         int64_t ret_ref = 0;
8391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8393         return ret_ref;
8394 }
8395
8396 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8397 CHECK(owner->result_ok);
8398         return Init_clone(&*owner->contents.result);
8399 }
8400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8401         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8402         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8403         int64_t ret_ref = 0;
8404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8406         return ret_ref;
8407 }
8408
8409 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8410 CHECK(!owner->result_ok);
8411         return DecodeError_clone(&*owner->contents.err);
8412 }
8413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8414         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8415         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
8416         int64_t ret_ref = 0;
8417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8419         return ret_ref;
8420 }
8421
8422 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8423 CHECK(owner->result_ok);
8424         return OpenChannel_clone(&*owner->contents.result);
8425 }
8426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8427         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8428         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8429         int64_t ret_ref = 0;
8430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8432         return ret_ref;
8433 }
8434
8435 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8436 CHECK(!owner->result_ok);
8437         return DecodeError_clone(&*owner->contents.err);
8438 }
8439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8440         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8441         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8442         int64_t ret_ref = 0;
8443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8445         return ret_ref;
8446 }
8447
8448 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8449 CHECK(owner->result_ok);
8450         return RevokeAndACK_clone(&*owner->contents.result);
8451 }
8452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8453         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8454         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8455         int64_t ret_ref = 0;
8456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8458         return ret_ref;
8459 }
8460
8461 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8462 CHECK(!owner->result_ok);
8463         return DecodeError_clone(&*owner->contents.err);
8464 }
8465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8466         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8467         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8468         int64_t ret_ref = 0;
8469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8471         return ret_ref;
8472 }
8473
8474 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8475 CHECK(owner->result_ok);
8476         return Shutdown_clone(&*owner->contents.result);
8477 }
8478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8479         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8480         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8481         int64_t ret_ref = 0;
8482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8484         return ret_ref;
8485 }
8486
8487 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8488 CHECK(!owner->result_ok);
8489         return DecodeError_clone(&*owner->contents.err);
8490 }
8491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8492         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8493         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8494         int64_t ret_ref = 0;
8495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8497         return ret_ref;
8498 }
8499
8500 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8501 CHECK(owner->result_ok);
8502         return UpdateFailHTLC_clone(&*owner->contents.result);
8503 }
8504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8505         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8506         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8507         int64_t ret_ref = 0;
8508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8510         return ret_ref;
8511 }
8512
8513 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8514 CHECK(!owner->result_ok);
8515         return DecodeError_clone(&*owner->contents.err);
8516 }
8517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8518         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8519         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8520         int64_t ret_ref = 0;
8521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8523         return ret_ref;
8524 }
8525
8526 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8527 CHECK(owner->result_ok);
8528         return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
8529 }
8530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8531         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8532         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8533         int64_t ret_ref = 0;
8534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8536         return ret_ref;
8537 }
8538
8539 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8540 CHECK(!owner->result_ok);
8541         return DecodeError_clone(&*owner->contents.err);
8542 }
8543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8544         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8545         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8546         int64_t ret_ref = 0;
8547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8549         return ret_ref;
8550 }
8551
8552 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8553 CHECK(owner->result_ok);
8554         return UpdateFee_clone(&*owner->contents.result);
8555 }
8556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8557         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8558         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8559         int64_t ret_ref = 0;
8560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8562         return ret_ref;
8563 }
8564
8565 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8566 CHECK(!owner->result_ok);
8567         return DecodeError_clone(&*owner->contents.err);
8568 }
8569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8570         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8571         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8572         int64_t ret_ref = 0;
8573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8575         return ret_ref;
8576 }
8577
8578 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8579 CHECK(owner->result_ok);
8580         return UpdateFulfillHTLC_clone(&*owner->contents.result);
8581 }
8582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8583         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8584         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8585         int64_t ret_ref = 0;
8586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8588         return ret_ref;
8589 }
8590
8591 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8592 CHECK(!owner->result_ok);
8593         return DecodeError_clone(&*owner->contents.err);
8594 }
8595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8596         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8597         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8598         int64_t ret_ref = 0;
8599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8601         return ret_ref;
8602 }
8603
8604 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8605 CHECK(owner->result_ok);
8606         return UpdateAddHTLC_clone(&*owner->contents.result);
8607 }
8608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8609         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8610         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8611         int64_t ret_ref = 0;
8612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8614         return ret_ref;
8615 }
8616
8617 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8618 CHECK(!owner->result_ok);
8619         return DecodeError_clone(&*owner->contents.err);
8620 }
8621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8622         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8623         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8624         int64_t ret_ref = 0;
8625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8627         return ret_ref;
8628 }
8629
8630 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8631 CHECK(owner->result_ok);
8632         return Ping_clone(&*owner->contents.result);
8633 }
8634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8635         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8636         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8637         int64_t ret_ref = 0;
8638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8640         return ret_ref;
8641 }
8642
8643 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8644 CHECK(!owner->result_ok);
8645         return DecodeError_clone(&*owner->contents.err);
8646 }
8647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8648         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8649         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
8650         int64_t ret_ref = 0;
8651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8653         return ret_ref;
8654 }
8655
8656 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8657 CHECK(owner->result_ok);
8658         return Pong_clone(&*owner->contents.result);
8659 }
8660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8661         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8662         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8663         int64_t ret_ref = 0;
8664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8666         return ret_ref;
8667 }
8668
8669 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8670 CHECK(!owner->result_ok);
8671         return DecodeError_clone(&*owner->contents.err);
8672 }
8673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8674         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8675         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
8676         int64_t ret_ref = 0;
8677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8679         return ret_ref;
8680 }
8681
8682 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8683 CHECK(owner->result_ok);
8684         return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
8685 }
8686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8687         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8688         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8689         int64_t ret_ref = 0;
8690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8692         return ret_ref;
8693 }
8694
8695 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8696 CHECK(!owner->result_ok);
8697         return DecodeError_clone(&*owner->contents.err);
8698 }
8699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8700         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8701         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8702         int64_t ret_ref = 0;
8703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8705         return ret_ref;
8706 }
8707
8708 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8709 CHECK(owner->result_ok);
8710         return ChannelAnnouncement_clone(&*owner->contents.result);
8711 }
8712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8713         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8714         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8715         int64_t ret_ref = 0;
8716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8718         return ret_ref;
8719 }
8720
8721 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8722 CHECK(!owner->result_ok);
8723         return DecodeError_clone(&*owner->contents.err);
8724 }
8725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8726         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8727         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8728         int64_t ret_ref = 0;
8729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8731         return ret_ref;
8732 }
8733
8734 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8735 CHECK(owner->result_ok);
8736         return UnsignedChannelUpdate_clone(&*owner->contents.result);
8737 }
8738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8739         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8740         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8741         int64_t ret_ref = 0;
8742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8744         return ret_ref;
8745 }
8746
8747 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8748 CHECK(!owner->result_ok);
8749         return DecodeError_clone(&*owner->contents.err);
8750 }
8751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8752         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8753         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8754         int64_t ret_ref = 0;
8755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8757         return ret_ref;
8758 }
8759
8760 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8761 CHECK(owner->result_ok);
8762         return ChannelUpdate_clone(&*owner->contents.result);
8763 }
8764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8765         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8766         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8767         int64_t ret_ref = 0;
8768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8770         return ret_ref;
8771 }
8772
8773 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8774 CHECK(!owner->result_ok);
8775         return DecodeError_clone(&*owner->contents.err);
8776 }
8777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8778         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8779         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8780         int64_t ret_ref = 0;
8781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8783         return ret_ref;
8784 }
8785
8786 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8787 CHECK(owner->result_ok);
8788         return ErrorMessage_clone(&*owner->contents.result);
8789 }
8790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8791         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8792         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8793         int64_t ret_ref = 0;
8794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8796         return ret_ref;
8797 }
8798
8799 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8800 CHECK(!owner->result_ok);
8801         return DecodeError_clone(&*owner->contents.err);
8802 }
8803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8804         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8805         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8806         int64_t ret_ref = 0;
8807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8809         return ret_ref;
8810 }
8811
8812 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8813 CHECK(owner->result_ok);
8814         return WarningMessage_clone(&*owner->contents.result);
8815 }
8816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8817         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8818         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
8819         int64_t ret_ref = 0;
8820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8822         return ret_ref;
8823 }
8824
8825 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8826 CHECK(!owner->result_ok);
8827         return DecodeError_clone(&*owner->contents.err);
8828 }
8829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8830         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
8831         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
8832         int64_t ret_ref = 0;
8833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8835         return ret_ref;
8836 }
8837
8838 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8839 CHECK(owner->result_ok);
8840         return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
8841 }
8842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8843         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8844         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8845         int64_t ret_ref = 0;
8846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8848         return ret_ref;
8849 }
8850
8851 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8852 CHECK(!owner->result_ok);
8853         return DecodeError_clone(&*owner->contents.err);
8854 }
8855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8856         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8857         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8858         int64_t ret_ref = 0;
8859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8861         return ret_ref;
8862 }
8863
8864 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8865 CHECK(owner->result_ok);
8866         return NodeAnnouncement_clone(&*owner->contents.result);
8867 }
8868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8869         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8870         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8871         int64_t ret_ref = 0;
8872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8874         return ret_ref;
8875 }
8876
8877 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8878 CHECK(!owner->result_ok);
8879         return DecodeError_clone(&*owner->contents.err);
8880 }
8881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8882         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
8883         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8884         int64_t ret_ref = 0;
8885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8887         return ret_ref;
8888 }
8889
8890 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8891 CHECK(owner->result_ok);
8892         return QueryShortChannelIds_clone(&*owner->contents.result);
8893 }
8894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8895         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8896         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8897         int64_t ret_ref = 0;
8898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8900         return ret_ref;
8901 }
8902
8903 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8904 CHECK(!owner->result_ok);
8905         return DecodeError_clone(&*owner->contents.err);
8906 }
8907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8908         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
8909         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8910         int64_t ret_ref = 0;
8911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8913         return ret_ref;
8914 }
8915
8916 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8917 CHECK(owner->result_ok);
8918         return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
8919 }
8920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8921         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8922         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8923         int64_t ret_ref = 0;
8924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8926         return ret_ref;
8927 }
8928
8929 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8930 CHECK(!owner->result_ok);
8931         return DecodeError_clone(&*owner->contents.err);
8932 }
8933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8934         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
8935         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8936         int64_t ret_ref = 0;
8937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8939         return ret_ref;
8940 }
8941
8942 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8943 CHECK(owner->result_ok);
8944         return QueryChannelRange_clone(&*owner->contents.result);
8945 }
8946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8947         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8948         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8949         int64_t ret_ref = 0;
8950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8952         return ret_ref;
8953 }
8954
8955 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8956 CHECK(!owner->result_ok);
8957         return DecodeError_clone(&*owner->contents.err);
8958 }
8959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8960         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
8961         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8962         int64_t ret_ref = 0;
8963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8965         return ret_ref;
8966 }
8967
8968 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8969 CHECK(owner->result_ok);
8970         return ReplyChannelRange_clone(&*owner->contents.result);
8971 }
8972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8973         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8974         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8975         int64_t ret_ref = 0;
8976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8978         return ret_ref;
8979 }
8980
8981 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8982 CHECK(!owner->result_ok);
8983         return DecodeError_clone(&*owner->contents.err);
8984 }
8985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8986         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
8987         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8988         int64_t ret_ref = 0;
8989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8991         return ret_ref;
8992 }
8993
8994 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8995 CHECK(owner->result_ok);
8996         return GossipTimestampFilter_clone(&*owner->contents.result);
8997 }
8998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8999         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9000         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9001         int64_t ret_ref = 0;
9002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9004         return ret_ref;
9005 }
9006
9007 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9008 CHECK(!owner->result_ok);
9009         return DecodeError_clone(&*owner->contents.err);
9010 }
9011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9012         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9013         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9014         int64_t ret_ref = 0;
9015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9017         return ret_ref;
9018 }
9019
9020 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9021         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9022         for (size_t i = 0; i < ret.datalen; i++) {
9023                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9024         }
9025         return ret;
9026 }
9027 static jclass LDKSignOrCreationError_SignError_class = NULL;
9028 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9029 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9030 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9032         LDKSignOrCreationError_SignError_class =
9033                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9034         CHECK(LDKSignOrCreationError_SignError_class != NULL);
9035         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9036         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9037         LDKSignOrCreationError_CreationError_class =
9038                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9039         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9040         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9041         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9042 }
9043 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9044         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
9045         switch(obj->tag) {
9046                 case LDKSignOrCreationError_SignError: {
9047                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9048                 }
9049                 case LDKSignOrCreationError_CreationError: {
9050                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9051                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9052                 }
9053                 default: abort();
9054         }
9055 }
9056 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9057 CHECK(owner->result_ok);
9058         return Invoice_clone(&*owner->contents.result);
9059 }
9060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9061         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9062         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9063         int64_t ret_ref = 0;
9064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9066         return ret_ref;
9067 }
9068
9069 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9070 CHECK(!owner->result_ok);
9071         return SignOrCreationError_clone(&*owner->contents.err);
9072 }
9073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9074         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9075         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9076         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9077         int64_t ret_ref = tag_ptr(ret_copy, true);
9078         return ret_ref;
9079 }
9080
9081 typedef struct LDKFilter_JCalls {
9082         atomic_size_t refcnt;
9083         JavaVM *vm;
9084         jweak o;
9085         jmethodID register_tx_meth;
9086         jmethodID register_output_meth;
9087 } LDKFilter_JCalls;
9088 static void LDKFilter_JCalls_free(void* this_arg) {
9089         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9090         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9091                 JNIEnv *env;
9092                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9093                 if (get_jenv_res == JNI_EDETACHED) {
9094                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9095                 } else {
9096                         DO_ASSERT(get_jenv_res == JNI_OK);
9097                 }
9098                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9099                 if (get_jenv_res == JNI_EDETACHED) {
9100                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9101                 }
9102                 FREE(j_calls);
9103         }
9104 }
9105 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9106         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9107         JNIEnv *env;
9108         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9109         if (get_jenv_res == JNI_EDETACHED) {
9110                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9111         } else {
9112                 DO_ASSERT(get_jenv_res == JNI_OK);
9113         }
9114         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9115         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9116         LDKu8slice script_pubkey_var = script_pubkey;
9117         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9118         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9119         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9120         CHECK(obj != NULL);
9121         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9122         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9123                 (*env)->ExceptionDescribe(env);
9124                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9125         }
9126         if (get_jenv_res == JNI_EDETACHED) {
9127                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9128         }
9129 }
9130 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9131         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9132         JNIEnv *env;
9133         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9134         if (get_jenv_res == JNI_EDETACHED) {
9135                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9136         } else {
9137                 DO_ASSERT(get_jenv_res == JNI_OK);
9138         }
9139         LDKWatchedOutput output_var = output;
9140         int64_t output_ref = 0;
9141         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9142         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
9143         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9144         CHECK(obj != NULL);
9145         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9146         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9147                 (*env)->ExceptionDescribe(env);
9148                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9149         }
9150         void* ret_ptr = untag_ptr(ret);
9151         CHECK_ACCESS(ret_ptr);
9152         LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9153         FREE(untag_ptr(ret));
9154         if (get_jenv_res == JNI_EDETACHED) {
9155                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9156         }
9157         return ret_conv;
9158 }
9159 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9160         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9161         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9162 }
9163 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9164         jclass c = (*env)->GetObjectClass(env, o);
9165         CHECK(c != NULL);
9166         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9167         atomic_init(&calls->refcnt, 1);
9168         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9169         calls->o = (*env)->NewWeakGlobalRef(env, o);
9170         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9171         CHECK(calls->register_tx_meth != NULL);
9172         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9173         CHECK(calls->register_output_meth != NULL);
9174
9175         LDKFilter ret = {
9176                 .this_arg = (void*) calls,
9177                 .register_tx = register_tx_LDKFilter_jcall,
9178                 .register_output = register_output_LDKFilter_jcall,
9179                 .free = LDKFilter_JCalls_free,
9180         };
9181         return ret;
9182 }
9183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9184         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9185         *res_ptr = LDKFilter_init(env, clz, o);
9186         return tag_ptr(res_ptr, true);
9187 }
9188 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) {
9189         void* this_arg_ptr = untag_ptr(this_arg);
9190         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9191         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9192         unsigned char txid_arr[32];
9193         CHECK((*env)->GetArrayLength(env, txid) == 32);
9194         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9195         unsigned char (*txid_ref)[32] = &txid_arr;
9196         LDKu8slice script_pubkey_ref;
9197         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9198         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9199         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9200         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9201 }
9202
9203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9204         void* this_arg_ptr = untag_ptr(this_arg);
9205         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9206         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9207         LDKWatchedOutput output_conv;
9208         output_conv.inner = untag_ptr(output);
9209         output_conv.is_owned = ptr_is_owned(output);
9210         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9211         output_conv = WatchedOutput_clone(&output_conv);
9212         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9213         *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9214         int64_t ret_ref = tag_ptr(ret_copy, true);
9215         return ret_ref;
9216 }
9217
9218 static jclass LDKCOption_FilterZ_Some_class = NULL;
9219 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9220 static jclass LDKCOption_FilterZ_None_class = NULL;
9221 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9223         LDKCOption_FilterZ_Some_class =
9224                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9225         CHECK(LDKCOption_FilterZ_Some_class != NULL);
9226         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9227         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9228         LDKCOption_FilterZ_None_class =
9229                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9230         CHECK(LDKCOption_FilterZ_None_class != NULL);
9231         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9232         CHECK(LDKCOption_FilterZ_None_meth != NULL);
9233 }
9234 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9235         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
9236         switch(obj->tag) {
9237                 case LDKCOption_FilterZ_Some: {
9238                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9239                         *some_ret = obj->some;
9240                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9241                         if ((*some_ret).free == LDKFilter_JCalls_free) {
9242                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9243                                 LDKFilter_JCalls_cloned(&(*some_ret));
9244                         }
9245                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
9246                 }
9247                 case LDKCOption_FilterZ_None: {
9248                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9249                 }
9250                 default: abort();
9251         }
9252 }
9253 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9254 CHECK(owner->result_ok);
9255         return &*owner->contents.result;
9256 }
9257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9258         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
9259         LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9260         int64_t ret_ref = 0;
9261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9262         ret_ref = tag_ptr(ret_var.inner, false);
9263         return ret_ref;
9264 }
9265
9266 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9267 CHECK(!owner->result_ok);
9268         return *owner->contents.err;
9269 }
9270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9271         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
9272         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9273 }
9274
9275 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9276         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9277         for (size_t i = 0; i < ret.datalen; i++) {
9278                 ret.data[i] = OutPoint_clone(&orig->data[i]);
9279         }
9280         return ret;
9281 }
9282 typedef struct LDKMessageSendEventsProvider_JCalls {
9283         atomic_size_t refcnt;
9284         JavaVM *vm;
9285         jweak o;
9286         jmethodID get_and_clear_pending_msg_events_meth;
9287 } LDKMessageSendEventsProvider_JCalls;
9288 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9289         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9290         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9291                 JNIEnv *env;
9292                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9293                 if (get_jenv_res == JNI_EDETACHED) {
9294                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9295                 } else {
9296                         DO_ASSERT(get_jenv_res == JNI_OK);
9297                 }
9298                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9299                 if (get_jenv_res == JNI_EDETACHED) {
9300                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9301                 }
9302                 FREE(j_calls);
9303         }
9304 }
9305 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9306         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9307         JNIEnv *env;
9308         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9309         if (get_jenv_res == JNI_EDETACHED) {
9310                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9311         } else {
9312                 DO_ASSERT(get_jenv_res == JNI_OK);
9313         }
9314         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9315         CHECK(obj != NULL);
9316         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9317         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9318                 (*env)->ExceptionDescribe(env);
9319                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9320         }
9321         LDKCVec_MessageSendEventZ ret_constr;
9322         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9323         if (ret_constr.datalen > 0)
9324                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9325         else
9326                 ret_constr.data = NULL;
9327         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9328         for (size_t s = 0; s < ret_constr.datalen; s++) {
9329                 int64_t ret_conv_18 = ret_vals[s];
9330                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
9331                 CHECK_ACCESS(ret_conv_18_ptr);
9332                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9333                 FREE(untag_ptr(ret_conv_18));
9334                 ret_constr.data[s] = ret_conv_18_conv;
9335         }
9336         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9337         if (get_jenv_res == JNI_EDETACHED) {
9338                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9339         }
9340         return ret_constr;
9341 }
9342 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
9343         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
9344         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9345 }
9346 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9347         jclass c = (*env)->GetObjectClass(env, o);
9348         CHECK(c != NULL);
9349         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
9350         atomic_init(&calls->refcnt, 1);
9351         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9352         calls->o = (*env)->NewWeakGlobalRef(env, o);
9353         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
9354         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
9355
9356         LDKMessageSendEventsProvider ret = {
9357                 .this_arg = (void*) calls,
9358                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
9359                 .free = LDKMessageSendEventsProvider_JCalls_free,
9360         };
9361         return ret;
9362 }
9363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9364         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9365         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
9366         return tag_ptr(res_ptr, true);
9367 }
9368 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9369         void* this_arg_ptr = untag_ptr(this_arg);
9370         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9371         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
9372         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
9373         int64_tArray ret_arr = NULL;
9374         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9375         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9376         for (size_t s = 0; s < ret_var.datalen; s++) {
9377                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9378                 *ret_conv_18_copy = ret_var.data[s];
9379                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
9380                 ret_arr_ptr[s] = ret_conv_18_ref;
9381         }
9382         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9383         FREE(ret_var.data);
9384         return ret_arr;
9385 }
9386
9387 typedef struct LDKEventHandler_JCalls {
9388         atomic_size_t refcnt;
9389         JavaVM *vm;
9390         jweak o;
9391         jmethodID handle_event_meth;
9392 } LDKEventHandler_JCalls;
9393 static void LDKEventHandler_JCalls_free(void* this_arg) {
9394         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9395         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9396                 JNIEnv *env;
9397                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9398                 if (get_jenv_res == JNI_EDETACHED) {
9399                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9400                 } else {
9401                         DO_ASSERT(get_jenv_res == JNI_OK);
9402                 }
9403                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9404                 if (get_jenv_res == JNI_EDETACHED) {
9405                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9406                 }
9407                 FREE(j_calls);
9408         }
9409 }
9410 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
9411         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9412         JNIEnv *env;
9413         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9414         if (get_jenv_res == JNI_EDETACHED) {
9415                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9416         } else {
9417                 DO_ASSERT(get_jenv_res == JNI_OK);
9418         }
9419         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
9420         *ret_event = Event_clone(event);
9421         int64_t ref_event = tag_ptr(ret_event, true);
9422         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9423         CHECK(obj != NULL);
9424         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, ref_event);
9425         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9426                 (*env)->ExceptionDescribe(env);
9427                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
9428         }
9429         if (get_jenv_res == JNI_EDETACHED) {
9430                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9431         }
9432 }
9433 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9434         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9435         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9436 }
9437 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
9438         jclass c = (*env)->GetObjectClass(env, o);
9439         CHECK(c != NULL);
9440         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9441         atomic_init(&calls->refcnt, 1);
9442         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9443         calls->o = (*env)->NewWeakGlobalRef(env, o);
9444         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
9445         CHECK(calls->handle_event_meth != NULL);
9446
9447         LDKEventHandler ret = {
9448                 .this_arg = (void*) calls,
9449                 .handle_event = handle_event_LDKEventHandler_jcall,
9450                 .free = LDKEventHandler_JCalls_free,
9451         };
9452         return ret;
9453 }
9454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
9455         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9456         *res_ptr = LDKEventHandler_init(env, clz, o);
9457         return tag_ptr(res_ptr, true);
9458 }
9459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
9460         void* this_arg_ptr = untag_ptr(this_arg);
9461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9462         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9463         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
9464         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9465 }
9466
9467 typedef struct LDKEventsProvider_JCalls {
9468         atomic_size_t refcnt;
9469         JavaVM *vm;
9470         jweak o;
9471         jmethodID process_pending_events_meth;
9472 } LDKEventsProvider_JCalls;
9473 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9474         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9475         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9476                 JNIEnv *env;
9477                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9478                 if (get_jenv_res == JNI_EDETACHED) {
9479                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9480                 } else {
9481                         DO_ASSERT(get_jenv_res == JNI_OK);
9482                 }
9483                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9484                 if (get_jenv_res == JNI_EDETACHED) {
9485                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9486                 }
9487                 FREE(j_calls);
9488         }
9489 }
9490 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9491         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9492         JNIEnv *env;
9493         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9494         if (get_jenv_res == JNI_EDETACHED) {
9495                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9496         } else {
9497                 DO_ASSERT(get_jenv_res == JNI_OK);
9498         }
9499         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9500         *handler_ret = handler;
9501         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9502         CHECK(obj != NULL);
9503         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
9504         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9505                 (*env)->ExceptionDescribe(env);
9506                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
9507         }
9508         if (get_jenv_res == JNI_EDETACHED) {
9509                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9510         }
9511 }
9512 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9513         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9514         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9515 }
9516 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9517         jclass c = (*env)->GetObjectClass(env, o);
9518         CHECK(c != NULL);
9519         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9520         atomic_init(&calls->refcnt, 1);
9521         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9522         calls->o = (*env)->NewWeakGlobalRef(env, o);
9523         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
9524         CHECK(calls->process_pending_events_meth != NULL);
9525
9526         LDKEventsProvider ret = {
9527                 .this_arg = (void*) calls,
9528                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9529                 .free = LDKEventsProvider_JCalls_free,
9530         };
9531         return ret;
9532 }
9533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9534         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9535         *res_ptr = LDKEventsProvider_init(env, clz, o);
9536         return tag_ptr(res_ptr, true);
9537 }
9538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
9539         void* this_arg_ptr = untag_ptr(this_arg);
9540         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9541         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9542         void* handler_ptr = untag_ptr(handler);
9543         CHECK_ACCESS(handler_ptr);
9544         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9545         if (handler_conv.free == LDKEventHandler_JCalls_free) {
9546                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9547                 LDKEventHandler_JCalls_cloned(&handler_conv);
9548         }
9549         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9550 }
9551
9552 typedef struct LDKScore_JCalls {
9553         atomic_size_t refcnt;
9554         JavaVM *vm;
9555         jweak o;
9556         jmethodID channel_penalty_msat_meth;
9557         jmethodID payment_path_failed_meth;
9558         jmethodID payment_path_successful_meth;
9559         jmethodID probe_failed_meth;
9560         jmethodID probe_successful_meth;
9561         jmethodID write_meth;
9562 } LDKScore_JCalls;
9563 static void LDKScore_JCalls_free(void* this_arg) {
9564         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9565         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9566                 JNIEnv *env;
9567                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9568                 if (get_jenv_res == JNI_EDETACHED) {
9569                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9570                 } else {
9571                         DO_ASSERT(get_jenv_res == JNI_OK);
9572                 }
9573                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9574                 if (get_jenv_res == JNI_EDETACHED) {
9575                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9576                 }
9577                 FREE(j_calls);
9578         }
9579 }
9580 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
9581         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9582         JNIEnv *env;
9583         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9584         if (get_jenv_res == JNI_EDETACHED) {
9585                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9586         } else {
9587                 DO_ASSERT(get_jenv_res == JNI_OK);
9588         }
9589         int64_t short_channel_id_conv = short_channel_id;
9590         LDKNodeId source_var = *source;
9591         int64_t source_ref = 0;
9592         source_var = NodeId_clone(&source_var);
9593         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
9594         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
9595         LDKNodeId target_var = *target;
9596         int64_t target_ref = 0;
9597         target_var = NodeId_clone(&target_var);
9598         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9599         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
9600         LDKChannelUsage usage_var = usage;
9601         int64_t usage_ref = 0;
9602         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
9603         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
9604         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9605         CHECK(obj != NULL);
9606         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
9607         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9608                 (*env)->ExceptionDescribe(env);
9609                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
9610         }
9611         if (get_jenv_res == JNI_EDETACHED) {
9612                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9613         }
9614         return ret;
9615 }
9616 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9617         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9618         JNIEnv *env;
9619         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9620         if (get_jenv_res == JNI_EDETACHED) {
9621                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9622         } else {
9623                 DO_ASSERT(get_jenv_res == JNI_OK);
9624         }
9625         LDKCVec_RouteHopZ path_var = path;
9626         int64_tArray path_arr = NULL;
9627         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9628         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9629         for (size_t k = 0; k < path_var.datalen; k++) {
9630                 LDKRouteHop path_conv_10_var = path_var.data[k];
9631                 int64_t path_conv_10_ref = 0;
9632                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9633                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9634                 path_arr_ptr[k] = path_conv_10_ref;
9635         }
9636         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9637         FREE(path_var.data);
9638         int64_t short_channel_id_conv = short_channel_id;
9639         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9640         CHECK(obj != NULL);
9641         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
9642         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9643                 (*env)->ExceptionDescribe(env);
9644                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
9645         }
9646         if (get_jenv_res == JNI_EDETACHED) {
9647                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9648         }
9649 }
9650 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9651         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9652         JNIEnv *env;
9653         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9654         if (get_jenv_res == JNI_EDETACHED) {
9655                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9656         } else {
9657                 DO_ASSERT(get_jenv_res == JNI_OK);
9658         }
9659         LDKCVec_RouteHopZ path_var = path;
9660         int64_tArray path_arr = NULL;
9661         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9662         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9663         for (size_t k = 0; k < path_var.datalen; k++) {
9664                 LDKRouteHop path_conv_10_var = path_var.data[k];
9665                 int64_t path_conv_10_ref = 0;
9666                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9667                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9668                 path_arr_ptr[k] = path_conv_10_ref;
9669         }
9670         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9671         FREE(path_var.data);
9672         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9673         CHECK(obj != NULL);
9674         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
9675         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9676                 (*env)->ExceptionDescribe(env);
9677                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
9678         }
9679         if (get_jenv_res == JNI_EDETACHED) {
9680                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9681         }
9682 }
9683 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9684         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9685         JNIEnv *env;
9686         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9687         if (get_jenv_res == JNI_EDETACHED) {
9688                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9689         } else {
9690                 DO_ASSERT(get_jenv_res == JNI_OK);
9691         }
9692         LDKCVec_RouteHopZ path_var = path;
9693         int64_tArray path_arr = NULL;
9694         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9695         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9696         for (size_t k = 0; k < path_var.datalen; k++) {
9697                 LDKRouteHop path_conv_10_var = path_var.data[k];
9698                 int64_t path_conv_10_ref = 0;
9699                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9700                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9701                 path_arr_ptr[k] = path_conv_10_ref;
9702         }
9703         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9704         FREE(path_var.data);
9705         int64_t short_channel_id_conv = short_channel_id;
9706         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9707         CHECK(obj != NULL);
9708         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv);
9709         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9710                 (*env)->ExceptionDescribe(env);
9711                 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
9712         }
9713         if (get_jenv_res == JNI_EDETACHED) {
9714                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9715         }
9716 }
9717 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9718         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9719         JNIEnv *env;
9720         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9721         if (get_jenv_res == JNI_EDETACHED) {
9722                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9723         } else {
9724                 DO_ASSERT(get_jenv_res == JNI_OK);
9725         }
9726         LDKCVec_RouteHopZ path_var = path;
9727         int64_tArray path_arr = NULL;
9728         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9729         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9730         for (size_t k = 0; k < path_var.datalen; k++) {
9731                 LDKRouteHop path_conv_10_var = path_var.data[k];
9732                 int64_t path_conv_10_ref = 0;
9733                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9734                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9735                 path_arr_ptr[k] = path_conv_10_ref;
9736         }
9737         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9738         FREE(path_var.data);
9739         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9740         CHECK(obj != NULL);
9741         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr);
9742         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9743                 (*env)->ExceptionDescribe(env);
9744                 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
9745         }
9746         if (get_jenv_res == JNI_EDETACHED) {
9747                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9748         }
9749 }
9750 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9751         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9752         JNIEnv *env;
9753         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9754         if (get_jenv_res == JNI_EDETACHED) {
9755                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9756         } else {
9757                 DO_ASSERT(get_jenv_res == JNI_OK);
9758         }
9759         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9760         CHECK(obj != NULL);
9761         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9762         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9763                 (*env)->ExceptionDescribe(env);
9764                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
9765         }
9766         LDKCVec_u8Z ret_ref;
9767         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9768         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9769         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9770         if (get_jenv_res == JNI_EDETACHED) {
9771                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9772         }
9773         return ret_ref;
9774 }
9775 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9776         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9777         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9778 }
9779 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
9780         jclass c = (*env)->GetObjectClass(env, o);
9781         CHECK(c != NULL);
9782         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9783         atomic_init(&calls->refcnt, 1);
9784         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9785         calls->o = (*env)->NewWeakGlobalRef(env, o);
9786         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
9787         CHECK(calls->channel_penalty_msat_meth != NULL);
9788         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
9789         CHECK(calls->payment_path_failed_meth != NULL);
9790         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
9791         CHECK(calls->payment_path_successful_meth != NULL);
9792         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V");
9793         CHECK(calls->probe_failed_meth != NULL);
9794         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V");
9795         CHECK(calls->probe_successful_meth != NULL);
9796         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9797         CHECK(calls->write_meth != NULL);
9798
9799         LDKScore ret = {
9800                 .this_arg = (void*) calls,
9801                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
9802                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
9803                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
9804                 .probe_failed = probe_failed_LDKScore_jcall,
9805                 .probe_successful = probe_successful_LDKScore_jcall,
9806                 .write = write_LDKScore_jcall,
9807                 .free = LDKScore_JCalls_free,
9808         };
9809         return ret;
9810 }
9811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
9812         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
9813         *res_ptr = LDKScore_init(env, clz, o);
9814         return tag_ptr(res_ptr, true);
9815 }
9816 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) {
9817         void* this_arg_ptr = untag_ptr(this_arg);
9818         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9819         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9820         LDKNodeId source_conv;
9821         source_conv.inner = untag_ptr(source);
9822         source_conv.is_owned = ptr_is_owned(source);
9823         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
9824         source_conv.is_owned = false;
9825         LDKNodeId target_conv;
9826         target_conv.inner = untag_ptr(target);
9827         target_conv.is_owned = ptr_is_owned(target);
9828         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
9829         target_conv.is_owned = false;
9830         LDKChannelUsage usage_conv;
9831         usage_conv.inner = untag_ptr(usage);
9832         usage_conv.is_owned = ptr_is_owned(usage);
9833         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
9834         usage_conv = ChannelUsage_clone(&usage_conv);
9835         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
9836         return ret_conv;
9837 }
9838
9839 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) {
9840         void* this_arg_ptr = untag_ptr(this_arg);
9841         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9842         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9843         LDKCVec_RouteHopZ path_constr;
9844         path_constr.datalen = (*env)->GetArrayLength(env, path);
9845         if (path_constr.datalen > 0)
9846                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9847         else
9848                 path_constr.data = NULL;
9849         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
9850         for (size_t k = 0; k < path_constr.datalen; k++) {
9851                 int64_t path_conv_10 = path_vals[k];
9852                 LDKRouteHop path_conv_10_conv;
9853                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9854                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9855                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9856                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9857                 path_constr.data[k] = path_conv_10_conv;
9858         }
9859         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
9860         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9861 }
9862
9863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
9864         void* this_arg_ptr = untag_ptr(this_arg);
9865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9866         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9867         LDKCVec_RouteHopZ path_constr;
9868         path_constr.datalen = (*env)->GetArrayLength(env, path);
9869         if (path_constr.datalen > 0)
9870                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9871         else
9872                 path_constr.data = NULL;
9873         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
9874         for (size_t k = 0; k < path_constr.datalen; k++) {
9875                 int64_t path_conv_10 = path_vals[k];
9876                 LDKRouteHop path_conv_10_conv;
9877                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9878                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9879                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9880                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9881                 path_constr.data[k] = path_conv_10_conv;
9882         }
9883         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
9884         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
9885 }
9886
9887 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) {
9888         void* this_arg_ptr = untag_ptr(this_arg);
9889         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9890         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9891         LDKCVec_RouteHopZ path_constr;
9892         path_constr.datalen = (*env)->GetArrayLength(env, path);
9893         if (path_constr.datalen > 0)
9894                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9895         else
9896                 path_constr.data = NULL;
9897         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
9898         for (size_t k = 0; k < path_constr.datalen; k++) {
9899                 int64_t path_conv_10 = path_vals[k];
9900                 LDKRouteHop path_conv_10_conv;
9901                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9902                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9903                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9904                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9905                 path_constr.data[k] = path_conv_10_conv;
9906         }
9907         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
9908         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
9909 }
9910
9911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
9912         void* this_arg_ptr = untag_ptr(this_arg);
9913         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9914         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9915         LDKCVec_RouteHopZ path_constr;
9916         path_constr.datalen = (*env)->GetArrayLength(env, path);
9917         if (path_constr.datalen > 0)
9918                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9919         else
9920                 path_constr.data = NULL;
9921         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
9922         for (size_t k = 0; k < path_constr.datalen; k++) {
9923                 int64_t path_conv_10 = path_vals[k];
9924                 LDKRouteHop path_conv_10_conv;
9925                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
9926                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
9927                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
9928                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
9929                 path_constr.data[k] = path_conv_10_conv;
9930         }
9931         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
9932         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
9933 }
9934
9935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9936         void* this_arg_ptr = untag_ptr(this_arg);
9937         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9938         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
9939         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9940         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9941         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9942         CVec_u8Z_free(ret_var);
9943         return ret_arr;
9944 }
9945
9946 typedef struct LDKPersister_JCalls {
9947         atomic_size_t refcnt;
9948         JavaVM *vm;
9949         jweak o;
9950         jmethodID persist_manager_meth;
9951         jmethodID persist_graph_meth;
9952         jmethodID persist_scorer_meth;
9953 } LDKPersister_JCalls;
9954 static void LDKPersister_JCalls_free(void* this_arg) {
9955         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9956         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9957                 JNIEnv *env;
9958                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9959                 if (get_jenv_res == JNI_EDETACHED) {
9960                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9961                 } else {
9962                         DO_ASSERT(get_jenv_res == JNI_OK);
9963                 }
9964                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9965                 if (get_jenv_res == JNI_EDETACHED) {
9966                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9967                 }
9968                 FREE(j_calls);
9969         }
9970 }
9971 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9972         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
9973         JNIEnv *env;
9974         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9975         if (get_jenv_res == JNI_EDETACHED) {
9976                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9977         } else {
9978                 DO_ASSERT(get_jenv_res == JNI_OK);
9979         }
9980         LDKChannelManager channel_manager_var = *channel_manager;
9981         int64_t channel_manager_ref = 0;
9982         // WARNING: we may need a move here but no clone is available for LDKChannelManager
9983         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
9984         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
9985         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9986         CHECK(obj != NULL);
9987         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
9988         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9989                 (*env)->ExceptionDescribe(env);
9990                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
9991         }
9992         void* ret_ptr = untag_ptr(ret);
9993         CHECK_ACCESS(ret_ptr);
9994         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
9995         FREE(untag_ptr(ret));
9996         if (get_jenv_res == JNI_EDETACHED) {
9997                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9998         }
9999         return ret_conv;
10000 }
10001 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10002         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10003         JNIEnv *env;
10004         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10005         if (get_jenv_res == JNI_EDETACHED) {
10006                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10007         } else {
10008                 DO_ASSERT(get_jenv_res == JNI_OK);
10009         }
10010         LDKNetworkGraph network_graph_var = *network_graph;
10011         int64_t network_graph_ref = 0;
10012         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10013         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10014         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
10015         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10016         CHECK(obj != NULL);
10017         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
10018         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10019                 (*env)->ExceptionDescribe(env);
10020                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
10021         }
10022         void* ret_ptr = untag_ptr(ret);
10023         CHECK_ACCESS(ret_ptr);
10024         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10025         FREE(untag_ptr(ret));
10026         if (get_jenv_res == JNI_EDETACHED) {
10027                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10028         }
10029         return ret_conv;
10030 }
10031 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
10032         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10033         JNIEnv *env;
10034         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10035         if (get_jenv_res == JNI_EDETACHED) {
10036                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10037         } else {
10038                 DO_ASSERT(get_jenv_res == JNI_OK);
10039         }
10040         LDKMultiThreadedLockableScore scorer_var = *scorer;
10041         int64_t scorer_ref = 0;
10042         // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
10043         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
10044         scorer_ref = tag_ptr(scorer_var.inner, scorer_var.is_owned);
10045         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10046         CHECK(obj != NULL);
10047         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, scorer_ref);
10048         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10049                 (*env)->ExceptionDescribe(env);
10050                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
10051         }
10052         void* ret_ptr = untag_ptr(ret);
10053         CHECK_ACCESS(ret_ptr);
10054         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10055         FREE(untag_ptr(ret));
10056         if (get_jenv_res == JNI_EDETACHED) {
10057                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10058         }
10059         return ret_conv;
10060 }
10061 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10062         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10063         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10064 }
10065 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
10066         jclass c = (*env)->GetObjectClass(env, o);
10067         CHECK(c != NULL);
10068         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10069         atomic_init(&calls->refcnt, 1);
10070         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10071         calls->o = (*env)->NewWeakGlobalRef(env, o);
10072         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10073         CHECK(calls->persist_manager_meth != NULL);
10074         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
10075         CHECK(calls->persist_graph_meth != NULL);
10076         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
10077         CHECK(calls->persist_scorer_meth != NULL);
10078
10079         LDKPersister ret = {
10080                 .this_arg = (void*) calls,
10081                 .persist_manager = persist_manager_LDKPersister_jcall,
10082                 .persist_graph = persist_graph_LDKPersister_jcall,
10083                 .persist_scorer = persist_scorer_LDKPersister_jcall,
10084                 .free = LDKPersister_JCalls_free,
10085         };
10086         return ret;
10087 }
10088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10089         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10090         *res_ptr = LDKPersister_init(env, clz, o);
10091         return tag_ptr(res_ptr, true);
10092 }
10093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10094         void* this_arg_ptr = untag_ptr(this_arg);
10095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10096         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10097         LDKChannelManager channel_manager_conv;
10098         channel_manager_conv.inner = untag_ptr(channel_manager);
10099         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
10100         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10101         channel_manager_conv.is_owned = false;
10102         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10103         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10104         return tag_ptr(ret_conv, true);
10105 }
10106
10107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
10108         void* this_arg_ptr = untag_ptr(this_arg);
10109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10110         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10111         LDKNetworkGraph network_graph_conv;
10112         network_graph_conv.inner = untag_ptr(network_graph);
10113         network_graph_conv.is_owned = ptr_is_owned(network_graph);
10114         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10115         network_graph_conv.is_owned = false;
10116         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10117         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10118         return tag_ptr(ret_conv, true);
10119 }
10120
10121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
10122         void* this_arg_ptr = untag_ptr(this_arg);
10123         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10124         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10125         LDKMultiThreadedLockableScore scorer_conv;
10126         scorer_conv.inner = untag_ptr(scorer);
10127         scorer_conv.is_owned = ptr_is_owned(scorer);
10128         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
10129         scorer_conv.is_owned = false;
10130         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10131         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
10132         return tag_ptr(ret_conv, true);
10133 }
10134
10135 typedef struct LDKListen_JCalls {
10136         atomic_size_t refcnt;
10137         JavaVM *vm;
10138         jweak o;
10139         jmethodID filtered_block_connected_meth;
10140         jmethodID block_connected_meth;
10141         jmethodID block_disconnected_meth;
10142 } LDKListen_JCalls;
10143 static void LDKListen_JCalls_free(void* this_arg) {
10144         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10145         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10146                 JNIEnv *env;
10147                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10148                 if (get_jenv_res == JNI_EDETACHED) {
10149                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10150                 } else {
10151                         DO_ASSERT(get_jenv_res == JNI_OK);
10152                 }
10153                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10154                 if (get_jenv_res == JNI_EDETACHED) {
10155                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10156                 }
10157                 FREE(j_calls);
10158         }
10159 }
10160 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10161         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10162         JNIEnv *env;
10163         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10164         if (get_jenv_res == JNI_EDETACHED) {
10165                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10166         } else {
10167                 DO_ASSERT(get_jenv_res == JNI_OK);
10168         }
10169         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10170         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10171         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10172         int64_tArray txdata_arr = NULL;
10173         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10174         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10175         for (size_t c = 0; c < txdata_var.datalen; c++) {
10176                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10177                 *txdata_conv_28_conv = txdata_var.data[c];
10178                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
10179         }
10180         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10181         FREE(txdata_var.data);
10182         int32_t height_conv = height;
10183         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10184         CHECK(obj != NULL);
10185         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
10186         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10187                 (*env)->ExceptionDescribe(env);
10188                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
10189         }
10190         if (get_jenv_res == JNI_EDETACHED) {
10191                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10192         }
10193 }
10194 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
10195         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10196         JNIEnv *env;
10197         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10198         if (get_jenv_res == JNI_EDETACHED) {
10199                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10200         } else {
10201                 DO_ASSERT(get_jenv_res == JNI_OK);
10202         }
10203         LDKu8slice block_var = block;
10204         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
10205         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
10206         int32_t height_conv = height;
10207         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10208         CHECK(obj != NULL);
10209         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
10210         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10211                 (*env)->ExceptionDescribe(env);
10212                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
10213         }
10214         if (get_jenv_res == JNI_EDETACHED) {
10215                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10216         }
10217 }
10218 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10219         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10220         JNIEnv *env;
10221         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10222         if (get_jenv_res == JNI_EDETACHED) {
10223                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10224         } else {
10225                 DO_ASSERT(get_jenv_res == JNI_OK);
10226         }
10227         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10228         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10229         int32_t height_conv = height;
10230         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10231         CHECK(obj != NULL);
10232         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
10233         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10234                 (*env)->ExceptionDescribe(env);
10235                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
10236         }
10237         if (get_jenv_res == JNI_EDETACHED) {
10238                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10239         }
10240 }
10241 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
10242         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
10243         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10244 }
10245 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
10246         jclass c = (*env)->GetObjectClass(env, o);
10247         CHECK(c != NULL);
10248         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
10249         atomic_init(&calls->refcnt, 1);
10250         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10251         calls->o = (*env)->NewWeakGlobalRef(env, o);
10252         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
10253         CHECK(calls->filtered_block_connected_meth != NULL);
10254         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
10255         CHECK(calls->block_connected_meth != NULL);
10256         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
10257         CHECK(calls->block_disconnected_meth != NULL);
10258
10259         LDKListen ret = {
10260                 .this_arg = (void*) calls,
10261                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
10262                 .block_connected = block_connected_LDKListen_jcall,
10263                 .block_disconnected = block_disconnected_LDKListen_jcall,
10264                 .free = LDKListen_JCalls_free,
10265         };
10266         return ret;
10267 }
10268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
10269         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
10270         *res_ptr = LDKListen_init(env, clz, o);
10271         return tag_ptr(res_ptr, true);
10272 }
10273 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) {
10274         void* this_arg_ptr = untag_ptr(this_arg);
10275         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10276         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10277         unsigned char header_arr[80];
10278         CHECK((*env)->GetArrayLength(env, header) == 80);
10279         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10280         unsigned char (*header_ref)[80] = &header_arr;
10281         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10282         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10283         if (txdata_constr.datalen > 0)
10284                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10285         else
10286                 txdata_constr.data = NULL;
10287         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10288         for (size_t c = 0; c < txdata_constr.datalen; c++) {
10289                 int64_t txdata_conv_28 = txdata_vals[c];
10290                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
10291                 CHECK_ACCESS(txdata_conv_28_ptr);
10292                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10293                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
10294                 txdata_constr.data[c] = txdata_conv_28_conv;
10295         }
10296         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10297         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10298 }
10299
10300 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) {
10301         void* this_arg_ptr = untag_ptr(this_arg);
10302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10303         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10304         LDKu8slice block_ref;
10305         block_ref.datalen = (*env)->GetArrayLength(env, block);
10306         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
10307         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
10308         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
10309 }
10310
10311 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) {
10312         void* this_arg_ptr = untag_ptr(this_arg);
10313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10314         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10315         unsigned char header_arr[80];
10316         CHECK((*env)->GetArrayLength(env, header) == 80);
10317         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10318         unsigned char (*header_ref)[80] = &header_arr;
10319         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
10320 }
10321
10322 typedef struct LDKConfirm_JCalls {
10323         atomic_size_t refcnt;
10324         JavaVM *vm;
10325         jweak o;
10326         jmethodID transactions_confirmed_meth;
10327         jmethodID transaction_unconfirmed_meth;
10328         jmethodID best_block_updated_meth;
10329         jmethodID get_relevant_txids_meth;
10330 } LDKConfirm_JCalls;
10331 static void LDKConfirm_JCalls_free(void* this_arg) {
10332         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10333         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10334                 JNIEnv *env;
10335                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10336                 if (get_jenv_res == JNI_EDETACHED) {
10337                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10338                 } else {
10339                         DO_ASSERT(get_jenv_res == JNI_OK);
10340                 }
10341                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10342                 if (get_jenv_res == JNI_EDETACHED) {
10343                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10344                 }
10345                 FREE(j_calls);
10346         }
10347 }
10348 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10349         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10350         JNIEnv *env;
10351         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10352         if (get_jenv_res == JNI_EDETACHED) {
10353                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10354         } else {
10355                 DO_ASSERT(get_jenv_res == JNI_OK);
10356         }
10357         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10358         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10359         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10360         int64_tArray txdata_arr = NULL;
10361         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10362         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10363         for (size_t c = 0; c < txdata_var.datalen; c++) {
10364                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10365                 *txdata_conv_28_conv = txdata_var.data[c];
10366                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
10367         }
10368         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10369         FREE(txdata_var.data);
10370         int32_t height_conv = height;
10371         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10372         CHECK(obj != NULL);
10373         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
10374         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10375                 (*env)->ExceptionDescribe(env);
10376                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
10377         }
10378         if (get_jenv_res == JNI_EDETACHED) {
10379                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10380         }
10381 }
10382 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
10383         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10384         JNIEnv *env;
10385         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10386         if (get_jenv_res == JNI_EDETACHED) {
10387                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10388         } else {
10389                 DO_ASSERT(get_jenv_res == JNI_OK);
10390         }
10391         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10392         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10393         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10394         CHECK(obj != NULL);
10395         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
10396         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10397                 (*env)->ExceptionDescribe(env);
10398                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
10399         }
10400         if (get_jenv_res == JNI_EDETACHED) {
10401                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10402         }
10403 }
10404 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10405         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10406         JNIEnv *env;
10407         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10408         if (get_jenv_res == JNI_EDETACHED) {
10409                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10410         } else {
10411                 DO_ASSERT(get_jenv_res == JNI_OK);
10412         }
10413         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10414         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10415         int32_t height_conv = height;
10416         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10417         CHECK(obj != NULL);
10418         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
10419         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10420                 (*env)->ExceptionDescribe(env);
10421                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
10422         }
10423         if (get_jenv_res == JNI_EDETACHED) {
10424                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10425         }
10426 }
10427 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
10428         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10429         JNIEnv *env;
10430         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10431         if (get_jenv_res == JNI_EDETACHED) {
10432                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10433         } else {
10434                 DO_ASSERT(get_jenv_res == JNI_OK);
10435         }
10436         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10437         CHECK(obj != NULL);
10438         jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
10439         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10440                 (*env)->ExceptionDescribe(env);
10441                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
10442         }
10443         LDKCVec_TxidZ ret_constr;
10444         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10445         if (ret_constr.datalen > 0)
10446                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10447         else
10448                 ret_constr.data = NULL;
10449         for (size_t i = 0; i < ret_constr.datalen; i++) {
10450                 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
10451                 LDKThirtyTwoBytes ret_conv_8_ref;
10452                 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
10453                 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
10454                 ret_constr.data[i] = ret_conv_8_ref;
10455         }
10456         if (get_jenv_res == JNI_EDETACHED) {
10457                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10458         }
10459         return ret_constr;
10460 }
10461 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
10462         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
10463         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10464 }
10465 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
10466         jclass c = (*env)->GetObjectClass(env, o);
10467         CHECK(c != NULL);
10468         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
10469         atomic_init(&calls->refcnt, 1);
10470         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10471         calls->o = (*env)->NewWeakGlobalRef(env, o);
10472         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
10473         CHECK(calls->transactions_confirmed_meth != NULL);
10474         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
10475         CHECK(calls->transaction_unconfirmed_meth != NULL);
10476         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
10477         CHECK(calls->best_block_updated_meth != NULL);
10478         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
10479         CHECK(calls->get_relevant_txids_meth != NULL);
10480
10481         LDKConfirm ret = {
10482                 .this_arg = (void*) calls,
10483                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
10484                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
10485                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
10486                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
10487                 .free = LDKConfirm_JCalls_free,
10488         };
10489         return ret;
10490 }
10491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
10492         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
10493         *res_ptr = LDKConfirm_init(env, clz, o);
10494         return tag_ptr(res_ptr, true);
10495 }
10496 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) {
10497         void* this_arg_ptr = untag_ptr(this_arg);
10498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10499         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10500         unsigned char header_arr[80];
10501         CHECK((*env)->GetArrayLength(env, header) == 80);
10502         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10503         unsigned char (*header_ref)[80] = &header_arr;
10504         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10505         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10506         if (txdata_constr.datalen > 0)
10507                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10508         else
10509                 txdata_constr.data = NULL;
10510         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10511         for (size_t c = 0; c < txdata_constr.datalen; c++) {
10512                 int64_t txdata_conv_28 = txdata_vals[c];
10513                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
10514                 CHECK_ACCESS(txdata_conv_28_ptr);
10515                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10516                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
10517                 txdata_constr.data[c] = txdata_conv_28_conv;
10518         }
10519         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10520         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10521 }
10522
10523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
10524         void* this_arg_ptr = untag_ptr(this_arg);
10525         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10526         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10527         unsigned char txid_arr[32];
10528         CHECK((*env)->GetArrayLength(env, txid) == 32);
10529         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10530         unsigned char (*txid_ref)[32] = &txid_arr;
10531         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
10532 }
10533
10534 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) {
10535         void* this_arg_ptr = untag_ptr(this_arg);
10536         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10537         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10538         unsigned char header_arr[80];
10539         CHECK((*env)->GetArrayLength(env, header) == 80);
10540         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10541         unsigned char (*header_ref)[80] = &header_arr;
10542         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
10543 }
10544
10545 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
10546         void* this_arg_ptr = untag_ptr(this_arg);
10547         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10548         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10549         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
10550         jobjectArray ret_arr = NULL;
10551         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10552         ;
10553         for (size_t i = 0; i < ret_var.datalen; i++) {
10554                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
10555                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
10556                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10557         }
10558         
10559         FREE(ret_var.data);
10560         return ret_arr;
10561 }
10562
10563 typedef struct LDKPersist_JCalls {
10564         atomic_size_t refcnt;
10565         JavaVM *vm;
10566         jweak o;
10567         jmethodID persist_new_channel_meth;
10568         jmethodID update_persisted_channel_meth;
10569 } LDKPersist_JCalls;
10570 static void LDKPersist_JCalls_free(void* this_arg) {
10571         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10572         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10573                 JNIEnv *env;
10574                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10575                 if (get_jenv_res == JNI_EDETACHED) {
10576                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10577                 } else {
10578                         DO_ASSERT(get_jenv_res == JNI_OK);
10579                 }
10580                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10581                 if (get_jenv_res == JNI_EDETACHED) {
10582                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10583                 }
10584                 FREE(j_calls);
10585         }
10586 }
10587 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10588         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10589         JNIEnv *env;
10590         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10591         if (get_jenv_res == JNI_EDETACHED) {
10592                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10593         } else {
10594                 DO_ASSERT(get_jenv_res == JNI_OK);
10595         }
10596         LDKOutPoint channel_id_var = channel_id;
10597         int64_t channel_id_ref = 0;
10598         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10599         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
10600         LDKChannelMonitor data_var = *data;
10601         int64_t data_ref = 0;
10602         data_var = ChannelMonitor_clone(&data_var);
10603         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10604         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
10605         LDKMonitorUpdateId update_id_var = update_id;
10606         int64_t update_id_ref = 0;
10607         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10608         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
10609         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10610         CHECK(obj != NULL);
10611         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
10612         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10613                 (*env)->ExceptionDescribe(env);
10614                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
10615         }
10616         void* ret_ptr = untag_ptr(ret);
10617         CHECK_ACCESS(ret_ptr);
10618         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10619         FREE(untag_ptr(ret));
10620         if (get_jenv_res == JNI_EDETACHED) {
10621                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10622         }
10623         return ret_conv;
10624 }
10625 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10626         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10627         JNIEnv *env;
10628         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10629         if (get_jenv_res == JNI_EDETACHED) {
10630                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10631         } else {
10632                 DO_ASSERT(get_jenv_res == JNI_OK);
10633         }
10634         LDKOutPoint channel_id_var = channel_id;
10635         int64_t channel_id_ref = 0;
10636         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10637         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
10638         LDKChannelMonitorUpdate update_var = *update;
10639         int64_t update_ref = 0;
10640         update_var = ChannelMonitorUpdate_clone(&update_var);
10641         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
10642         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
10643         LDKChannelMonitor data_var = *data;
10644         int64_t data_ref = 0;
10645         data_var = ChannelMonitor_clone(&data_var);
10646         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10647         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
10648         LDKMonitorUpdateId update_id_var = update_id;
10649         int64_t update_id_ref = 0;
10650         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10651         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
10652         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10653         CHECK(obj != NULL);
10654         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
10655         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10656                 (*env)->ExceptionDescribe(env);
10657                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
10658         }
10659         void* ret_ptr = untag_ptr(ret);
10660         CHECK_ACCESS(ret_ptr);
10661         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10662         FREE(untag_ptr(ret));
10663         if (get_jenv_res == JNI_EDETACHED) {
10664                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10665         }
10666         return ret_conv;
10667 }
10668 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
10669         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
10670         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10671 }
10672 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
10673         jclass c = (*env)->GetObjectClass(env, o);
10674         CHECK(c != NULL);
10675         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
10676         atomic_init(&calls->refcnt, 1);
10677         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10678         calls->o = (*env)->NewWeakGlobalRef(env, o);
10679         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
10680         CHECK(calls->persist_new_channel_meth != NULL);
10681         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
10682         CHECK(calls->update_persisted_channel_meth != NULL);
10683
10684         LDKPersist ret = {
10685                 .this_arg = (void*) calls,
10686                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
10687                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
10688                 .free = LDKPersist_JCalls_free,
10689         };
10690         return ret;
10691 }
10692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
10693         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
10694         *res_ptr = LDKPersist_init(env, clz, o);
10695         return tag_ptr(res_ptr, true);
10696 }
10697 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) {
10698         void* this_arg_ptr = untag_ptr(this_arg);
10699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10700         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10701         LDKOutPoint channel_id_conv;
10702         channel_id_conv.inner = untag_ptr(channel_id);
10703         channel_id_conv.is_owned = ptr_is_owned(channel_id);
10704         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10705         channel_id_conv = OutPoint_clone(&channel_id_conv);
10706         LDKChannelMonitor data_conv;
10707         data_conv.inner = untag_ptr(data);
10708         data_conv.is_owned = ptr_is_owned(data);
10709         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10710         data_conv.is_owned = false;
10711         LDKMonitorUpdateId update_id_conv;
10712         update_id_conv.inner = untag_ptr(update_id);
10713         update_id_conv.is_owned = ptr_is_owned(update_id);
10714         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10715         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10716         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10717         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
10718         return tag_ptr(ret_conv, true);
10719 }
10720
10721 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) {
10722         void* this_arg_ptr = untag_ptr(this_arg);
10723         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10724         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10725         LDKOutPoint channel_id_conv;
10726         channel_id_conv.inner = untag_ptr(channel_id);
10727         channel_id_conv.is_owned = ptr_is_owned(channel_id);
10728         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10729         channel_id_conv = OutPoint_clone(&channel_id_conv);
10730         LDKChannelMonitorUpdate update_conv;
10731         update_conv.inner = untag_ptr(update);
10732         update_conv.is_owned = ptr_is_owned(update);
10733         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
10734         update_conv.is_owned = false;
10735         LDKChannelMonitor data_conv;
10736         data_conv.inner = untag_ptr(data);
10737         data_conv.is_owned = ptr_is_owned(data);
10738         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10739         data_conv.is_owned = false;
10740         LDKMonitorUpdateId update_id_conv;
10741         update_id_conv.inner = untag_ptr(update_id);
10742         update_id_conv.is_owned = ptr_is_owned(update_id);
10743         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10744         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10745         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10746         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
10747         return tag_ptr(ret_conv, true);
10748 }
10749
10750 typedef struct LDKChannelMessageHandler_JCalls {
10751         atomic_size_t refcnt;
10752         JavaVM *vm;
10753         jweak o;
10754         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10755         jmethodID handle_open_channel_meth;
10756         jmethodID handle_accept_channel_meth;
10757         jmethodID handle_funding_created_meth;
10758         jmethodID handle_funding_signed_meth;
10759         jmethodID handle_channel_ready_meth;
10760         jmethodID handle_shutdown_meth;
10761         jmethodID handle_closing_signed_meth;
10762         jmethodID handle_update_add_htlc_meth;
10763         jmethodID handle_update_fulfill_htlc_meth;
10764         jmethodID handle_update_fail_htlc_meth;
10765         jmethodID handle_update_fail_malformed_htlc_meth;
10766         jmethodID handle_commitment_signed_meth;
10767         jmethodID handle_revoke_and_ack_meth;
10768         jmethodID handle_update_fee_meth;
10769         jmethodID handle_announcement_signatures_meth;
10770         jmethodID peer_disconnected_meth;
10771         jmethodID peer_connected_meth;
10772         jmethodID handle_channel_reestablish_meth;
10773         jmethodID handle_channel_update_meth;
10774         jmethodID handle_error_meth;
10775 } LDKChannelMessageHandler_JCalls;
10776 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10777         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10778         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10779                 JNIEnv *env;
10780                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10781                 if (get_jenv_res == JNI_EDETACHED) {
10782                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10783                 } else {
10784                         DO_ASSERT(get_jenv_res == JNI_OK);
10785                 }
10786                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10787                 if (get_jenv_res == JNI_EDETACHED) {
10788                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10789                 }
10790                 FREE(j_calls);
10791         }
10792 }
10793 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
10794         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10795         JNIEnv *env;
10796         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10797         if (get_jenv_res == JNI_EDETACHED) {
10798                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10799         } else {
10800                 DO_ASSERT(get_jenv_res == JNI_OK);
10801         }
10802         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10803         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10804         LDKInitFeatures their_features_var = their_features;
10805         int64_t their_features_ref = 0;
10806         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10807         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
10808         LDKOpenChannel msg_var = *msg;
10809         int64_t msg_ref = 0;
10810         msg_var = OpenChannel_clone(&msg_var);
10811         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10812         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10813         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10814         CHECK(obj != NULL);
10815         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10816         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10817                 (*env)->ExceptionDescribe(env);
10818                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
10819         }
10820         if (get_jenv_res == JNI_EDETACHED) {
10821                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10822         }
10823 }
10824 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
10825         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10826         JNIEnv *env;
10827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10828         if (get_jenv_res == JNI_EDETACHED) {
10829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10830         } else {
10831                 DO_ASSERT(get_jenv_res == JNI_OK);
10832         }
10833         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10834         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10835         LDKInitFeatures their_features_var = their_features;
10836         int64_t their_features_ref = 0;
10837         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10838         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
10839         LDKAcceptChannel msg_var = *msg;
10840         int64_t msg_ref = 0;
10841         msg_var = AcceptChannel_clone(&msg_var);
10842         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10843         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10844         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10845         CHECK(obj != NULL);
10846         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10847         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10848                 (*env)->ExceptionDescribe(env);
10849                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
10850         }
10851         if (get_jenv_res == JNI_EDETACHED) {
10852                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10853         }
10854 }
10855 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10856         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10857         JNIEnv *env;
10858         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10859         if (get_jenv_res == JNI_EDETACHED) {
10860                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10861         } else {
10862                 DO_ASSERT(get_jenv_res == JNI_OK);
10863         }
10864         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10865         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10866         LDKFundingCreated msg_var = *msg;
10867         int64_t msg_ref = 0;
10868         msg_var = FundingCreated_clone(&msg_var);
10869         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10870         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10871         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10872         CHECK(obj != NULL);
10873         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
10874         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10875                 (*env)->ExceptionDescribe(env);
10876                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
10877         }
10878         if (get_jenv_res == JNI_EDETACHED) {
10879                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10880         }
10881 }
10882 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
10883         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10884         JNIEnv *env;
10885         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10886         if (get_jenv_res == JNI_EDETACHED) {
10887                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10888         } else {
10889                 DO_ASSERT(get_jenv_res == JNI_OK);
10890         }
10891         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10892         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10893         LDKFundingSigned msg_var = *msg;
10894         int64_t msg_ref = 0;
10895         msg_var = FundingSigned_clone(&msg_var);
10896         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10897         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10898         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10899         CHECK(obj != NULL);
10900         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
10901         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10902                 (*env)->ExceptionDescribe(env);
10903                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
10904         }
10905         if (get_jenv_res == JNI_EDETACHED) {
10906                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10907         }
10908 }
10909 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
10910         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10911         JNIEnv *env;
10912         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10913         if (get_jenv_res == JNI_EDETACHED) {
10914                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10915         } else {
10916                 DO_ASSERT(get_jenv_res == JNI_OK);
10917         }
10918         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10919         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10920         LDKChannelReady msg_var = *msg;
10921         int64_t msg_ref = 0;
10922         msg_var = ChannelReady_clone(&msg_var);
10923         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10924         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10925         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10926         CHECK(obj != NULL);
10927         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
10928         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10929                 (*env)->ExceptionDescribe(env);
10930                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
10931         }
10932         if (get_jenv_res == JNI_EDETACHED) {
10933                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10934         }
10935 }
10936 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
10937         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10938         JNIEnv *env;
10939         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10940         if (get_jenv_res == JNI_EDETACHED) {
10941                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10942         } else {
10943                 DO_ASSERT(get_jenv_res == JNI_OK);
10944         }
10945         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10946         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10947         LDKInitFeatures their_features_var = *their_features;
10948         int64_t their_features_ref = 0;
10949         their_features_var = InitFeatures_clone(&their_features_var);
10950         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10951         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
10952         LDKShutdown msg_var = *msg;
10953         int64_t msg_ref = 0;
10954         msg_var = Shutdown_clone(&msg_var);
10955         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10956         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10957         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10958         CHECK(obj != NULL);
10959         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
10960         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10961                 (*env)->ExceptionDescribe(env);
10962                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
10963         }
10964         if (get_jenv_res == JNI_EDETACHED) {
10965                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10966         }
10967 }
10968 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
10969         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10970         JNIEnv *env;
10971         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10972         if (get_jenv_res == JNI_EDETACHED) {
10973                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10974         } else {
10975                 DO_ASSERT(get_jenv_res == JNI_OK);
10976         }
10977         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10978         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10979         LDKClosingSigned msg_var = *msg;
10980         int64_t msg_ref = 0;
10981         msg_var = ClosingSigned_clone(&msg_var);
10982         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10983         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10984         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10985         CHECK(obj != NULL);
10986         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
10987         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10988                 (*env)->ExceptionDescribe(env);
10989                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
10990         }
10991         if (get_jenv_res == JNI_EDETACHED) {
10992                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10993         }
10994 }
10995 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
10996         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10997         JNIEnv *env;
10998         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10999         if (get_jenv_res == JNI_EDETACHED) {
11000                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11001         } else {
11002                 DO_ASSERT(get_jenv_res == JNI_OK);
11003         }
11004         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11005         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11006         LDKUpdateAddHTLC msg_var = *msg;
11007         int64_t msg_ref = 0;
11008         msg_var = UpdateAddHTLC_clone(&msg_var);
11009         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11010         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11011         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11012         CHECK(obj != NULL);
11013         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11014         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11015                 (*env)->ExceptionDescribe(env);
11016                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11017         }
11018         if (get_jenv_res == JNI_EDETACHED) {
11019                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11020         }
11021 }
11022 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11023         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11024         JNIEnv *env;
11025         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11026         if (get_jenv_res == JNI_EDETACHED) {
11027                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11028         } else {
11029                 DO_ASSERT(get_jenv_res == JNI_OK);
11030         }
11031         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11032         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11033         LDKUpdateFulfillHTLC msg_var = *msg;
11034         int64_t msg_ref = 0;
11035         msg_var = UpdateFulfillHTLC_clone(&msg_var);
11036         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11037         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11038         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11039         CHECK(obj != NULL);
11040         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11041         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11042                 (*env)->ExceptionDescribe(env);
11043                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11044         }
11045         if (get_jenv_res == JNI_EDETACHED) {
11046                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11047         }
11048 }
11049 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11050         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11051         JNIEnv *env;
11052         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11053         if (get_jenv_res == JNI_EDETACHED) {
11054                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11055         } else {
11056                 DO_ASSERT(get_jenv_res == JNI_OK);
11057         }
11058         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11059         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11060         LDKUpdateFailHTLC msg_var = *msg;
11061         int64_t msg_ref = 0;
11062         msg_var = UpdateFailHTLC_clone(&msg_var);
11063         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11064         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11065         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11066         CHECK(obj != NULL);
11067         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11068         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11069                 (*env)->ExceptionDescribe(env);
11070                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11071         }
11072         if (get_jenv_res == JNI_EDETACHED) {
11073                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11074         }
11075 }
11076 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11077         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11078         JNIEnv *env;
11079         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11080         if (get_jenv_res == JNI_EDETACHED) {
11081                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11082         } else {
11083                 DO_ASSERT(get_jenv_res == JNI_OK);
11084         }
11085         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11086         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11087         LDKUpdateFailMalformedHTLC msg_var = *msg;
11088         int64_t msg_ref = 0;
11089         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11090         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11091         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11092         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11093         CHECK(obj != NULL);
11094         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
11095         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11096                 (*env)->ExceptionDescribe(env);
11097                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
11098         }
11099         if (get_jenv_res == JNI_EDETACHED) {
11100                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11101         }
11102 }
11103 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11104         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11105         JNIEnv *env;
11106         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11107         if (get_jenv_res == JNI_EDETACHED) {
11108                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11109         } else {
11110                 DO_ASSERT(get_jenv_res == JNI_OK);
11111         }
11112         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11113         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11114         LDKCommitmentSigned msg_var = *msg;
11115         int64_t msg_ref = 0;
11116         msg_var = CommitmentSigned_clone(&msg_var);
11117         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11118         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11119         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11120         CHECK(obj != NULL);
11121         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
11122         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11123                 (*env)->ExceptionDescribe(env);
11124                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
11125         }
11126         if (get_jenv_res == JNI_EDETACHED) {
11127                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11128         }
11129 }
11130 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11131         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11132         JNIEnv *env;
11133         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11134         if (get_jenv_res == JNI_EDETACHED) {
11135                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11136         } else {
11137                 DO_ASSERT(get_jenv_res == JNI_OK);
11138         }
11139         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11140         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11141         LDKRevokeAndACK msg_var = *msg;
11142         int64_t msg_ref = 0;
11143         msg_var = RevokeAndACK_clone(&msg_var);
11144         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11145         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11146         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11147         CHECK(obj != NULL);
11148         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
11149         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11150                 (*env)->ExceptionDescribe(env);
11151                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
11152         }
11153         if (get_jenv_res == JNI_EDETACHED) {
11154                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11155         }
11156 }
11157 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11158         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11159         JNIEnv *env;
11160         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11161         if (get_jenv_res == JNI_EDETACHED) {
11162                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11163         } else {
11164                 DO_ASSERT(get_jenv_res == JNI_OK);
11165         }
11166         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11167         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11168         LDKUpdateFee msg_var = *msg;
11169         int64_t msg_ref = 0;
11170         msg_var = UpdateFee_clone(&msg_var);
11171         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11172         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11173         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11174         CHECK(obj != NULL);
11175         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
11176         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11177                 (*env)->ExceptionDescribe(env);
11178                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
11179         }
11180         if (get_jenv_res == JNI_EDETACHED) {
11181                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11182         }
11183 }
11184 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11185         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11186         JNIEnv *env;
11187         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11188         if (get_jenv_res == JNI_EDETACHED) {
11189                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11190         } else {
11191                 DO_ASSERT(get_jenv_res == JNI_OK);
11192         }
11193         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11194         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11195         LDKAnnouncementSignatures msg_var = *msg;
11196         int64_t msg_ref = 0;
11197         msg_var = AnnouncementSignatures_clone(&msg_var);
11198         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11199         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11200         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11201         CHECK(obj != NULL);
11202         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
11203         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11204                 (*env)->ExceptionDescribe(env);
11205                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
11206         }
11207         if (get_jenv_res == JNI_EDETACHED) {
11208                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11209         }
11210 }
11211 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
11212         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11213         JNIEnv *env;
11214         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11215         if (get_jenv_res == JNI_EDETACHED) {
11216                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11217         } else {
11218                 DO_ASSERT(get_jenv_res == JNI_OK);
11219         }
11220         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11221         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11222         jboolean no_connection_possible_conv = no_connection_possible;
11223         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11224         CHECK(obj != NULL);
11225         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
11226         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11227                 (*env)->ExceptionDescribe(env);
11228                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
11229         }
11230         if (get_jenv_res == JNI_EDETACHED) {
11231                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11232         }
11233 }
11234 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
11235         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11236         JNIEnv *env;
11237         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11238         if (get_jenv_res == JNI_EDETACHED) {
11239                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11240         } else {
11241                 DO_ASSERT(get_jenv_res == JNI_OK);
11242         }
11243         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11244         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11245         LDKInit msg_var = *msg;
11246         int64_t msg_ref = 0;
11247         msg_var = Init_clone(&msg_var);
11248         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11249         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11250         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11251         CHECK(obj != NULL);
11252         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
11253         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11254                 (*env)->ExceptionDescribe(env);
11255                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
11256         }
11257         if (get_jenv_res == JNI_EDETACHED) {
11258                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11259         }
11260 }
11261 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
11262         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11263         JNIEnv *env;
11264         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11265         if (get_jenv_res == JNI_EDETACHED) {
11266                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11267         } else {
11268                 DO_ASSERT(get_jenv_res == JNI_OK);
11269         }
11270         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11271         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11272         LDKChannelReestablish msg_var = *msg;
11273         int64_t msg_ref = 0;
11274         msg_var = ChannelReestablish_clone(&msg_var);
11275         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11276         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11277         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11278         CHECK(obj != NULL);
11279         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
11280         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11281                 (*env)->ExceptionDescribe(env);
11282                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
11283         }
11284         if (get_jenv_res == JNI_EDETACHED) {
11285                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11286         }
11287 }
11288 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11289         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11290         JNIEnv *env;
11291         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11292         if (get_jenv_res == JNI_EDETACHED) {
11293                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11294         } else {
11295                 DO_ASSERT(get_jenv_res == JNI_OK);
11296         }
11297         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11298         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11299         LDKChannelUpdate msg_var = *msg;
11300         int64_t msg_ref = 0;
11301         msg_var = ChannelUpdate_clone(&msg_var);
11302         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11303         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11304         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11305         CHECK(obj != NULL);
11306         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
11307         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11308                 (*env)->ExceptionDescribe(env);
11309                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
11310         }
11311         if (get_jenv_res == JNI_EDETACHED) {
11312                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11313         }
11314 }
11315 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11316         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11317         JNIEnv *env;
11318         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11319         if (get_jenv_res == JNI_EDETACHED) {
11320                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11321         } else {
11322                 DO_ASSERT(get_jenv_res == JNI_OK);
11323         }
11324         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11325         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11326         LDKErrorMessage msg_var = *msg;
11327         int64_t msg_ref = 0;
11328         msg_var = ErrorMessage_clone(&msg_var);
11329         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11330         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11331         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11332         CHECK(obj != NULL);
11333         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
11334         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11335                 (*env)->ExceptionDescribe(env);
11336                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
11337         }
11338         if (get_jenv_res == JNI_EDETACHED) {
11339                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11340         }
11341 }
11342 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11343         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11344         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11345         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11346 }
11347 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11348         jclass c = (*env)->GetObjectClass(env, o);
11349         CHECK(c != NULL);
11350         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11351         atomic_init(&calls->refcnt, 1);
11352         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11353         calls->o = (*env)->NewWeakGlobalRef(env, o);
11354         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
11355         CHECK(calls->handle_open_channel_meth != NULL);
11356         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
11357         CHECK(calls->handle_accept_channel_meth != NULL);
11358         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
11359         CHECK(calls->handle_funding_created_meth != NULL);
11360         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
11361         CHECK(calls->handle_funding_signed_meth != NULL);
11362         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
11363         CHECK(calls->handle_channel_ready_meth != NULL);
11364         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
11365         CHECK(calls->handle_shutdown_meth != NULL);
11366         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
11367         CHECK(calls->handle_closing_signed_meth != NULL);
11368         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
11369         CHECK(calls->handle_update_add_htlc_meth != NULL);
11370         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
11371         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
11372         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
11373         CHECK(calls->handle_update_fail_htlc_meth != NULL);
11374         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
11375         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
11376         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
11377         CHECK(calls->handle_commitment_signed_meth != NULL);
11378         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
11379         CHECK(calls->handle_revoke_and_ack_meth != NULL);
11380         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
11381         CHECK(calls->handle_update_fee_meth != NULL);
11382         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
11383         CHECK(calls->handle_announcement_signatures_meth != NULL);
11384         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
11385         CHECK(calls->peer_disconnected_meth != NULL);
11386         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
11387         CHECK(calls->peer_connected_meth != NULL);
11388         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
11389         CHECK(calls->handle_channel_reestablish_meth != NULL);
11390         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
11391         CHECK(calls->handle_channel_update_meth != NULL);
11392         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
11393         CHECK(calls->handle_error_meth != NULL);
11394
11395         LDKChannelMessageHandler ret = {
11396                 .this_arg = (void*) calls,
11397                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11398                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11399                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
11400                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
11401                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
11402                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
11403                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
11404                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
11405                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
11406                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
11407                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
11408                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
11409                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
11410                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
11411                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
11412                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
11413                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
11414                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
11415                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
11416                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
11417                 .free = LDKChannelMessageHandler_JCalls_free,
11418                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11419         };
11420         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11421         return ret;
11422 }
11423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11424         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11425         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11426         return tag_ptr(res_ptr, true);
11427 }
11428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11429         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
11430         return tag_ptr(&inp->MessageSendEventsProvider, false);
11431 }
11432 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) {
11433         void* this_arg_ptr = untag_ptr(this_arg);
11434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11435         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11436         LDKPublicKey their_node_id_ref;
11437         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11438         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11439         LDKInitFeatures their_features_conv;
11440         their_features_conv.inner = untag_ptr(their_features);
11441         their_features_conv.is_owned = ptr_is_owned(their_features);
11442         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11443         their_features_conv = InitFeatures_clone(&their_features_conv);
11444         LDKOpenChannel msg_conv;
11445         msg_conv.inner = untag_ptr(msg);
11446         msg_conv.is_owned = ptr_is_owned(msg);
11447         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11448         msg_conv.is_owned = false;
11449         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11450 }
11451
11452 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) {
11453         void* this_arg_ptr = untag_ptr(this_arg);
11454         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11455         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11456         LDKPublicKey their_node_id_ref;
11457         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11458         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11459         LDKInitFeatures their_features_conv;
11460         their_features_conv.inner = untag_ptr(their_features);
11461         their_features_conv.is_owned = ptr_is_owned(their_features);
11462         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11463         their_features_conv = InitFeatures_clone(&their_features_conv);
11464         LDKAcceptChannel msg_conv;
11465         msg_conv.inner = untag_ptr(msg);
11466         msg_conv.is_owned = ptr_is_owned(msg);
11467         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11468         msg_conv.is_owned = false;
11469         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11470 }
11471
11472 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) {
11473         void* this_arg_ptr = untag_ptr(this_arg);
11474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11475         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11476         LDKPublicKey their_node_id_ref;
11477         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11478         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11479         LDKFundingCreated msg_conv;
11480         msg_conv.inner = untag_ptr(msg);
11481         msg_conv.is_owned = ptr_is_owned(msg);
11482         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11483         msg_conv.is_owned = false;
11484         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11485 }
11486
11487 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) {
11488         void* this_arg_ptr = untag_ptr(this_arg);
11489         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11490         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11491         LDKPublicKey their_node_id_ref;
11492         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11493         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11494         LDKFundingSigned msg_conv;
11495         msg_conv.inner = untag_ptr(msg);
11496         msg_conv.is_owned = ptr_is_owned(msg);
11497         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11498         msg_conv.is_owned = false;
11499         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11500 }
11501
11502 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) {
11503         void* this_arg_ptr = untag_ptr(this_arg);
11504         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11505         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11506         LDKPublicKey their_node_id_ref;
11507         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11508         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11509         LDKChannelReady msg_conv;
11510         msg_conv.inner = untag_ptr(msg);
11511         msg_conv.is_owned = ptr_is_owned(msg);
11512         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11513         msg_conv.is_owned = false;
11514         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11515 }
11516
11517 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) {
11518         void* this_arg_ptr = untag_ptr(this_arg);
11519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11520         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11521         LDKPublicKey their_node_id_ref;
11522         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11523         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11524         LDKInitFeatures their_features_conv;
11525         their_features_conv.inner = untag_ptr(their_features);
11526         their_features_conv.is_owned = ptr_is_owned(their_features);
11527         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11528         their_features_conv.is_owned = false;
11529         LDKShutdown msg_conv;
11530         msg_conv.inner = untag_ptr(msg);
11531         msg_conv.is_owned = ptr_is_owned(msg);
11532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11533         msg_conv.is_owned = false;
11534         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
11535 }
11536
11537 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) {
11538         void* this_arg_ptr = untag_ptr(this_arg);
11539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11540         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11541         LDKPublicKey their_node_id_ref;
11542         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11543         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11544         LDKClosingSigned msg_conv;
11545         msg_conv.inner = untag_ptr(msg);
11546         msg_conv.is_owned = ptr_is_owned(msg);
11547         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11548         msg_conv.is_owned = false;
11549         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11550 }
11551
11552 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) {
11553         void* this_arg_ptr = untag_ptr(this_arg);
11554         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11555         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11556         LDKPublicKey their_node_id_ref;
11557         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11558         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11559         LDKUpdateAddHTLC msg_conv;
11560         msg_conv.inner = untag_ptr(msg);
11561         msg_conv.is_owned = ptr_is_owned(msg);
11562         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11563         msg_conv.is_owned = false;
11564         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11565 }
11566
11567 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) {
11568         void* this_arg_ptr = untag_ptr(this_arg);
11569         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11570         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11571         LDKPublicKey their_node_id_ref;
11572         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11573         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11574         LDKUpdateFulfillHTLC msg_conv;
11575         msg_conv.inner = untag_ptr(msg);
11576         msg_conv.is_owned = ptr_is_owned(msg);
11577         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11578         msg_conv.is_owned = false;
11579         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11580 }
11581
11582 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) {
11583         void* this_arg_ptr = untag_ptr(this_arg);
11584         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11585         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11586         LDKPublicKey their_node_id_ref;
11587         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11588         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11589         LDKUpdateFailHTLC msg_conv;
11590         msg_conv.inner = untag_ptr(msg);
11591         msg_conv.is_owned = ptr_is_owned(msg);
11592         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11593         msg_conv.is_owned = false;
11594         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11595 }
11596
11597 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) {
11598         void* this_arg_ptr = untag_ptr(this_arg);
11599         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11600         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11601         LDKPublicKey their_node_id_ref;
11602         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11603         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11604         LDKUpdateFailMalformedHTLC msg_conv;
11605         msg_conv.inner = untag_ptr(msg);
11606         msg_conv.is_owned = ptr_is_owned(msg);
11607         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11608         msg_conv.is_owned = false;
11609         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11610 }
11611
11612 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) {
11613         void* this_arg_ptr = untag_ptr(this_arg);
11614         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11615         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11616         LDKPublicKey their_node_id_ref;
11617         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11618         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11619         LDKCommitmentSigned msg_conv;
11620         msg_conv.inner = untag_ptr(msg);
11621         msg_conv.is_owned = ptr_is_owned(msg);
11622         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11623         msg_conv.is_owned = false;
11624         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11625 }
11626
11627 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) {
11628         void* this_arg_ptr = untag_ptr(this_arg);
11629         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11630         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11631         LDKPublicKey their_node_id_ref;
11632         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11633         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11634         LDKRevokeAndACK msg_conv;
11635         msg_conv.inner = untag_ptr(msg);
11636         msg_conv.is_owned = ptr_is_owned(msg);
11637         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11638         msg_conv.is_owned = false;
11639         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11640 }
11641
11642 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) {
11643         void* this_arg_ptr = untag_ptr(this_arg);
11644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11645         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11646         LDKPublicKey their_node_id_ref;
11647         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11648         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11649         LDKUpdateFee msg_conv;
11650         msg_conv.inner = untag_ptr(msg);
11651         msg_conv.is_owned = ptr_is_owned(msg);
11652         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11653         msg_conv.is_owned = false;
11654         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11655 }
11656
11657 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) {
11658         void* this_arg_ptr = untag_ptr(this_arg);
11659         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11660         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11661         LDKPublicKey their_node_id_ref;
11662         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11663         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11664         LDKAnnouncementSignatures msg_conv;
11665         msg_conv.inner = untag_ptr(msg);
11666         msg_conv.is_owned = ptr_is_owned(msg);
11667         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11668         msg_conv.is_owned = false;
11669         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11670 }
11671
11672 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) {
11673         void* this_arg_ptr = untag_ptr(this_arg);
11674         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11675         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11676         LDKPublicKey their_node_id_ref;
11677         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11678         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11679         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
11680 }
11681
11682 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) {
11683         void* this_arg_ptr = untag_ptr(this_arg);
11684         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11685         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11686         LDKPublicKey their_node_id_ref;
11687         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11688         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11689         LDKInit msg_conv;
11690         msg_conv.inner = untag_ptr(msg);
11691         msg_conv.is_owned = ptr_is_owned(msg);
11692         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11693         msg_conv.is_owned = false;
11694         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11695 }
11696
11697 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) {
11698         void* this_arg_ptr = untag_ptr(this_arg);
11699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11700         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11701         LDKPublicKey their_node_id_ref;
11702         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11703         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11704         LDKChannelReestablish msg_conv;
11705         msg_conv.inner = untag_ptr(msg);
11706         msg_conv.is_owned = ptr_is_owned(msg);
11707         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11708         msg_conv.is_owned = false;
11709         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11710 }
11711
11712 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) {
11713         void* this_arg_ptr = untag_ptr(this_arg);
11714         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11715         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11716         LDKPublicKey their_node_id_ref;
11717         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11718         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11719         LDKChannelUpdate msg_conv;
11720         msg_conv.inner = untag_ptr(msg);
11721         msg_conv.is_owned = ptr_is_owned(msg);
11722         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11723         msg_conv.is_owned = false;
11724         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11725 }
11726
11727 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) {
11728         void* this_arg_ptr = untag_ptr(this_arg);
11729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11730         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11731         LDKPublicKey their_node_id_ref;
11732         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11733         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11734         LDKErrorMessage msg_conv;
11735         msg_conv.inner = untag_ptr(msg);
11736         msg_conv.is_owned = ptr_is_owned(msg);
11737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11738         msg_conv.is_owned = false;
11739         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11740 }
11741
11742 typedef struct LDKRoutingMessageHandler_JCalls {
11743         atomic_size_t refcnt;
11744         JavaVM *vm;
11745         jweak o;
11746         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11747         jmethodID handle_node_announcement_meth;
11748         jmethodID handle_channel_announcement_meth;
11749         jmethodID handle_channel_update_meth;
11750         jmethodID get_next_channel_announcements_meth;
11751         jmethodID get_next_node_announcements_meth;
11752         jmethodID peer_connected_meth;
11753         jmethodID handle_reply_channel_range_meth;
11754         jmethodID handle_reply_short_channel_ids_end_meth;
11755         jmethodID handle_query_channel_range_meth;
11756         jmethodID handle_query_short_channel_ids_meth;
11757 } LDKRoutingMessageHandler_JCalls;
11758 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11759         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11760         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11761                 JNIEnv *env;
11762                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11763                 if (get_jenv_res == JNI_EDETACHED) {
11764                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11765                 } else {
11766                         DO_ASSERT(get_jenv_res == JNI_OK);
11767                 }
11768                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11769                 if (get_jenv_res == JNI_EDETACHED) {
11770                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11771                 }
11772                 FREE(j_calls);
11773         }
11774 }
11775 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11776         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11777         JNIEnv *env;
11778         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11779         if (get_jenv_res == JNI_EDETACHED) {
11780                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11781         } else {
11782                 DO_ASSERT(get_jenv_res == JNI_OK);
11783         }
11784         LDKNodeAnnouncement msg_var = *msg;
11785         int64_t msg_ref = 0;
11786         msg_var = NodeAnnouncement_clone(&msg_var);
11787         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11788         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11789         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11790         CHECK(obj != NULL);
11791         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11792         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11793                 (*env)->ExceptionDescribe(env);
11794                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11795         }
11796         void* ret_ptr = untag_ptr(ret);
11797         CHECK_ACCESS(ret_ptr);
11798         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11799         FREE(untag_ptr(ret));
11800         if (get_jenv_res == JNI_EDETACHED) {
11801                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11802         }
11803         return ret_conv;
11804 }
11805 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
11806         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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         LDKChannelAnnouncement msg_var = *msg;
11815         int64_t msg_ref = 0;
11816         msg_var = ChannelAnnouncement_clone(&msg_var);
11817         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11818         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11819         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11820         CHECK(obj != NULL);
11821         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
11822         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11823                 (*env)->ExceptionDescribe(env);
11824                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11825         }
11826         void* ret_ptr = untag_ptr(ret);
11827         CHECK_ACCESS(ret_ptr);
11828         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11829         FREE(untag_ptr(ret));
11830         if (get_jenv_res == JNI_EDETACHED) {
11831                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11832         }
11833         return ret_conv;
11834 }
11835 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
11836         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11837         JNIEnv *env;
11838         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11839         if (get_jenv_res == JNI_EDETACHED) {
11840                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11841         } else {
11842                 DO_ASSERT(get_jenv_res == JNI_OK);
11843         }
11844         LDKChannelUpdate msg_var = *msg;
11845         int64_t msg_ref = 0;
11846         msg_var = ChannelUpdate_clone(&msg_var);
11847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11848         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11849         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11850         CHECK(obj != NULL);
11851         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
11852         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11853                 (*env)->ExceptionDescribe(env);
11854                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
11855         }
11856         void* ret_ptr = untag_ptr(ret);
11857         CHECK_ACCESS(ret_ptr);
11858         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11859         FREE(untag_ptr(ret));
11860         if (get_jenv_res == JNI_EDETACHED) {
11861                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11862         }
11863         return ret_conv;
11864 }
11865 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
11866         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11867         JNIEnv *env;
11868         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11869         if (get_jenv_res == JNI_EDETACHED) {
11870                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11871         } else {
11872                 DO_ASSERT(get_jenv_res == JNI_OK);
11873         }
11874         int64_t starting_point_conv = starting_point;
11875         int8_t batch_amount_conv = batch_amount;
11876         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11877         CHECK(obj != NULL);
11878         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
11879         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11880                 (*env)->ExceptionDescribe(env);
11881                 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11882         }
11883         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
11884         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11885         if (ret_constr.datalen > 0)
11886                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11887         else
11888                 ret_constr.data = NULL;
11889         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11890         for (size_t h = 0; h < ret_constr.datalen; h++) {
11891                 int64_t ret_conv_59 = ret_vals[h];
11892                 void* ret_conv_59_ptr = untag_ptr(ret_conv_59);
11893                 CHECK_ACCESS(ret_conv_59_ptr);
11894                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
11895                 FREE(untag_ptr(ret_conv_59));
11896                 ret_constr.data[h] = ret_conv_59_conv;
11897         }
11898         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11899         if (get_jenv_res == JNI_EDETACHED) {
11900                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11901         }
11902         return ret_constr;
11903 }
11904 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
11905         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11906         JNIEnv *env;
11907         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11908         if (get_jenv_res == JNI_EDETACHED) {
11909                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11910         } else {
11911                 DO_ASSERT(get_jenv_res == JNI_OK);
11912         }
11913         int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
11914         (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
11915         int8_t batch_amount_conv = batch_amount;
11916         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11917         CHECK(obj != NULL);
11918         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
11919         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11920                 (*env)->ExceptionDescribe(env);
11921                 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11922         }
11923         LDKCVec_NodeAnnouncementZ ret_constr;
11924         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11925         if (ret_constr.datalen > 0)
11926                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11927         else
11928                 ret_constr.data = NULL;
11929         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11930         for (size_t s = 0; s < ret_constr.datalen; s++) {
11931                 int64_t ret_conv_18 = ret_vals[s];
11932                 LDKNodeAnnouncement ret_conv_18_conv;
11933                 ret_conv_18_conv.inner = untag_ptr(ret_conv_18);
11934                 ret_conv_18_conv.is_owned = ptr_is_owned(ret_conv_18);
11935                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
11936                 ret_constr.data[s] = ret_conv_18_conv;
11937         }
11938         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11939         if (get_jenv_res == JNI_EDETACHED) {
11940                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11941         }
11942         return ret_constr;
11943 }
11944 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
11945         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11946         JNIEnv *env;
11947         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11948         if (get_jenv_res == JNI_EDETACHED) {
11949                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11950         } else {
11951                 DO_ASSERT(get_jenv_res == JNI_OK);
11952         }
11953         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11954         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11955         LDKInit init_var = *init;
11956         int64_t init_ref = 0;
11957         init_var = Init_clone(&init_var);
11958         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
11959         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
11960         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11961         CHECK(obj != NULL);
11962         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
11963         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11964                 (*env)->ExceptionDescribe(env);
11965                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
11966         }
11967         if (get_jenv_res == JNI_EDETACHED) {
11968                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11969         }
11970 }
11971 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
11972         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11973         JNIEnv *env;
11974         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11975         if (get_jenv_res == JNI_EDETACHED) {
11976                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11977         } else {
11978                 DO_ASSERT(get_jenv_res == JNI_OK);
11979         }
11980         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11981         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11982         LDKReplyChannelRange msg_var = msg;
11983         int64_t msg_ref = 0;
11984         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11985         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11986         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11987         CHECK(obj != NULL);
11988         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
11989         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11990                 (*env)->ExceptionDescribe(env);
11991                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
11992         }
11993         void* ret_ptr = untag_ptr(ret);
11994         CHECK_ACCESS(ret_ptr);
11995         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11996         FREE(untag_ptr(ret));
11997         if (get_jenv_res == JNI_EDETACHED) {
11998                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11999         }
12000         return ret_conv;
12001 }
12002 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12003         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12004         JNIEnv *env;
12005         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12006         if (get_jenv_res == JNI_EDETACHED) {
12007                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12008         } else {
12009                 DO_ASSERT(get_jenv_res == JNI_OK);
12010         }
12011         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12012         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12013         LDKReplyShortChannelIdsEnd msg_var = msg;
12014         int64_t msg_ref = 0;
12015         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12016         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12017         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12018         CHECK(obj != NULL);
12019         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
12020         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12021                 (*env)->ExceptionDescribe(env);
12022                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
12023         }
12024         void* ret_ptr = untag_ptr(ret);
12025         CHECK_ACCESS(ret_ptr);
12026         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12027         FREE(untag_ptr(ret));
12028         if (get_jenv_res == JNI_EDETACHED) {
12029                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12030         }
12031         return ret_conv;
12032 }
12033 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12034         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12035         JNIEnv *env;
12036         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12037         if (get_jenv_res == JNI_EDETACHED) {
12038                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12039         } else {
12040                 DO_ASSERT(get_jenv_res == JNI_OK);
12041         }
12042         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12043         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12044         LDKQueryChannelRange msg_var = msg;
12045         int64_t msg_ref = 0;
12046         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12047         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12048         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12049         CHECK(obj != NULL);
12050         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
12051         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12052                 (*env)->ExceptionDescribe(env);
12053                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12054         }
12055         void* ret_ptr = untag_ptr(ret);
12056         CHECK_ACCESS(ret_ptr);
12057         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12058         FREE(untag_ptr(ret));
12059         if (get_jenv_res == JNI_EDETACHED) {
12060                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12061         }
12062         return ret_conv;
12063 }
12064 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12065         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12066         JNIEnv *env;
12067         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12068         if (get_jenv_res == JNI_EDETACHED) {
12069                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12070         } else {
12071                 DO_ASSERT(get_jenv_res == JNI_OK);
12072         }
12073         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12074         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12075         LDKQueryShortChannelIds msg_var = msg;
12076         int64_t msg_ref = 0;
12077         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12078         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12079         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12080         CHECK(obj != NULL);
12081         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
12082         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12083                 (*env)->ExceptionDescribe(env);
12084                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
12085         }
12086         void* ret_ptr = untag_ptr(ret);
12087         CHECK_ACCESS(ret_ptr);
12088         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12089         FREE(untag_ptr(ret));
12090         if (get_jenv_res == JNI_EDETACHED) {
12091                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12092         }
12093         return ret_conv;
12094 }
12095 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12096         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12097         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12098         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12099 }
12100 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12101         jclass c = (*env)->GetObjectClass(env, o);
12102         CHECK(c != NULL);
12103         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12104         atomic_init(&calls->refcnt, 1);
12105         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12106         calls->o = (*env)->NewWeakGlobalRef(env, o);
12107         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
12108         CHECK(calls->handle_node_announcement_meth != NULL);
12109         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
12110         CHECK(calls->handle_channel_announcement_meth != NULL);
12111         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
12112         CHECK(calls->handle_channel_update_meth != NULL);
12113         calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
12114         CHECK(calls->get_next_channel_announcements_meth != NULL);
12115         calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
12116         CHECK(calls->get_next_node_announcements_meth != NULL);
12117         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12118         CHECK(calls->peer_connected_meth != NULL);
12119         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
12120         CHECK(calls->handle_reply_channel_range_meth != NULL);
12121         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
12122         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
12123         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
12124         CHECK(calls->handle_query_channel_range_meth != NULL);
12125         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
12126         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
12127
12128         LDKRoutingMessageHandler ret = {
12129                 .this_arg = (void*) calls,
12130                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12131                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12132                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12133                 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
12134                 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
12135                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12136                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12137                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12138                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12139                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12140                 .free = LDKRoutingMessageHandler_JCalls_free,
12141                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12142         };
12143         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12144         return ret;
12145 }
12146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12147         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12148         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12149         return tag_ptr(res_ptr, true);
12150 }
12151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12152         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
12153         return tag_ptr(&inp->MessageSendEventsProvider, false);
12154 }
12155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12156         void* this_arg_ptr = untag_ptr(this_arg);
12157         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12158         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12159         LDKNodeAnnouncement msg_conv;
12160         msg_conv.inner = untag_ptr(msg);
12161         msg_conv.is_owned = ptr_is_owned(msg);
12162         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12163         msg_conv.is_owned = false;
12164         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12165         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12166         return tag_ptr(ret_conv, true);
12167 }
12168
12169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12170         void* this_arg_ptr = untag_ptr(this_arg);
12171         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12172         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12173         LDKChannelAnnouncement msg_conv;
12174         msg_conv.inner = untag_ptr(msg);
12175         msg_conv.is_owned = ptr_is_owned(msg);
12176         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12177         msg_conv.is_owned = false;
12178         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12179         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12180         return tag_ptr(ret_conv, true);
12181 }
12182
12183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12184         void* this_arg_ptr = untag_ptr(this_arg);
12185         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12186         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12187         LDKChannelUpdate msg_conv;
12188         msg_conv.inner = untag_ptr(msg);
12189         msg_conv.is_owned = ptr_is_owned(msg);
12190         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12191         msg_conv.is_owned = false;
12192         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12193         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12194         return tag_ptr(ret_conv, true);
12195 }
12196
12197 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
12198         void* this_arg_ptr = untag_ptr(this_arg);
12199         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12200         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12201         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
12202         int64_tArray ret_arr = NULL;
12203         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12204         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12205         for (size_t h = 0; h < ret_var.datalen; h++) {
12206                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12207                 *ret_conv_59_conv = ret_var.data[h];
12208                 ret_arr_ptr[h] = tag_ptr(ret_conv_59_conv, true);
12209         }
12210         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12211         FREE(ret_var.data);
12212         return ret_arr;
12213 }
12214
12215 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
12216         void* this_arg_ptr = untag_ptr(this_arg);
12217         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12218         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12219         LDKPublicKey starting_point_ref;
12220         CHECK((*env)->GetArrayLength(env, starting_point) == 33);
12221         (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
12222         LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
12223         int64_tArray ret_arr = NULL;
12224         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12225         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12226         for (size_t s = 0; s < ret_var.datalen; s++) {
12227                 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
12228                 int64_t ret_conv_18_ref = 0;
12229                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
12230                 ret_conv_18_ref = tag_ptr(ret_conv_18_var.inner, ret_conv_18_var.is_owned);
12231                 ret_arr_ptr[s] = ret_conv_18_ref;
12232         }
12233         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12234         FREE(ret_var.data);
12235         return ret_arr;
12236 }
12237
12238 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) {
12239         void* this_arg_ptr = untag_ptr(this_arg);
12240         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12241         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12242         LDKPublicKey their_node_id_ref;
12243         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12244         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12245         LDKInit init_conv;
12246         init_conv.inner = untag_ptr(init);
12247         init_conv.is_owned = ptr_is_owned(init);
12248         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12249         init_conv.is_owned = false;
12250         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
12251 }
12252
12253 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) {
12254         void* this_arg_ptr = untag_ptr(this_arg);
12255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12256         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12257         LDKPublicKey their_node_id_ref;
12258         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12259         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12260         LDKReplyChannelRange msg_conv;
12261         msg_conv.inner = untag_ptr(msg);
12262         msg_conv.is_owned = ptr_is_owned(msg);
12263         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12264         msg_conv = ReplyChannelRange_clone(&msg_conv);
12265         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12266         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12267         return tag_ptr(ret_conv, true);
12268 }
12269
12270 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) {
12271         void* this_arg_ptr = untag_ptr(this_arg);
12272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12273         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12274         LDKPublicKey their_node_id_ref;
12275         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12276         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12277         LDKReplyShortChannelIdsEnd msg_conv;
12278         msg_conv.inner = untag_ptr(msg);
12279         msg_conv.is_owned = ptr_is_owned(msg);
12280         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12281         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12282         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12283         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12284         return tag_ptr(ret_conv, true);
12285 }
12286
12287 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) {
12288         void* this_arg_ptr = untag_ptr(this_arg);
12289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12290         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12291         LDKPublicKey their_node_id_ref;
12292         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12293         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12294         LDKQueryChannelRange msg_conv;
12295         msg_conv.inner = untag_ptr(msg);
12296         msg_conv.is_owned = ptr_is_owned(msg);
12297         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12298         msg_conv = QueryChannelRange_clone(&msg_conv);
12299         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12300         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12301         return tag_ptr(ret_conv, true);
12302 }
12303
12304 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) {
12305         void* this_arg_ptr = untag_ptr(this_arg);
12306         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12307         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12308         LDKPublicKey their_node_id_ref;
12309         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12310         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12311         LDKQueryShortChannelIds msg_conv;
12312         msg_conv.inner = untag_ptr(msg);
12313         msg_conv.is_owned = ptr_is_owned(msg);
12314         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12315         msg_conv = QueryShortChannelIds_clone(&msg_conv);
12316         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12317         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12318         return tag_ptr(ret_conv, true);
12319 }
12320
12321 typedef struct LDKCustomMessageReader_JCalls {
12322         atomic_size_t refcnt;
12323         JavaVM *vm;
12324         jweak o;
12325         jmethodID read_meth;
12326 } LDKCustomMessageReader_JCalls;
12327 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
12328         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12329         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12330                 JNIEnv *env;
12331                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12332                 if (get_jenv_res == JNI_EDETACHED) {
12333                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12334                 } else {
12335                         DO_ASSERT(get_jenv_res == JNI_OK);
12336                 }
12337                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12338                 if (get_jenv_res == JNI_EDETACHED) {
12339                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12340                 }
12341                 FREE(j_calls);
12342         }
12343 }
12344 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
12345         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12346         JNIEnv *env;
12347         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12348         if (get_jenv_res == JNI_EDETACHED) {
12349                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12350         } else {
12351                 DO_ASSERT(get_jenv_res == JNI_OK);
12352         }
12353         int16_t message_type_conv = message_type;
12354         LDKu8slice buffer_var = buffer;
12355         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
12356         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
12357         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12358         CHECK(obj != NULL);
12359         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
12360         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12361                 (*env)->ExceptionDescribe(env);
12362                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
12363         }
12364         void* ret_ptr = untag_ptr(ret);
12365         CHECK_ACCESS(ret_ptr);
12366         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
12367         FREE(untag_ptr(ret));
12368         if (get_jenv_res == JNI_EDETACHED) {
12369                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12370         }
12371         return ret_conv;
12372 }
12373 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
12374         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
12375         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12376 }
12377 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
12378         jclass c = (*env)->GetObjectClass(env, o);
12379         CHECK(c != NULL);
12380         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
12381         atomic_init(&calls->refcnt, 1);
12382         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12383         calls->o = (*env)->NewWeakGlobalRef(env, o);
12384         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
12385         CHECK(calls->read_meth != NULL);
12386
12387         LDKCustomMessageReader ret = {
12388                 .this_arg = (void*) calls,
12389                 .read = read_LDKCustomMessageReader_jcall,
12390                 .free = LDKCustomMessageReader_JCalls_free,
12391         };
12392         return ret;
12393 }
12394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
12395         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
12396         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
12397         return tag_ptr(res_ptr, true);
12398 }
12399 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) {
12400         void* this_arg_ptr = untag_ptr(this_arg);
12401         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12402         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
12403         LDKu8slice buffer_ref;
12404         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
12405         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
12406         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12407         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
12408         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
12409         return tag_ptr(ret_conv, true);
12410 }
12411
12412 typedef struct LDKCustomMessageHandler_JCalls {
12413         atomic_size_t refcnt;
12414         JavaVM *vm;
12415         jweak o;
12416         LDKCustomMessageReader_JCalls* CustomMessageReader;
12417         jmethodID handle_custom_message_meth;
12418         jmethodID get_and_clear_pending_msg_meth;
12419 } LDKCustomMessageHandler_JCalls;
12420 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
12421         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12422         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12423                 JNIEnv *env;
12424                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12425                 if (get_jenv_res == JNI_EDETACHED) {
12426                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12427                 } else {
12428                         DO_ASSERT(get_jenv_res == JNI_OK);
12429                 }
12430                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12431                 if (get_jenv_res == JNI_EDETACHED) {
12432                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12433                 }
12434                 FREE(j_calls);
12435         }
12436 }
12437 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
12438         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12439         JNIEnv *env;
12440         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12441         if (get_jenv_res == JNI_EDETACHED) {
12442                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12443         } else {
12444                 DO_ASSERT(get_jenv_res == JNI_OK);
12445         }
12446         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
12447         *msg_ret = msg;
12448         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
12449         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
12450         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12451         CHECK(obj != NULL);
12452         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
12453         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12454                 (*env)->ExceptionDescribe(env);
12455                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
12456         }
12457         void* ret_ptr = untag_ptr(ret);
12458         CHECK_ACCESS(ret_ptr);
12459         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12460         FREE(untag_ptr(ret));
12461         if (get_jenv_res == JNI_EDETACHED) {
12462                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12463         }
12464         return ret_conv;
12465 }
12466 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
12467         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12468         JNIEnv *env;
12469         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12470         if (get_jenv_res == JNI_EDETACHED) {
12471                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12472         } else {
12473                 DO_ASSERT(get_jenv_res == JNI_OK);
12474         }
12475         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12476         CHECK(obj != NULL);
12477         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
12478         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12479                 (*env)->ExceptionDescribe(env);
12480                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
12481         }
12482         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
12483         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12484         if (ret_constr.datalen > 0)
12485                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12486         else
12487                 ret_constr.data = NULL;
12488         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12489         for (size_t z = 0; z < ret_constr.datalen; z++) {
12490                 int64_t ret_conv_25 = ret_vals[z];
12491                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
12492                 CHECK_ACCESS(ret_conv_25_ptr);
12493                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
12494                 FREE(untag_ptr(ret_conv_25));
12495                 ret_constr.data[z] = ret_conv_25_conv;
12496         }
12497         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12498         if (get_jenv_res == JNI_EDETACHED) {
12499                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12500         }
12501         return ret_constr;
12502 }
12503 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
12504         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
12505         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12506         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
12507 }
12508 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12509         jclass c = (*env)->GetObjectClass(env, o);
12510         CHECK(c != NULL);
12511         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
12512         atomic_init(&calls->refcnt, 1);
12513         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12514         calls->o = (*env)->NewWeakGlobalRef(env, o);
12515         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
12516         CHECK(calls->handle_custom_message_meth != NULL);
12517         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
12518         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
12519
12520         LDKCustomMessageHandler ret = {
12521                 .this_arg = (void*) calls,
12522                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
12523                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
12524                 .free = LDKCustomMessageHandler_JCalls_free,
12525                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
12526         };
12527         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
12528         return ret;
12529 }
12530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12531         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
12532         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
12533         return tag_ptr(res_ptr, true);
12534 }
12535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
12536         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
12537         return tag_ptr(&inp->CustomMessageReader, false);
12538 }
12539 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) {
12540         void* this_arg_ptr = untag_ptr(this_arg);
12541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12542         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12543         void* msg_ptr = untag_ptr(msg);
12544         CHECK_ACCESS(msg_ptr);
12545         LDKType msg_conv = *(LDKType*)(msg_ptr);
12546         if (msg_conv.free == LDKType_JCalls_free) {
12547                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12548                 LDKType_JCalls_cloned(&msg_conv);
12549         }
12550         LDKPublicKey sender_node_id_ref;
12551         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
12552         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
12553         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12554         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
12555         return tag_ptr(ret_conv, true);
12556 }
12557
12558 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
12559         void* this_arg_ptr = untag_ptr(this_arg);
12560         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12561         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12562         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
12563         int64_tArray ret_arr = NULL;
12564         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12565         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12566         for (size_t z = 0; z < ret_var.datalen; z++) {
12567                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12568                 *ret_conv_25_conv = ret_var.data[z];
12569                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
12570         }
12571         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12572         FREE(ret_var.data);
12573         return ret_arr;
12574 }
12575
12576 typedef struct LDKSocketDescriptor_JCalls {
12577         atomic_size_t refcnt;
12578         JavaVM *vm;
12579         jweak o;
12580         jmethodID send_data_meth;
12581         jmethodID disconnect_socket_meth;
12582         jmethodID eq_meth;
12583         jmethodID hash_meth;
12584 } LDKSocketDescriptor_JCalls;
12585 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
12586         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12587         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12588                 JNIEnv *env;
12589                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12590                 if (get_jenv_res == JNI_EDETACHED) {
12591                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12592                 } else {
12593                         DO_ASSERT(get_jenv_res == JNI_OK);
12594                 }
12595                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12596                 if (get_jenv_res == JNI_EDETACHED) {
12597                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12598                 }
12599                 FREE(j_calls);
12600         }
12601 }
12602 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
12603         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12604         JNIEnv *env;
12605         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12606         if (get_jenv_res == JNI_EDETACHED) {
12607                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12608         } else {
12609                 DO_ASSERT(get_jenv_res == JNI_OK);
12610         }
12611         LDKu8slice data_var = data;
12612         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
12613         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
12614         jboolean resume_read_conv = resume_read;
12615         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12616         CHECK(obj != NULL);
12617         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
12618         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12619                 (*env)->ExceptionDescribe(env);
12620                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
12621         }
12622         if (get_jenv_res == JNI_EDETACHED) {
12623                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12624         }
12625         return ret;
12626 }
12627 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
12628         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12629         JNIEnv *env;
12630         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12631         if (get_jenv_res == JNI_EDETACHED) {
12632                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12633         } else {
12634                 DO_ASSERT(get_jenv_res == JNI_OK);
12635         }
12636         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12637         CHECK(obj != NULL);
12638         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
12639         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12640                 (*env)->ExceptionDescribe(env);
12641                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
12642         }
12643         if (get_jenv_res == JNI_EDETACHED) {
12644                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12645         }
12646 }
12647 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
12648         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12649         JNIEnv *env;
12650         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12651         if (get_jenv_res == JNI_EDETACHED) {
12652                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12653         } else {
12654                 DO_ASSERT(get_jenv_res == JNI_OK);
12655         }
12656         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12657         *other_arg_clone = SocketDescriptor_clone(other_arg);
12658         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12659         CHECK(obj != NULL);
12660         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
12661         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12662                 (*env)->ExceptionDescribe(env);
12663                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
12664         }
12665         if (get_jenv_res == JNI_EDETACHED) {
12666                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12667         }
12668         return ret;
12669 }
12670 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
12671         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12672         JNIEnv *env;
12673         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12674         if (get_jenv_res == JNI_EDETACHED) {
12675                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12676         } else {
12677                 DO_ASSERT(get_jenv_res == JNI_OK);
12678         }
12679         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12680         CHECK(obj != NULL);
12681         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
12682         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12683                 (*env)->ExceptionDescribe(env);
12684                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
12685         }
12686         if (get_jenv_res == JNI_EDETACHED) {
12687                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12688         }
12689         return ret;
12690 }
12691 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
12692         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
12693         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12694 }
12695 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
12696         jclass c = (*env)->GetObjectClass(env, o);
12697         CHECK(c != NULL);
12698         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
12699         atomic_init(&calls->refcnt, 1);
12700         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12701         calls->o = (*env)->NewWeakGlobalRef(env, o);
12702         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
12703         CHECK(calls->send_data_meth != NULL);
12704         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
12705         CHECK(calls->disconnect_socket_meth != NULL);
12706         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
12707         CHECK(calls->eq_meth != NULL);
12708         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
12709         CHECK(calls->hash_meth != NULL);
12710
12711         LDKSocketDescriptor ret = {
12712                 .this_arg = (void*) calls,
12713                 .send_data = send_data_LDKSocketDescriptor_jcall,
12714                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12715                 .eq = eq_LDKSocketDescriptor_jcall,
12716                 .hash = hash_LDKSocketDescriptor_jcall,
12717                 .cloned = LDKSocketDescriptor_JCalls_cloned,
12718                 .free = LDKSocketDescriptor_JCalls_free,
12719         };
12720         return ret;
12721 }
12722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12723         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12724         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12725         return tag_ptr(res_ptr, true);
12726 }
12727 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) {
12728         void* this_arg_ptr = untag_ptr(this_arg);
12729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12730         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12731         LDKu8slice data_ref;
12732         data_ref.datalen = (*env)->GetArrayLength(env, data);
12733         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12734         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12735         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12736         return ret_conv;
12737 }
12738
12739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12740         void* this_arg_ptr = untag_ptr(this_arg);
12741         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12742         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12743         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12744 }
12745
12746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12747         void* this_arg_ptr = untag_ptr(this_arg);
12748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12749         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12750         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
12751         return ret_conv;
12752 }
12753
12754 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
12755 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
12756 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
12757 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
12758 static jclass LDKEffectiveCapacity_Total_class = NULL;
12759 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
12760 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
12761 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
12762 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
12763 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
12764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
12765         LDKEffectiveCapacity_ExactLiquidity_class =
12766                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
12767         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
12768         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
12769         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
12770         LDKEffectiveCapacity_MaximumHTLC_class =
12771                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
12772         CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
12773         LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
12774         CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
12775         LDKEffectiveCapacity_Total_class =
12776                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
12777         CHECK(LDKEffectiveCapacity_Total_class != NULL);
12778         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
12779         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
12780         LDKEffectiveCapacity_Infinite_class =
12781                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
12782         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
12783         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
12784         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
12785         LDKEffectiveCapacity_Unknown_class =
12786                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
12787         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
12788         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
12789         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
12790 }
12791 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12792         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
12793         switch(obj->tag) {
12794                 case LDKEffectiveCapacity_ExactLiquidity: {
12795                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
12796                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
12797                 }
12798                 case LDKEffectiveCapacity_MaximumHTLC: {
12799                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
12800                         return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
12801                 }
12802                 case LDKEffectiveCapacity_Total: {
12803                         int64_t capacity_msat_conv = obj->total.capacity_msat;
12804                         int64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
12805                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_ref);
12806                 }
12807                 case LDKEffectiveCapacity_Infinite: {
12808                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
12809                 }
12810                 case LDKEffectiveCapacity_Unknown: {
12811                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
12812                 }
12813                 default: abort();
12814         }
12815 }
12816 typedef struct LDKLockableScore_JCalls {
12817         atomic_size_t refcnt;
12818         JavaVM *vm;
12819         jweak o;
12820         jmethodID lock_meth;
12821 } LDKLockableScore_JCalls;
12822 static void LDKLockableScore_JCalls_free(void* this_arg) {
12823         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12824         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12825                 JNIEnv *env;
12826                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12827                 if (get_jenv_res == JNI_EDETACHED) {
12828                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12829                 } else {
12830                         DO_ASSERT(get_jenv_res == JNI_OK);
12831                 }
12832                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12833                 if (get_jenv_res == JNI_EDETACHED) {
12834                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12835                 }
12836                 FREE(j_calls);
12837         }
12838 }
12839 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
12840         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12841         JNIEnv *env;
12842         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12843         if (get_jenv_res == JNI_EDETACHED) {
12844                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12845         } else {
12846                 DO_ASSERT(get_jenv_res == JNI_OK);
12847         }
12848         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12849         CHECK(obj != NULL);
12850         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
12851         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12852                 (*env)->ExceptionDescribe(env);
12853                 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
12854         }
12855         void* ret_ptr = untag_ptr(ret);
12856         CHECK_ACCESS(ret_ptr);
12857         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
12858         if (ret_conv.free == LDKScore_JCalls_free) {
12859                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12860                 LDKScore_JCalls_cloned(&ret_conv);
12861         }// WARNING: we may need a move here but no clone is available for LDKScore
12862         
12863         if (get_jenv_res == JNI_EDETACHED) {
12864                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12865         }
12866         return ret_conv;
12867 }
12868 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
12869         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
12870         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12871 }
12872 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
12873         jclass c = (*env)->GetObjectClass(env, o);
12874         CHECK(c != NULL);
12875         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
12876         atomic_init(&calls->refcnt, 1);
12877         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12878         calls->o = (*env)->NewWeakGlobalRef(env, o);
12879         calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
12880         CHECK(calls->lock_meth != NULL);
12881
12882         LDKLockableScore ret = {
12883                 .this_arg = (void*) calls,
12884                 .lock = lock_LDKLockableScore_jcall,
12885                 .free = LDKLockableScore_JCalls_free,
12886         };
12887         return ret;
12888 }
12889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
12890         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
12891         *res_ptr = LDKLockableScore_init(env, clz, o);
12892         return tag_ptr(res_ptr, true);
12893 }
12894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
12895         void* this_arg_ptr = untag_ptr(this_arg);
12896         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12897         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
12898         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
12899         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
12900         return tag_ptr(ret_ret, true);
12901 }
12902
12903 static jclass LDKGossipSync_P2P_class = NULL;
12904 static jmethodID LDKGossipSync_P2P_meth = NULL;
12905 static jclass LDKGossipSync_Rapid_class = NULL;
12906 static jmethodID LDKGossipSync_Rapid_meth = NULL;
12907 static jclass LDKGossipSync_None_class = NULL;
12908 static jmethodID LDKGossipSync_None_meth = NULL;
12909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
12910         LDKGossipSync_P2P_class =
12911                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
12912         CHECK(LDKGossipSync_P2P_class != NULL);
12913         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
12914         CHECK(LDKGossipSync_P2P_meth != NULL);
12915         LDKGossipSync_Rapid_class =
12916                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
12917         CHECK(LDKGossipSync_Rapid_class != NULL);
12918         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
12919         CHECK(LDKGossipSync_Rapid_meth != NULL);
12920         LDKGossipSync_None_class =
12921                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
12922         CHECK(LDKGossipSync_None_class != NULL);
12923         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
12924         CHECK(LDKGossipSync_None_meth != NULL);
12925 }
12926 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12927         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
12928         switch(obj->tag) {
12929                 case LDKGossipSync_P2P: {
12930                         LDKP2PGossipSync p2p_var = obj->p2p;
12931                         int64_t p2p_ref = 0;
12932                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
12933                         p2p_ref = tag_ptr(p2p_var.inner, false);
12934                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
12935                 }
12936                 case LDKGossipSync_Rapid: {
12937                         LDKRapidGossipSync rapid_var = obj->rapid;
12938                         int64_t rapid_ref = 0;
12939                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
12940                         rapid_ref = tag_ptr(rapid_var.inner, false);
12941                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
12942                 }
12943                 case LDKGossipSync_None: {
12944                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
12945                 }
12946                 default: abort();
12947         }
12948 }
12949 static jclass LDKFallback_SegWitProgram_class = NULL;
12950 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
12951 static jclass LDKFallback_PubKeyHash_class = NULL;
12952 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
12953 static jclass LDKFallback_ScriptHash_class = NULL;
12954 static jmethodID LDKFallback_ScriptHash_meth = NULL;
12955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
12956         LDKFallback_SegWitProgram_class =
12957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
12958         CHECK(LDKFallback_SegWitProgram_class != NULL);
12959         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
12960         CHECK(LDKFallback_SegWitProgram_meth != NULL);
12961         LDKFallback_PubKeyHash_class =
12962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
12963         CHECK(LDKFallback_PubKeyHash_class != NULL);
12964         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
12965         CHECK(LDKFallback_PubKeyHash_meth != NULL);
12966         LDKFallback_ScriptHash_class =
12967                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
12968         CHECK(LDKFallback_ScriptHash_class != NULL);
12969         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
12970         CHECK(LDKFallback_ScriptHash_meth != NULL);
12971 }
12972 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12973         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
12974         switch(obj->tag) {
12975                 case LDKFallback_SegWitProgram: {
12976                         uint8_t version_val = obj->seg_wit_program.version._0;
12977                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
12978                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
12979                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
12980                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
12981                 }
12982                 case LDKFallback_PubKeyHash: {
12983                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
12984                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
12985                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
12986                 }
12987                 case LDKFallback_ScriptHash: {
12988                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
12989                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
12990                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
12991                 }
12992                 default: abort();
12993         }
12994 }
12995 typedef struct LDKPayer_JCalls {
12996         atomic_size_t refcnt;
12997         JavaVM *vm;
12998         jweak o;
12999         jmethodID node_id_meth;
13000         jmethodID first_hops_meth;
13001         jmethodID send_payment_meth;
13002         jmethodID send_spontaneous_payment_meth;
13003         jmethodID retry_payment_meth;
13004         jmethodID abandon_payment_meth;
13005 } LDKPayer_JCalls;
13006 static void LDKPayer_JCalls_free(void* this_arg) {
13007         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13008         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13009                 JNIEnv *env;
13010                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13011                 if (get_jenv_res == JNI_EDETACHED) {
13012                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13013                 } else {
13014                         DO_ASSERT(get_jenv_res == JNI_OK);
13015                 }
13016                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13017                 if (get_jenv_res == JNI_EDETACHED) {
13018                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13019                 }
13020                 FREE(j_calls);
13021         }
13022 }
13023 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13024         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13025         JNIEnv *env;
13026         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13027         if (get_jenv_res == JNI_EDETACHED) {
13028                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13029         } else {
13030                 DO_ASSERT(get_jenv_res == JNI_OK);
13031         }
13032         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13033         CHECK(obj != NULL);
13034         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13035         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13036                 (*env)->ExceptionDescribe(env);
13037                 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13038         }
13039         LDKPublicKey ret_ref;
13040         CHECK((*env)->GetArrayLength(env, ret) == 33);
13041         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13042         if (get_jenv_res == JNI_EDETACHED) {
13043                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13044         }
13045         return ret_ref;
13046 }
13047 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13048         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13049         JNIEnv *env;
13050         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13051         if (get_jenv_res == JNI_EDETACHED) {
13052                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13053         } else {
13054                 DO_ASSERT(get_jenv_res == JNI_OK);
13055         }
13056         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13057         CHECK(obj != NULL);
13058         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13059         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13060                 (*env)->ExceptionDescribe(env);
13061                 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13062         }
13063         LDKCVec_ChannelDetailsZ ret_constr;
13064         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13065         if (ret_constr.datalen > 0)
13066                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13067         else
13068                 ret_constr.data = NULL;
13069         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13070         for (size_t q = 0; q < ret_constr.datalen; q++) {
13071                 int64_t ret_conv_16 = ret_vals[q];
13072                 LDKChannelDetails ret_conv_16_conv;
13073                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
13074                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
13075                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13076                 ret_constr.data[q] = ret_conv_16_conv;
13077         }
13078         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13079         if (get_jenv_res == JNI_EDETACHED) {
13080                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13081         }
13082         return ret_constr;
13083 }
13084 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13085         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13086         JNIEnv *env;
13087         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13088         if (get_jenv_res == JNI_EDETACHED) {
13089                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13090         } else {
13091                 DO_ASSERT(get_jenv_res == JNI_OK);
13092         }
13093         LDKRoute route_var = *route;
13094         int64_t route_ref = 0;
13095         route_var = Route_clone(&route_var);
13096         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13097         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13098         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13099         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13100         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13101         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13102         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13103         CHECK(obj != NULL);
13104         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13105         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13106                 (*env)->ExceptionDescribe(env);
13107                 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13108         }
13109         void* ret_ptr = untag_ptr(ret);
13110         CHECK_ACCESS(ret_ptr);
13111         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13112         FREE(untag_ptr(ret));
13113         if (get_jenv_res == JNI_EDETACHED) {
13114                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13115         }
13116         return ret_conv;
13117 }
13118 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
13119         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13120         JNIEnv *env;
13121         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13122         if (get_jenv_res == JNI_EDETACHED) {
13123                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13124         } else {
13125                 DO_ASSERT(get_jenv_res == JNI_OK);
13126         }
13127         LDKRoute route_var = *route;
13128         int64_t route_ref = 0;
13129         route_var = Route_clone(&route_var);
13130         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13131         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13132         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13133         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13134         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13135         CHECK(obj != NULL);
13136         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13137         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13138                 (*env)->ExceptionDescribe(env);
13139                 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13140         }
13141         void* ret_ptr = untag_ptr(ret);
13142         CHECK_ACCESS(ret_ptr);
13143         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13144         FREE(untag_ptr(ret));
13145         if (get_jenv_res == JNI_EDETACHED) {
13146                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13147         }
13148         return ret_conv;
13149 }
13150 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
13151         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13152         JNIEnv *env;
13153         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13154         if (get_jenv_res == JNI_EDETACHED) {
13155                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13156         } else {
13157                 DO_ASSERT(get_jenv_res == JNI_OK);
13158         }
13159         LDKRoute route_var = *route;
13160         int64_t route_ref = 0;
13161         route_var = Route_clone(&route_var);
13162         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13163         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13164         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13165         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13166         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13167         CHECK(obj != NULL);
13168         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
13169         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13170                 (*env)->ExceptionDescribe(env);
13171                 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
13172         }
13173         void* ret_ptr = untag_ptr(ret);
13174         CHECK_ACCESS(ret_ptr);
13175         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
13176         FREE(untag_ptr(ret));
13177         if (get_jenv_res == JNI_EDETACHED) {
13178                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13179         }
13180         return ret_conv;
13181 }
13182 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
13183         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13184         JNIEnv *env;
13185         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13186         if (get_jenv_res == JNI_EDETACHED) {
13187                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13188         } else {
13189                 DO_ASSERT(get_jenv_res == JNI_OK);
13190         }
13191         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13192         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13193         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13194         CHECK(obj != NULL);
13195         (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
13196         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13197                 (*env)->ExceptionDescribe(env);
13198                 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
13199         }
13200         if (get_jenv_res == JNI_EDETACHED) {
13201                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13202         }
13203 }
13204 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
13205         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
13206         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13207 }
13208 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
13209         jclass c = (*env)->GetObjectClass(env, o);
13210         CHECK(c != NULL);
13211         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
13212         atomic_init(&calls->refcnt, 1);
13213         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13214         calls->o = (*env)->NewWeakGlobalRef(env, o);
13215         calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
13216         CHECK(calls->node_id_meth != NULL);
13217         calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
13218         CHECK(calls->first_hops_meth != NULL);
13219         calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
13220         CHECK(calls->send_payment_meth != NULL);
13221         calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
13222         CHECK(calls->send_spontaneous_payment_meth != NULL);
13223         calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
13224         CHECK(calls->retry_payment_meth != NULL);
13225         calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
13226         CHECK(calls->abandon_payment_meth != NULL);
13227
13228         LDKPayer ret = {
13229                 .this_arg = (void*) calls,
13230                 .node_id = node_id_LDKPayer_jcall,
13231                 .first_hops = first_hops_LDKPayer_jcall,
13232                 .send_payment = send_payment_LDKPayer_jcall,
13233                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
13234                 .retry_payment = retry_payment_LDKPayer_jcall,
13235                 .abandon_payment = abandon_payment_LDKPayer_jcall,
13236                 .free = LDKPayer_JCalls_free,
13237         };
13238         return ret;
13239 }
13240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
13241         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
13242         *res_ptr = LDKPayer_init(env, clz, o);
13243         return tag_ptr(res_ptr, true);
13244 }
13245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13246         void* this_arg_ptr = untag_ptr(this_arg);
13247         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13248         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13249         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13250         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
13251         return ret_arr;
13252 }
13253
13254 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
13255         void* this_arg_ptr = untag_ptr(this_arg);
13256         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13257         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13258         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
13259         int64_tArray ret_arr = NULL;
13260         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13261         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13262         for (size_t q = 0; q < ret_var.datalen; q++) {
13263                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
13264                 int64_t ret_conv_16_ref = 0;
13265                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
13266                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
13267                 ret_arr_ptr[q] = ret_conv_16_ref;
13268         }
13269         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13270         FREE(ret_var.data);
13271         return ret_arr;
13272 }
13273
13274 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) {
13275         void* this_arg_ptr = untag_ptr(this_arg);
13276         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13277         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13278         LDKRoute route_conv;
13279         route_conv.inner = untag_ptr(route);
13280         route_conv.is_owned = ptr_is_owned(route);
13281         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13282         route_conv.is_owned = false;
13283         LDKThirtyTwoBytes payment_hash_ref;
13284         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13285         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13286         LDKThirtyTwoBytes payment_secret_ref;
13287         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13288         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13289         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13290         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
13291         return tag_ptr(ret_conv, true);
13292 }
13293
13294 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) {
13295         void* this_arg_ptr = untag_ptr(this_arg);
13296         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13297         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13298         LDKRoute route_conv;
13299         route_conv.inner = untag_ptr(route);
13300         route_conv.is_owned = ptr_is_owned(route);
13301         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13302         route_conv.is_owned = false;
13303         LDKThirtyTwoBytes payment_preimage_ref;
13304         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13305         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13306         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13307         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
13308         return tag_ptr(ret_conv, true);
13309 }
13310
13311 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) {
13312         void* this_arg_ptr = untag_ptr(this_arg);
13313         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13314         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13315         LDKRoute route_conv;
13316         route_conv.inner = untag_ptr(route);
13317         route_conv.is_owned = ptr_is_owned(route);
13318         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13319         route_conv.is_owned = false;
13320         LDKThirtyTwoBytes payment_id_ref;
13321         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13322         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13323         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13324         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
13325         return tag_ptr(ret_conv, true);
13326 }
13327
13328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
13329         void* this_arg_ptr = untag_ptr(this_arg);
13330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13331         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13332         LDKThirtyTwoBytes payment_id_ref;
13333         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13334         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13335         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
13336 }
13337
13338 typedef struct LDKRouter_JCalls {
13339         atomic_size_t refcnt;
13340         JavaVM *vm;
13341         jweak o;
13342         jmethodID find_route_meth;
13343 } LDKRouter_JCalls;
13344 static void LDKRouter_JCalls_free(void* this_arg) {
13345         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13346         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13347                 JNIEnv *env;
13348                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13349                 if (get_jenv_res == JNI_EDETACHED) {
13350                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13351                 } else {
13352                         DO_ASSERT(get_jenv_res == JNI_OK);
13353                 }
13354                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13355                 if (get_jenv_res == JNI_EDETACHED) {
13356                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13357                 }
13358                 FREE(j_calls);
13359         }
13360 }
13361 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
13362         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13363         JNIEnv *env;
13364         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13365         if (get_jenv_res == JNI_EDETACHED) {
13366                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13367         } else {
13368                 DO_ASSERT(get_jenv_res == JNI_OK);
13369         }
13370         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
13371         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
13372         LDKRouteParameters route_params_var = *route_params;
13373         int64_t route_params_ref = 0;
13374         route_params_var = RouteParameters_clone(&route_params_var);
13375         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
13376         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
13377         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13378         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
13379         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
13380         int64_tArray first_hops_arr = NULL;
13381         if (first_hops != NULL) {
13382                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
13383                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
13384                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
13385                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
13386                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
13387                         int64_t first_hops_conv_16_ref = 0;
13388                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
13389                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
13390                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
13391                 }
13392                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
13393         }
13394         // WARNING: This object doesn't live past this scope, needs clone!
13395         int64_t ret_scorer = tag_ptr(scorer, false);
13396         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13397         CHECK(obj != NULL);
13398         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, payment_hash_arr, first_hops_arr, ret_scorer);
13399         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13400                 (*env)->ExceptionDescribe(env);
13401                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
13402         }
13403         void* ret_ptr = untag_ptr(ret);
13404         CHECK_ACCESS(ret_ptr);
13405         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
13406         FREE(untag_ptr(ret));
13407         if (get_jenv_res == JNI_EDETACHED) {
13408                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13409         }
13410         return ret_conv;
13411 }
13412 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
13413         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
13414         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13415 }
13416 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
13417         jclass c = (*env)->GetObjectClass(env, o);
13418         CHECK(c != NULL);
13419         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
13420         atomic_init(&calls->refcnt, 1);
13421         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13422         calls->o = (*env)->NewWeakGlobalRef(env, o);
13423         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
13424         CHECK(calls->find_route_meth != NULL);
13425
13426         LDKRouter ret = {
13427                 .this_arg = (void*) calls,
13428                 .find_route = find_route_LDKRouter_jcall,
13429                 .free = LDKRouter_JCalls_free,
13430         };
13431         return ret;
13432 }
13433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
13434         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
13435         *res_ptr = LDKRouter_init(env, clz, o);
13436         return tag_ptr(res_ptr, true);
13437 }
13438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) {
13439         void* this_arg_ptr = untag_ptr(this_arg);
13440         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13441         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
13442         LDKPublicKey payer_ref;
13443         CHECK((*env)->GetArrayLength(env, payer) == 33);
13444         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
13445         LDKRouteParameters route_params_conv;
13446         route_params_conv.inner = untag_ptr(route_params);
13447         route_params_conv.is_owned = ptr_is_owned(route_params);
13448         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
13449         route_params_conv.is_owned = false;
13450         unsigned char payment_hash_arr[32];
13451         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13452         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
13453         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
13454         LDKCVec_ChannelDetailsZ first_hops_constr;
13455         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
13456         if (first_hops != NULL) {
13457                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
13458                 if (first_hops_constr.datalen > 0)
13459                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13460                 else
13461                         first_hops_constr.data = NULL;
13462                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
13463                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13464                         int64_t first_hops_conv_16 = first_hops_vals[q];
13465                         LDKChannelDetails first_hops_conv_16_conv;
13466                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
13467                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
13468                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
13469                         first_hops_conv_16_conv.is_owned = false;
13470                         first_hops_constr.data[q] = first_hops_conv_16_conv;
13471                 }
13472                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
13473                 first_hops_ptr = &first_hops_constr;
13474         }
13475         void* scorer_ptr = untag_ptr(scorer);
13476         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
13477         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
13478         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13479         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
13480         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
13481         return tag_ptr(ret_conv, true);
13482 }
13483
13484 static jclass LDKRetry_Attempts_class = NULL;
13485 static jmethodID LDKRetry_Attempts_meth = NULL;
13486 static jclass LDKRetry_Timeout_class = NULL;
13487 static jmethodID LDKRetry_Timeout_meth = NULL;
13488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
13489         LDKRetry_Attempts_class =
13490                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
13491         CHECK(LDKRetry_Attempts_class != NULL);
13492         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
13493         CHECK(LDKRetry_Attempts_meth != NULL);
13494         LDKRetry_Timeout_class =
13495                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
13496         CHECK(LDKRetry_Timeout_class != NULL);
13497         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
13498         CHECK(LDKRetry_Timeout_meth != NULL);
13499 }
13500 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13501         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
13502         switch(obj->tag) {
13503                 case LDKRetry_Attempts: {
13504                         int64_t attempts_conv = obj->attempts;
13505                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
13506                 }
13507                 case LDKRetry_Timeout: {
13508                         int64_t timeout_conv = obj->timeout;
13509                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
13510                 }
13511                 default: abort();
13512         }
13513 }
13514 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13515         LDKStr ret_str = _ldk_get_compiled_version();
13516         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13517         Str_free(ret_str);
13518         return ret_conv;
13519 }
13520
13521 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13522         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
13523         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13524         Str_free(ret_str);
13525         return ret_conv;
13526 }
13527
13528 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
13529         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
13530         *ret_copy = Bech32Error_clone(arg);
13531         int64_t ret_ref = tag_ptr(ret_copy, true);
13532         return ret_ref;
13533 }
13534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13535         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
13536         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
13537         return ret_conv;
13538 }
13539
13540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13541         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
13542         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
13543         *ret_copy = Bech32Error_clone(orig_conv);
13544         int64_t ret_ref = tag_ptr(ret_copy, true);
13545         return ret_ref;
13546 }
13547
13548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
13549         if (!ptr_is_owned(o)) return;
13550         void* o_ptr = untag_ptr(o);
13551         CHECK_ACCESS(o_ptr);
13552         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
13553         FREE(untag_ptr(o));
13554         Bech32Error_free(o_conv);
13555 }
13556
13557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
13558         LDKTransaction _res_ref;
13559         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
13560         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
13561         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
13562         _res_ref.data_is_owned = true;
13563         Transaction_free(_res_ref);
13564 }
13565
13566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
13567         LDKCVec_u8Z script_pubkey_ref;
13568         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13569         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
13570         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
13571         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13572         *ret_ref = TxOut_new(script_pubkey_ref, value);
13573         return tag_ptr(ret_ref, true);
13574 }
13575
13576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
13577         if (!ptr_is_owned(_res)) return;
13578         void* _res_ptr = untag_ptr(_res);
13579         CHECK_ACCESS(_res_ptr);
13580         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
13581         FREE(untag_ptr(_res));
13582         TxOut_free(_res_conv);
13583 }
13584
13585 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
13586         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13587         *ret_ref = TxOut_clone(arg);
13588         return tag_ptr(ret_ref, true);
13589 }
13590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13591         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
13592         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
13593         return ret_conv;
13594 }
13595
13596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13597         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
13598         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13599         *ret_ref = TxOut_clone(orig_conv);
13600         return tag_ptr(ret_ref, true);
13601 }
13602
13603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
13604         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
13605         Str_free(dummy);
13606 }
13607
13608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
13609         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13610         *ret_conv = CResult_NoneNoneZ_ok();
13611         return tag_ptr(ret_conv, true);
13612 }
13613
13614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
13615         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13616         *ret_conv = CResult_NoneNoneZ_err();
13617         return tag_ptr(ret_conv, true);
13618 }
13619
13620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13621         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
13622         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
13623         return ret_conv;
13624 }
13625
13626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13627         if (!ptr_is_owned(_res)) return;
13628         void* _res_ptr = untag_ptr(_res);
13629         CHECK_ACCESS(_res_ptr);
13630         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
13631         FREE(untag_ptr(_res));
13632         CResult_NoneNoneZ_free(_res_conv);
13633 }
13634
13635 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
13636         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13637         *ret_conv = CResult_NoneNoneZ_clone(arg);
13638         return tag_ptr(ret_conv, true);
13639 }
13640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13641         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
13642         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
13643         return ret_conv;
13644 }
13645
13646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13647         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
13648         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13649         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
13650         return tag_ptr(ret_conv, true);
13651 }
13652
13653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13654         LDKCounterpartyCommitmentSecrets o_conv;
13655         o_conv.inner = untag_ptr(o);
13656         o_conv.is_owned = ptr_is_owned(o);
13657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13658         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
13659         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13660         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
13661         return tag_ptr(ret_conv, true);
13662 }
13663
13664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13665         LDKDecodeError e_conv;
13666         e_conv.inner = untag_ptr(e);
13667         e_conv.is_owned = ptr_is_owned(e);
13668         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13669         e_conv = DecodeError_clone(&e_conv);
13670         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13671         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
13672         return tag_ptr(ret_conv, true);
13673 }
13674
13675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13676         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
13677         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
13678         return ret_conv;
13679 }
13680
13681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13682         if (!ptr_is_owned(_res)) return;
13683         void* _res_ptr = untag_ptr(_res);
13684         CHECK_ACCESS(_res_ptr);
13685         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
13686         FREE(untag_ptr(_res));
13687         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
13688 }
13689
13690 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
13691         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13692         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
13693         return tag_ptr(ret_conv, true);
13694 }
13695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13696         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
13697         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
13698         return ret_conv;
13699 }
13700
13701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13702         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
13703         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13704         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
13705         return tag_ptr(ret_conv, true);
13706 }
13707
13708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13709         LDKSecretKey o_ref;
13710         CHECK((*env)->GetArrayLength(env, o) == 32);
13711         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
13712         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13713         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
13714         return tag_ptr(ret_conv, true);
13715 }
13716
13717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13718         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13719         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13720         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
13721         return tag_ptr(ret_conv, true);
13722 }
13723
13724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13725         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
13726         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
13727         return ret_conv;
13728 }
13729
13730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13731         if (!ptr_is_owned(_res)) return;
13732         void* _res_ptr = untag_ptr(_res);
13733         CHECK_ACCESS(_res_ptr);
13734         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
13735         FREE(untag_ptr(_res));
13736         CResult_SecretKeyErrorZ_free(_res_conv);
13737 }
13738
13739 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
13740         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13741         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
13742         return tag_ptr(ret_conv, true);
13743 }
13744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13745         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
13746         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
13747         return ret_conv;
13748 }
13749
13750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13751         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
13752         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13753         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
13754         return tag_ptr(ret_conv, true);
13755 }
13756
13757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13758         LDKPublicKey o_ref;
13759         CHECK((*env)->GetArrayLength(env, o) == 33);
13760         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
13761         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13762         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
13763         return tag_ptr(ret_conv, true);
13764 }
13765
13766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13767         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13768         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13769         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
13770         return tag_ptr(ret_conv, true);
13771 }
13772
13773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13774         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
13775         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
13776         return ret_conv;
13777 }
13778
13779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13780         if (!ptr_is_owned(_res)) return;
13781         void* _res_ptr = untag_ptr(_res);
13782         CHECK_ACCESS(_res_ptr);
13783         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
13784         FREE(untag_ptr(_res));
13785         CResult_PublicKeyErrorZ_free(_res_conv);
13786 }
13787
13788 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
13789         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13790         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
13791         return tag_ptr(ret_conv, true);
13792 }
13793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13794         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
13795         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
13796         return ret_conv;
13797 }
13798
13799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13800         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
13801         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13802         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
13803         return tag_ptr(ret_conv, true);
13804 }
13805
13806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13807         LDKTxCreationKeys o_conv;
13808         o_conv.inner = untag_ptr(o);
13809         o_conv.is_owned = ptr_is_owned(o);
13810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13811         o_conv = TxCreationKeys_clone(&o_conv);
13812         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13813         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
13814         return tag_ptr(ret_conv, true);
13815 }
13816
13817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13818         LDKDecodeError e_conv;
13819         e_conv.inner = untag_ptr(e);
13820         e_conv.is_owned = ptr_is_owned(e);
13821         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13822         e_conv = DecodeError_clone(&e_conv);
13823         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13824         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
13825         return tag_ptr(ret_conv, true);
13826 }
13827
13828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13829         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
13830         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
13831         return ret_conv;
13832 }
13833
13834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13835         if (!ptr_is_owned(_res)) return;
13836         void* _res_ptr = untag_ptr(_res);
13837         CHECK_ACCESS(_res_ptr);
13838         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
13839         FREE(untag_ptr(_res));
13840         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
13841 }
13842
13843 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
13844         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13845         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
13846         return tag_ptr(ret_conv, true);
13847 }
13848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13849         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
13850         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
13851         return ret_conv;
13852 }
13853
13854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13855         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
13856         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13857         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
13858         return tag_ptr(ret_conv, true);
13859 }
13860
13861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13862         LDKChannelPublicKeys o_conv;
13863         o_conv.inner = untag_ptr(o);
13864         o_conv.is_owned = ptr_is_owned(o);
13865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13866         o_conv = ChannelPublicKeys_clone(&o_conv);
13867         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13868         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
13869         return tag_ptr(ret_conv, true);
13870 }
13871
13872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13873         LDKDecodeError e_conv;
13874         e_conv.inner = untag_ptr(e);
13875         e_conv.is_owned = ptr_is_owned(e);
13876         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13877         e_conv = DecodeError_clone(&e_conv);
13878         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13879         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
13880         return tag_ptr(ret_conv, true);
13881 }
13882
13883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13884         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
13885         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
13886         return ret_conv;
13887 }
13888
13889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13890         if (!ptr_is_owned(_res)) return;
13891         void* _res_ptr = untag_ptr(_res);
13892         CHECK_ACCESS(_res_ptr);
13893         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
13894         FREE(untag_ptr(_res));
13895         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
13896 }
13897
13898 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
13899         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13900         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
13901         return tag_ptr(ret_conv, true);
13902 }
13903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13904         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
13905         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
13906         return ret_conv;
13907 }
13908
13909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13910         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
13911         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13912         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
13913         return tag_ptr(ret_conv, true);
13914 }
13915
13916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13917         LDKTxCreationKeys o_conv;
13918         o_conv.inner = untag_ptr(o);
13919         o_conv.is_owned = ptr_is_owned(o);
13920         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13921         o_conv = TxCreationKeys_clone(&o_conv);
13922         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13923         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
13924         return tag_ptr(ret_conv, true);
13925 }
13926
13927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13928         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13929         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13930         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
13931         return tag_ptr(ret_conv, true);
13932 }
13933
13934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13935         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
13936         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
13937         return ret_conv;
13938 }
13939
13940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13941         if (!ptr_is_owned(_res)) return;
13942         void* _res_ptr = untag_ptr(_res);
13943         CHECK_ACCESS(_res_ptr);
13944         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
13945         FREE(untag_ptr(_res));
13946         CResult_TxCreationKeysErrorZ_free(_res_conv);
13947 }
13948
13949 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
13950         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13951         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
13952         return tag_ptr(ret_conv, true);
13953 }
13954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13955         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
13956         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
13957         return ret_conv;
13958 }
13959
13960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13961         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
13962         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13963         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
13964         return tag_ptr(ret_conv, true);
13965 }
13966
13967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
13968         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13969         *ret_copy = COption_u32Z_some(o);
13970         int64_t ret_ref = tag_ptr(ret_copy, true);
13971         return ret_ref;
13972 }
13973
13974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
13975         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13976         *ret_copy = COption_u32Z_none();
13977         int64_t ret_ref = tag_ptr(ret_copy, true);
13978         return ret_ref;
13979 }
13980
13981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
13982         if (!ptr_is_owned(_res)) return;
13983         void* _res_ptr = untag_ptr(_res);
13984         CHECK_ACCESS(_res_ptr);
13985         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
13986         FREE(untag_ptr(_res));
13987         COption_u32Z_free(_res_conv);
13988 }
13989
13990 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
13991         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13992         *ret_copy = COption_u32Z_clone(arg);
13993         int64_t ret_ref = tag_ptr(ret_copy, true);
13994         return ret_ref;
13995 }
13996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13997         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
13998         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
13999         return ret_conv;
14000 }
14001
14002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14003         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
14004         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14005         *ret_copy = COption_u32Z_clone(orig_conv);
14006         int64_t ret_ref = tag_ptr(ret_copy, true);
14007         return ret_ref;
14008 }
14009
14010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14011         LDKHTLCOutputInCommitment o_conv;
14012         o_conv.inner = untag_ptr(o);
14013         o_conv.is_owned = ptr_is_owned(o);
14014         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14015         o_conv = HTLCOutputInCommitment_clone(&o_conv);
14016         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14017         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14018         return tag_ptr(ret_conv, true);
14019 }
14020
14021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14022         LDKDecodeError e_conv;
14023         e_conv.inner = untag_ptr(e);
14024         e_conv.is_owned = ptr_is_owned(e);
14025         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14026         e_conv = DecodeError_clone(&e_conv);
14027         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14028         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14029         return tag_ptr(ret_conv, true);
14030 }
14031
14032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14033         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
14034         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14035         return ret_conv;
14036 }
14037
14038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14039         if (!ptr_is_owned(_res)) return;
14040         void* _res_ptr = untag_ptr(_res);
14041         CHECK_ACCESS(_res_ptr);
14042         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14043         FREE(untag_ptr(_res));
14044         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14045 }
14046
14047 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14048         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14049         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14050         return tag_ptr(ret_conv, true);
14051 }
14052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14053         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
14054         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14055         return ret_conv;
14056 }
14057
14058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14059         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
14060         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14061         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14062         return tag_ptr(ret_conv, true);
14063 }
14064
14065 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14066         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14067         return ret_conv;
14068 }
14069
14070 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14071         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14072         return ret_conv;
14073 }
14074
14075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14076         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14077         COption_NoneZ_free(_res_conv);
14078 }
14079
14080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14081         LDKCounterpartyChannelTransactionParameters o_conv;
14082         o_conv.inner = untag_ptr(o);
14083         o_conv.is_owned = ptr_is_owned(o);
14084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14085         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14086         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14087         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14088         return tag_ptr(ret_conv, true);
14089 }
14090
14091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14092         LDKDecodeError e_conv;
14093         e_conv.inner = untag_ptr(e);
14094         e_conv.is_owned = ptr_is_owned(e);
14095         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14096         e_conv = DecodeError_clone(&e_conv);
14097         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14098         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14099         return tag_ptr(ret_conv, true);
14100 }
14101
14102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14103         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
14104         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14105         return ret_conv;
14106 }
14107
14108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14109         if (!ptr_is_owned(_res)) return;
14110         void* _res_ptr = untag_ptr(_res);
14111         CHECK_ACCESS(_res_ptr);
14112         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14113         FREE(untag_ptr(_res));
14114         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14115 }
14116
14117 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14118         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14119         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14120         return tag_ptr(ret_conv, true);
14121 }
14122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14123         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
14124         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14125         return ret_conv;
14126 }
14127
14128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14129         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
14130         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14131         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14132         return tag_ptr(ret_conv, true);
14133 }
14134
14135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14136         LDKChannelTransactionParameters o_conv;
14137         o_conv.inner = untag_ptr(o);
14138         o_conv.is_owned = ptr_is_owned(o);
14139         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14140         o_conv = ChannelTransactionParameters_clone(&o_conv);
14141         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14142         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14143         return tag_ptr(ret_conv, true);
14144 }
14145
14146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14147         LDKDecodeError e_conv;
14148         e_conv.inner = untag_ptr(e);
14149         e_conv.is_owned = ptr_is_owned(e);
14150         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14151         e_conv = DecodeError_clone(&e_conv);
14152         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14153         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
14154         return tag_ptr(ret_conv, true);
14155 }
14156
14157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14158         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
14159         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14160         return ret_conv;
14161 }
14162
14163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14164         if (!ptr_is_owned(_res)) return;
14165         void* _res_ptr = untag_ptr(_res);
14166         CHECK_ACCESS(_res_ptr);
14167         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14168         FREE(untag_ptr(_res));
14169         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14170 }
14171
14172 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14173         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14174         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
14175         return tag_ptr(ret_conv, true);
14176 }
14177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14178         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
14179         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14180         return ret_conv;
14181 }
14182
14183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14184         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
14185         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14186         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14187         return tag_ptr(ret_conv, true);
14188 }
14189
14190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14191         LDKCVec_SignatureZ _res_constr;
14192         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14193         if (_res_constr.datalen > 0)
14194                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14195         else
14196                 _res_constr.data = NULL;
14197         for (size_t i = 0; i < _res_constr.datalen; i++) {
14198                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14199                 LDKSignature _res_conv_8_ref;
14200                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
14201                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
14202                 _res_constr.data[i] = _res_conv_8_ref;
14203         }
14204         CVec_SignatureZ_free(_res_constr);
14205 }
14206
14207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14208         LDKHolderCommitmentTransaction o_conv;
14209         o_conv.inner = untag_ptr(o);
14210         o_conv.is_owned = ptr_is_owned(o);
14211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14212         o_conv = HolderCommitmentTransaction_clone(&o_conv);
14213         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14214         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
14215         return tag_ptr(ret_conv, true);
14216 }
14217
14218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14219         LDKDecodeError e_conv;
14220         e_conv.inner = untag_ptr(e);
14221         e_conv.is_owned = ptr_is_owned(e);
14222         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14223         e_conv = DecodeError_clone(&e_conv);
14224         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14225         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
14226         return tag_ptr(ret_conv, true);
14227 }
14228
14229 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14230         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14231         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14232         return ret_conv;
14233 }
14234
14235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14236         if (!ptr_is_owned(_res)) return;
14237         void* _res_ptr = untag_ptr(_res);
14238         CHECK_ACCESS(_res_ptr);
14239         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14240         FREE(untag_ptr(_res));
14241         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
14242 }
14243
14244 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14245         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14246         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
14247         return tag_ptr(ret_conv, true);
14248 }
14249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14250         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14251         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14252         return ret_conv;
14253 }
14254
14255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14256         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14257         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14258         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14259         return tag_ptr(ret_conv, true);
14260 }
14261
14262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14263         LDKBuiltCommitmentTransaction o_conv;
14264         o_conv.inner = untag_ptr(o);
14265         o_conv.is_owned = ptr_is_owned(o);
14266         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14267         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
14268         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14269         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
14270         return tag_ptr(ret_conv, true);
14271 }
14272
14273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14274         LDKDecodeError e_conv;
14275         e_conv.inner = untag_ptr(e);
14276         e_conv.is_owned = ptr_is_owned(e);
14277         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14278         e_conv = DecodeError_clone(&e_conv);
14279         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14280         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
14281         return tag_ptr(ret_conv, true);
14282 }
14283
14284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14285         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14286         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14287         return ret_conv;
14288 }
14289
14290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14291         if (!ptr_is_owned(_res)) return;
14292         void* _res_ptr = untag_ptr(_res);
14293         CHECK_ACCESS(_res_ptr);
14294         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14295         FREE(untag_ptr(_res));
14296         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
14297 }
14298
14299 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14300         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14301         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
14302         return tag_ptr(ret_conv, true);
14303 }
14304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14305         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14306         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14307         return ret_conv;
14308 }
14309
14310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14311         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14312         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14313         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14314         return tag_ptr(ret_conv, true);
14315 }
14316
14317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14318         LDKTrustedClosingTransaction o_conv;
14319         o_conv.inner = untag_ptr(o);
14320         o_conv.is_owned = ptr_is_owned(o);
14321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14322         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
14323         
14324         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14325         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
14326         return tag_ptr(ret_conv, true);
14327 }
14328
14329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14330         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14331         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
14332         return tag_ptr(ret_conv, true);
14333 }
14334
14335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14336         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
14337         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
14338         return ret_conv;
14339 }
14340
14341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14342         if (!ptr_is_owned(_res)) return;
14343         void* _res_ptr = untag_ptr(_res);
14344         CHECK_ACCESS(_res_ptr);
14345         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
14346         FREE(untag_ptr(_res));
14347         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
14348 }
14349
14350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14351         LDKCommitmentTransaction o_conv;
14352         o_conv.inner = untag_ptr(o);
14353         o_conv.is_owned = ptr_is_owned(o);
14354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14355         o_conv = CommitmentTransaction_clone(&o_conv);
14356         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14357         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
14358         return tag_ptr(ret_conv, true);
14359 }
14360
14361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14362         LDKDecodeError e_conv;
14363         e_conv.inner = untag_ptr(e);
14364         e_conv.is_owned = ptr_is_owned(e);
14365         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14366         e_conv = DecodeError_clone(&e_conv);
14367         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14368         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
14369         return tag_ptr(ret_conv, true);
14370 }
14371
14372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14373         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14374         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14375         return ret_conv;
14376 }
14377
14378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14379         if (!ptr_is_owned(_res)) return;
14380         void* _res_ptr = untag_ptr(_res);
14381         CHECK_ACCESS(_res_ptr);
14382         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
14383         FREE(untag_ptr(_res));
14384         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
14385 }
14386
14387 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14388         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14389         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
14390         return tag_ptr(ret_conv, true);
14391 }
14392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14393         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14394         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14395         return ret_conv;
14396 }
14397
14398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14399         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14400         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14401         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
14402         return tag_ptr(ret_conv, true);
14403 }
14404
14405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14406         LDKTrustedCommitmentTransaction o_conv;
14407         o_conv.inner = untag_ptr(o);
14408         o_conv.is_owned = ptr_is_owned(o);
14409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14410         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
14411         
14412         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14413         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
14414         return tag_ptr(ret_conv, true);
14415 }
14416
14417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14418         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14419         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
14420         return tag_ptr(ret_conv, true);
14421 }
14422
14423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14424         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
14425         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
14426         return ret_conv;
14427 }
14428
14429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14430         if (!ptr_is_owned(_res)) return;
14431         void* _res_ptr = untag_ptr(_res);
14432         CHECK_ACCESS(_res_ptr);
14433         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
14434         FREE(untag_ptr(_res));
14435         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
14436 }
14437
14438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14439         LDKCVec_SignatureZ o_constr;
14440         o_constr.datalen = (*env)->GetArrayLength(env, o);
14441         if (o_constr.datalen > 0)
14442                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14443         else
14444                 o_constr.data = NULL;
14445         for (size_t i = 0; i < o_constr.datalen; i++) {
14446                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
14447                 LDKSignature o_conv_8_ref;
14448                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
14449                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
14450                 o_constr.data[i] = o_conv_8_ref;
14451         }
14452         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14453         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
14454         return tag_ptr(ret_conv, true);
14455 }
14456
14457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
14458         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14459         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
14460         return tag_ptr(ret_conv, true);
14461 }
14462
14463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14464         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
14465         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
14466         return ret_conv;
14467 }
14468
14469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14470         if (!ptr_is_owned(_res)) return;
14471         void* _res_ptr = untag_ptr(_res);
14472         CHECK_ACCESS(_res_ptr);
14473         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
14474         FREE(untag_ptr(_res));
14475         CResult_CVec_SignatureZNoneZ_free(_res_conv);
14476 }
14477
14478 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
14479         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14480         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
14481         return tag_ptr(ret_conv, true);
14482 }
14483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14484         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
14485         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
14486         return ret_conv;
14487 }
14488
14489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14490         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
14491         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14492         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
14493         return tag_ptr(ret_conv, true);
14494 }
14495
14496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14497         LDKShutdownScript o_conv;
14498         o_conv.inner = untag_ptr(o);
14499         o_conv.is_owned = ptr_is_owned(o);
14500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14501         o_conv = ShutdownScript_clone(&o_conv);
14502         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14503         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
14504         return tag_ptr(ret_conv, true);
14505 }
14506
14507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14508         LDKDecodeError e_conv;
14509         e_conv.inner = untag_ptr(e);
14510         e_conv.is_owned = ptr_is_owned(e);
14511         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14512         e_conv = DecodeError_clone(&e_conv);
14513         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14514         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
14515         return tag_ptr(ret_conv, true);
14516 }
14517
14518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14519         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
14520         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
14521         return ret_conv;
14522 }
14523
14524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14525         if (!ptr_is_owned(_res)) return;
14526         void* _res_ptr = untag_ptr(_res);
14527         CHECK_ACCESS(_res_ptr);
14528         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
14529         FREE(untag_ptr(_res));
14530         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
14531 }
14532
14533 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
14534         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14535         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
14536         return tag_ptr(ret_conv, true);
14537 }
14538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14539         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
14540         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
14541         return ret_conv;
14542 }
14543
14544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14545         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
14546         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14547         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
14548         return tag_ptr(ret_conv, true);
14549 }
14550
14551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14552         LDKShutdownScript o_conv;
14553         o_conv.inner = untag_ptr(o);
14554         o_conv.is_owned = ptr_is_owned(o);
14555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14556         o_conv = ShutdownScript_clone(&o_conv);
14557         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14558         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
14559         return tag_ptr(ret_conv, true);
14560 }
14561
14562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14563         LDKInvalidShutdownScript e_conv;
14564         e_conv.inner = untag_ptr(e);
14565         e_conv.is_owned = ptr_is_owned(e);
14566         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14567         e_conv = InvalidShutdownScript_clone(&e_conv);
14568         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14569         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
14570         return tag_ptr(ret_conv, true);
14571 }
14572
14573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14574         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
14575         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
14576         return ret_conv;
14577 }
14578
14579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14580         if (!ptr_is_owned(_res)) return;
14581         void* _res_ptr = untag_ptr(_res);
14582         CHECK_ACCESS(_res_ptr);
14583         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
14584         FREE(untag_ptr(_res));
14585         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
14586 }
14587
14588 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
14589         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14590         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
14591         return tag_ptr(ret_conv, true);
14592 }
14593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14594         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
14595         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
14596         return ret_conv;
14597 }
14598
14599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14600         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
14601         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14602         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
14603         return tag_ptr(ret_conv, true);
14604 }
14605
14606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
14607         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14608         *ret_conv = CResult_NoneErrorZ_ok();
14609         return tag_ptr(ret_conv, true);
14610 }
14611
14612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14613         LDKIOError e_conv = LDKIOError_from_java(env, e);
14614         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14615         *ret_conv = CResult_NoneErrorZ_err(e_conv);
14616         return tag_ptr(ret_conv, true);
14617 }
14618
14619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14620         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
14621         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
14622         return ret_conv;
14623 }
14624
14625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14626         if (!ptr_is_owned(_res)) return;
14627         void* _res_ptr = untag_ptr(_res);
14628         CHECK_ACCESS(_res_ptr);
14629         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
14630         FREE(untag_ptr(_res));
14631         CResult_NoneErrorZ_free(_res_conv);
14632 }
14633
14634 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
14635         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14636         *ret_conv = CResult_NoneErrorZ_clone(arg);
14637         return tag_ptr(ret_conv, true);
14638 }
14639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14640         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
14641         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
14642         return ret_conv;
14643 }
14644
14645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14646         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
14647         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14648         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
14649         return tag_ptr(ret_conv, true);
14650 }
14651
14652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14653         LDKRouteHop o_conv;
14654         o_conv.inner = untag_ptr(o);
14655         o_conv.is_owned = ptr_is_owned(o);
14656         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14657         o_conv = RouteHop_clone(&o_conv);
14658         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14659         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
14660         return tag_ptr(ret_conv, true);
14661 }
14662
14663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14664         LDKDecodeError e_conv;
14665         e_conv.inner = untag_ptr(e);
14666         e_conv.is_owned = ptr_is_owned(e);
14667         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14668         e_conv = DecodeError_clone(&e_conv);
14669         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14670         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
14671         return tag_ptr(ret_conv, true);
14672 }
14673
14674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14675         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
14676         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
14677         return ret_conv;
14678 }
14679
14680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14681         if (!ptr_is_owned(_res)) return;
14682         void* _res_ptr = untag_ptr(_res);
14683         CHECK_ACCESS(_res_ptr);
14684         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
14685         FREE(untag_ptr(_res));
14686         CResult_RouteHopDecodeErrorZ_free(_res_conv);
14687 }
14688
14689 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
14690         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14691         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
14692         return tag_ptr(ret_conv, true);
14693 }
14694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14695         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
14696         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
14697         return ret_conv;
14698 }
14699
14700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14701         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
14702         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14703         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
14704         return tag_ptr(ret_conv, true);
14705 }
14706
14707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14708         LDKCVec_RouteHopZ _res_constr;
14709         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14710         if (_res_constr.datalen > 0)
14711                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14712         else
14713                 _res_constr.data = NULL;
14714         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14715         for (size_t k = 0; k < _res_constr.datalen; k++) {
14716                 int64_t _res_conv_10 = _res_vals[k];
14717                 LDKRouteHop _res_conv_10_conv;
14718                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
14719                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
14720                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
14721                 _res_constr.data[k] = _res_conv_10_conv;
14722         }
14723         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14724         CVec_RouteHopZ_free(_res_constr);
14725 }
14726
14727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14728         LDKCVec_CVec_RouteHopZZ _res_constr;
14729         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14730         if (_res_constr.datalen > 0)
14731                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14732         else
14733                 _res_constr.data = NULL;
14734         for (size_t m = 0; m < _res_constr.datalen; m++) {
14735                 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
14736                 LDKCVec_RouteHopZ _res_conv_12_constr;
14737                 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
14738                 if (_res_conv_12_constr.datalen > 0)
14739                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14740                 else
14741                         _res_conv_12_constr.data = NULL;
14742                 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
14743                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
14744                         int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
14745                         LDKRouteHop _res_conv_12_conv_10_conv;
14746                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
14747                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
14748                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
14749                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
14750                 }
14751                 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
14752                 _res_constr.data[m] = _res_conv_12_constr;
14753         }
14754         CVec_CVec_RouteHopZZ_free(_res_constr);
14755 }
14756
14757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14758         LDKRoute o_conv;
14759         o_conv.inner = untag_ptr(o);
14760         o_conv.is_owned = ptr_is_owned(o);
14761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14762         o_conv = Route_clone(&o_conv);
14763         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14764         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
14765         return tag_ptr(ret_conv, true);
14766 }
14767
14768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14769         LDKDecodeError e_conv;
14770         e_conv.inner = untag_ptr(e);
14771         e_conv.is_owned = ptr_is_owned(e);
14772         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14773         e_conv = DecodeError_clone(&e_conv);
14774         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14775         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
14776         return tag_ptr(ret_conv, true);
14777 }
14778
14779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14780         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
14781         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
14782         return ret_conv;
14783 }
14784
14785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14786         if (!ptr_is_owned(_res)) return;
14787         void* _res_ptr = untag_ptr(_res);
14788         CHECK_ACCESS(_res_ptr);
14789         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
14790         FREE(untag_ptr(_res));
14791         CResult_RouteDecodeErrorZ_free(_res_conv);
14792 }
14793
14794 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
14795         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14796         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
14797         return tag_ptr(ret_conv, true);
14798 }
14799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14800         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
14801         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
14802         return ret_conv;
14803 }
14804
14805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14806         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
14807         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14808         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
14809         return tag_ptr(ret_conv, true);
14810 }
14811
14812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14813         LDKRouteParameters o_conv;
14814         o_conv.inner = untag_ptr(o);
14815         o_conv.is_owned = ptr_is_owned(o);
14816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14817         o_conv = RouteParameters_clone(&o_conv);
14818         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14819         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
14820         return tag_ptr(ret_conv, true);
14821 }
14822
14823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14824         LDKDecodeError e_conv;
14825         e_conv.inner = untag_ptr(e);
14826         e_conv.is_owned = ptr_is_owned(e);
14827         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14828         e_conv = DecodeError_clone(&e_conv);
14829         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14830         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
14831         return tag_ptr(ret_conv, true);
14832 }
14833
14834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14835         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
14836         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
14837         return ret_conv;
14838 }
14839
14840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14841         if (!ptr_is_owned(_res)) return;
14842         void* _res_ptr = untag_ptr(_res);
14843         CHECK_ACCESS(_res_ptr);
14844         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
14845         FREE(untag_ptr(_res));
14846         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
14847 }
14848
14849 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
14850         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14851         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
14852         return tag_ptr(ret_conv, true);
14853 }
14854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14855         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
14856         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
14857         return ret_conv;
14858 }
14859
14860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14861         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
14862         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14863         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
14864         return tag_ptr(ret_conv, true);
14865 }
14866
14867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14868         LDKCVec_RouteHintZ _res_constr;
14869         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14870         if (_res_constr.datalen > 0)
14871                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
14872         else
14873                 _res_constr.data = NULL;
14874         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14875         for (size_t l = 0; l < _res_constr.datalen; l++) {
14876                 int64_t _res_conv_11 = _res_vals[l];
14877                 LDKRouteHint _res_conv_11_conv;
14878                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
14879                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
14880                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
14881                 _res_constr.data[l] = _res_conv_11_conv;
14882         }
14883         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14884         CVec_RouteHintZ_free(_res_constr);
14885 }
14886
14887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
14888         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14889         *ret_copy = COption_u64Z_some(o);
14890         int64_t ret_ref = tag_ptr(ret_copy, true);
14891         return ret_ref;
14892 }
14893
14894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
14895         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14896         *ret_copy = COption_u64Z_none();
14897         int64_t ret_ref = tag_ptr(ret_copy, true);
14898         return ret_ref;
14899 }
14900
14901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14902         if (!ptr_is_owned(_res)) return;
14903         void* _res_ptr = untag_ptr(_res);
14904         CHECK_ACCESS(_res_ptr);
14905         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
14906         FREE(untag_ptr(_res));
14907         COption_u64Z_free(_res_conv);
14908 }
14909
14910 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
14911         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14912         *ret_copy = COption_u64Z_clone(arg);
14913         int64_t ret_ref = tag_ptr(ret_copy, true);
14914         return ret_ref;
14915 }
14916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14917         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
14918         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
14919         return ret_conv;
14920 }
14921
14922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14923         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
14924         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14925         *ret_copy = COption_u64Z_clone(orig_conv);
14926         int64_t ret_ref = tag_ptr(ret_copy, true);
14927         return ret_ref;
14928 }
14929
14930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14931         LDKCVec_u64Z _res_constr;
14932         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14933         if (_res_constr.datalen > 0)
14934                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14935         else
14936                 _res_constr.data = NULL;
14937         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14938         for (size_t g = 0; g < _res_constr.datalen; g++) {
14939                 int64_t _res_conv_6 = _res_vals[g];
14940                 _res_constr.data[g] = _res_conv_6;
14941         }
14942         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14943         CVec_u64Z_free(_res_constr);
14944 }
14945
14946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14947         LDKPaymentParameters o_conv;
14948         o_conv.inner = untag_ptr(o);
14949         o_conv.is_owned = ptr_is_owned(o);
14950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14951         o_conv = PaymentParameters_clone(&o_conv);
14952         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
14953         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
14954         return tag_ptr(ret_conv, true);
14955 }
14956
14957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14958         LDKDecodeError e_conv;
14959         e_conv.inner = untag_ptr(e);
14960         e_conv.is_owned = ptr_is_owned(e);
14961         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14962         e_conv = DecodeError_clone(&e_conv);
14963         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
14964         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
14965         return tag_ptr(ret_conv, true);
14966 }
14967
14968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14969         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
14970         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
14971         return ret_conv;
14972 }
14973
14974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14975         if (!ptr_is_owned(_res)) return;
14976         void* _res_ptr = untag_ptr(_res);
14977         CHECK_ACCESS(_res_ptr);
14978         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
14979         FREE(untag_ptr(_res));
14980         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
14981 }
14982
14983 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
14984         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
14985         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
14986         return tag_ptr(ret_conv, true);
14987 }
14988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14989         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
14990         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
14991         return ret_conv;
14992 }
14993
14994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14995         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
14996         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
14997         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
14998         return tag_ptr(ret_conv, true);
14999 }
15000
15001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15002         LDKCVec_RouteHintHopZ _res_constr;
15003         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15004         if (_res_constr.datalen > 0)
15005                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15006         else
15007                 _res_constr.data = NULL;
15008         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15009         for (size_t o = 0; o < _res_constr.datalen; o++) {
15010                 int64_t _res_conv_14 = _res_vals[o];
15011                 LDKRouteHintHop _res_conv_14_conv;
15012                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
15013                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
15014                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15015                 _res_constr.data[o] = _res_conv_14_conv;
15016         }
15017         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15018         CVec_RouteHintHopZ_free(_res_constr);
15019 }
15020
15021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15022         LDKRouteHint o_conv;
15023         o_conv.inner = untag_ptr(o);
15024         o_conv.is_owned = ptr_is_owned(o);
15025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15026         o_conv = RouteHint_clone(&o_conv);
15027         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15028         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15029         return tag_ptr(ret_conv, true);
15030 }
15031
15032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15033         LDKDecodeError e_conv;
15034         e_conv.inner = untag_ptr(e);
15035         e_conv.is_owned = ptr_is_owned(e);
15036         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15037         e_conv = DecodeError_clone(&e_conv);
15038         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15039         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15040         return tag_ptr(ret_conv, true);
15041 }
15042
15043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15044         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
15045         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15046         return ret_conv;
15047 }
15048
15049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15050         if (!ptr_is_owned(_res)) return;
15051         void* _res_ptr = untag_ptr(_res);
15052         CHECK_ACCESS(_res_ptr);
15053         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15054         FREE(untag_ptr(_res));
15055         CResult_RouteHintDecodeErrorZ_free(_res_conv);
15056 }
15057
15058 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15059         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15060         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15061         return tag_ptr(ret_conv, true);
15062 }
15063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15064         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
15065         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15066         return ret_conv;
15067 }
15068
15069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15070         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
15071         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15072         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15073         return tag_ptr(ret_conv, true);
15074 }
15075
15076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15077         LDKRouteHintHop o_conv;
15078         o_conv.inner = untag_ptr(o);
15079         o_conv.is_owned = ptr_is_owned(o);
15080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15081         o_conv = RouteHintHop_clone(&o_conv);
15082         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15083         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15084         return tag_ptr(ret_conv, true);
15085 }
15086
15087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15088         LDKDecodeError e_conv;
15089         e_conv.inner = untag_ptr(e);
15090         e_conv.is_owned = ptr_is_owned(e);
15091         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15092         e_conv = DecodeError_clone(&e_conv);
15093         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15094         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15095         return tag_ptr(ret_conv, true);
15096 }
15097
15098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15099         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
15100         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15101         return ret_conv;
15102 }
15103
15104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15105         if (!ptr_is_owned(_res)) return;
15106         void* _res_ptr = untag_ptr(_res);
15107         CHECK_ACCESS(_res_ptr);
15108         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15109         FREE(untag_ptr(_res));
15110         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15111 }
15112
15113 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15114         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15115         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15116         return tag_ptr(ret_conv, true);
15117 }
15118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15119         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
15120         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15121         return ret_conv;
15122 }
15123
15124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15125         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
15126         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15127         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15128         return tag_ptr(ret_conv, true);
15129 }
15130
15131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15132         LDKCVec_ChannelDetailsZ _res_constr;
15133         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15134         if (_res_constr.datalen > 0)
15135                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15136         else
15137                 _res_constr.data = NULL;
15138         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15139         for (size_t q = 0; q < _res_constr.datalen; q++) {
15140                 int64_t _res_conv_16 = _res_vals[q];
15141                 LDKChannelDetails _res_conv_16_conv;
15142                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
15143                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
15144                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15145                 _res_constr.data[q] = _res_conv_16_conv;
15146         }
15147         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15148         CVec_ChannelDetailsZ_free(_res_constr);
15149 }
15150
15151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15152         LDKRoute o_conv;
15153         o_conv.inner = untag_ptr(o);
15154         o_conv.is_owned = ptr_is_owned(o);
15155         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15156         o_conv = Route_clone(&o_conv);
15157         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15158         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
15159         return tag_ptr(ret_conv, true);
15160 }
15161
15162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15163         LDKLightningError e_conv;
15164         e_conv.inner = untag_ptr(e);
15165         e_conv.is_owned = ptr_is_owned(e);
15166         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15167         e_conv = LightningError_clone(&e_conv);
15168         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15169         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
15170         return tag_ptr(ret_conv, true);
15171 }
15172
15173 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15174         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
15175         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
15176         return ret_conv;
15177 }
15178
15179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15180         if (!ptr_is_owned(_res)) return;
15181         void* _res_ptr = untag_ptr(_res);
15182         CHECK_ACCESS(_res_ptr);
15183         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
15184         FREE(untag_ptr(_res));
15185         CResult_RouteLightningErrorZ_free(_res_conv);
15186 }
15187
15188 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
15189         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15190         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
15191         return tag_ptr(ret_conv, true);
15192 }
15193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15194         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
15195         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
15196         return ret_conv;
15197 }
15198
15199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15200         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
15201         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15202         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
15203         return tag_ptr(ret_conv, true);
15204 }
15205
15206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15207         LDKCVec_PublicKeyZ _res_constr;
15208         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15209         if (_res_constr.datalen > 0)
15210                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
15211         else
15212                 _res_constr.data = NULL;
15213         for (size_t i = 0; i < _res_constr.datalen; i++) {
15214                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15215                 LDKPublicKey _res_conv_8_ref;
15216                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
15217                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
15218                 _res_constr.data[i] = _res_conv_8_ref;
15219         }
15220         CVec_PublicKeyZ_free(_res_constr);
15221 }
15222
15223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15224         void* o_ptr = untag_ptr(o);
15225         CHECK_ACCESS(o_ptr);
15226         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
15227         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
15228         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15229         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
15230         return tag_ptr(ret_conv, true);
15231 }
15232
15233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15234         LDKDecodeError e_conv;
15235         e_conv.inner = untag_ptr(e);
15236         e_conv.is_owned = ptr_is_owned(e);
15237         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15238         e_conv = DecodeError_clone(&e_conv);
15239         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15240         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
15241         return tag_ptr(ret_conv, true);
15242 }
15243
15244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15245         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
15246         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
15247         return ret_conv;
15248 }
15249
15250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15251         if (!ptr_is_owned(_res)) return;
15252         void* _res_ptr = untag_ptr(_res);
15253         CHECK_ACCESS(_res_ptr);
15254         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
15255         FREE(untag_ptr(_res));
15256         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
15257 }
15258
15259 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
15260         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15261         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
15262         return tag_ptr(ret_conv, true);
15263 }
15264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15265         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
15266         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
15267         return ret_conv;
15268 }
15269
15270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15271         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
15272         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15273         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
15274         return tag_ptr(ret_conv, true);
15275 }
15276
15277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15278         void* o_ptr = untag_ptr(o);
15279         CHECK_ACCESS(o_ptr);
15280         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
15281         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
15282         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15283         *ret_copy = COption_ClosureReasonZ_some(o_conv);
15284         int64_t ret_ref = tag_ptr(ret_copy, true);
15285         return ret_ref;
15286 }
15287
15288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
15289         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15290         *ret_copy = COption_ClosureReasonZ_none();
15291         int64_t ret_ref = tag_ptr(ret_copy, true);
15292         return ret_ref;
15293 }
15294
15295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15296         if (!ptr_is_owned(_res)) return;
15297         void* _res_ptr = untag_ptr(_res);
15298         CHECK_ACCESS(_res_ptr);
15299         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
15300         FREE(untag_ptr(_res));
15301         COption_ClosureReasonZ_free(_res_conv);
15302 }
15303
15304 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
15305         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15306         *ret_copy = COption_ClosureReasonZ_clone(arg);
15307         int64_t ret_ref = tag_ptr(ret_copy, true);
15308         return ret_ref;
15309 }
15310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15311         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
15312         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
15313         return ret_conv;
15314 }
15315
15316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15317         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
15318         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15319         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
15320         int64_t ret_ref = tag_ptr(ret_copy, true);
15321         return ret_ref;
15322 }
15323
15324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15325         void* o_ptr = untag_ptr(o);
15326         CHECK_ACCESS(o_ptr);
15327         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
15328         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
15329         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15330         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
15331         return tag_ptr(ret_conv, true);
15332 }
15333
15334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15335         LDKDecodeError e_conv;
15336         e_conv.inner = untag_ptr(e);
15337         e_conv.is_owned = ptr_is_owned(e);
15338         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15339         e_conv = DecodeError_clone(&e_conv);
15340         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15341         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
15342         return tag_ptr(ret_conv, true);
15343 }
15344
15345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15346         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
15347         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
15348         return ret_conv;
15349 }
15350
15351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15352         if (!ptr_is_owned(_res)) return;
15353         void* _res_ptr = untag_ptr(_res);
15354         CHECK_ACCESS(_res_ptr);
15355         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
15356         FREE(untag_ptr(_res));
15357         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
15358 }
15359
15360 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
15361         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15362         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
15363         return tag_ptr(ret_conv, true);
15364 }
15365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15366         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
15367         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
15368         return ret_conv;
15369 }
15370
15371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15372         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
15373         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15374         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
15375         return tag_ptr(ret_conv, true);
15376 }
15377
15378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15379         void* o_ptr = untag_ptr(o);
15380         CHECK_ACCESS(o_ptr);
15381         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
15382         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
15383         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15384         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
15385         int64_t ret_ref = tag_ptr(ret_copy, true);
15386         return ret_ref;
15387 }
15388
15389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
15390         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15391         *ret_copy = COption_HTLCDestinationZ_none();
15392         int64_t ret_ref = tag_ptr(ret_copy, true);
15393         return ret_ref;
15394 }
15395
15396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15397         if (!ptr_is_owned(_res)) return;
15398         void* _res_ptr = untag_ptr(_res);
15399         CHECK_ACCESS(_res_ptr);
15400         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
15401         FREE(untag_ptr(_res));
15402         COption_HTLCDestinationZ_free(_res_conv);
15403 }
15404
15405 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
15406         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15407         *ret_copy = COption_HTLCDestinationZ_clone(arg);
15408         int64_t ret_ref = tag_ptr(ret_copy, true);
15409         return ret_ref;
15410 }
15411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15412         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
15413         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
15414         return ret_conv;
15415 }
15416
15417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15418         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
15419         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15420         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
15421         int64_t ret_ref = tag_ptr(ret_copy, true);
15422         return ret_ref;
15423 }
15424
15425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15426         void* o_ptr = untag_ptr(o);
15427         CHECK_ACCESS(o_ptr);
15428         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
15429         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
15430         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15431         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
15432         return tag_ptr(ret_conv, true);
15433 }
15434
15435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15436         LDKDecodeError e_conv;
15437         e_conv.inner = untag_ptr(e);
15438         e_conv.is_owned = ptr_is_owned(e);
15439         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15440         e_conv = DecodeError_clone(&e_conv);
15441         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15442         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
15443         return tag_ptr(ret_conv, true);
15444 }
15445
15446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15447         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
15448         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
15449         return ret_conv;
15450 }
15451
15452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15453         if (!ptr_is_owned(_res)) return;
15454         void* _res_ptr = untag_ptr(_res);
15455         CHECK_ACCESS(_res_ptr);
15456         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
15457         FREE(untag_ptr(_res));
15458         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
15459 }
15460
15461 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
15462         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15463         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
15464         return tag_ptr(ret_conv, true);
15465 }
15466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15467         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
15468         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
15469         return ret_conv;
15470 }
15471
15472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15473         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
15474         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15475         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
15476         return tag_ptr(ret_conv, true);
15477 }
15478
15479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15480         void* o_ptr = untag_ptr(o);
15481         CHECK_ACCESS(o_ptr);
15482         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
15483         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
15484         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15485         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
15486         int64_t ret_ref = tag_ptr(ret_copy, true);
15487         return ret_ref;
15488 }
15489
15490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
15491         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15492         *ret_copy = COption_NetworkUpdateZ_none();
15493         int64_t ret_ref = tag_ptr(ret_copy, true);
15494         return ret_ref;
15495 }
15496
15497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15498         if (!ptr_is_owned(_res)) return;
15499         void* _res_ptr = untag_ptr(_res);
15500         CHECK_ACCESS(_res_ptr);
15501         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
15502         FREE(untag_ptr(_res));
15503         COption_NetworkUpdateZ_free(_res_conv);
15504 }
15505
15506 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
15507         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15508         *ret_copy = COption_NetworkUpdateZ_clone(arg);
15509         int64_t ret_ref = tag_ptr(ret_copy, true);
15510         return ret_ref;
15511 }
15512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15513         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
15514         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
15515         return ret_conv;
15516 }
15517
15518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15519         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
15520         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15521         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
15522         int64_t ret_ref = tag_ptr(ret_copy, true);
15523         return ret_ref;
15524 }
15525
15526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15527         LDKCVec_SpendableOutputDescriptorZ _res_constr;
15528         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15529         if (_res_constr.datalen > 0)
15530                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15531         else
15532                 _res_constr.data = NULL;
15533         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15534         for (size_t b = 0; b < _res_constr.datalen; b++) {
15535                 int64_t _res_conv_27 = _res_vals[b];
15536                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
15537                 CHECK_ACCESS(_res_conv_27_ptr);
15538                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15539                 FREE(untag_ptr(_res_conv_27));
15540                 _res_constr.data[b] = _res_conv_27_conv;
15541         }
15542         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15543         CVec_SpendableOutputDescriptorZ_free(_res_constr);
15544 }
15545
15546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15547         void* o_ptr = untag_ptr(o);
15548         CHECK_ACCESS(o_ptr);
15549         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15550         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
15551         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15552         *ret_copy = COption_EventZ_some(o_conv);
15553         int64_t ret_ref = tag_ptr(ret_copy, true);
15554         return ret_ref;
15555 }
15556
15557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
15558         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15559         *ret_copy = COption_EventZ_none();
15560         int64_t ret_ref = tag_ptr(ret_copy, true);
15561         return ret_ref;
15562 }
15563
15564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15565         if (!ptr_is_owned(_res)) return;
15566         void* _res_ptr = untag_ptr(_res);
15567         CHECK_ACCESS(_res_ptr);
15568         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15569         FREE(untag_ptr(_res));
15570         COption_EventZ_free(_res_conv);
15571 }
15572
15573 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15574         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15575         *ret_copy = COption_EventZ_clone(arg);
15576         int64_t ret_ref = tag_ptr(ret_copy, true);
15577         return ret_ref;
15578 }
15579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15580         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
15581         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
15582         return ret_conv;
15583 }
15584
15585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15586         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
15587         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15588         *ret_copy = COption_EventZ_clone(orig_conv);
15589         int64_t ret_ref = tag_ptr(ret_copy, true);
15590         return ret_ref;
15591 }
15592
15593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15594         void* o_ptr = untag_ptr(o);
15595         CHECK_ACCESS(o_ptr);
15596         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15597         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
15598         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15599         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15600         return tag_ptr(ret_conv, true);
15601 }
15602
15603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15604         LDKDecodeError e_conv;
15605         e_conv.inner = untag_ptr(e);
15606         e_conv.is_owned = ptr_is_owned(e);
15607         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15608         e_conv = DecodeError_clone(&e_conv);
15609         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15610         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15611         return tag_ptr(ret_conv, true);
15612 }
15613
15614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15615         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
15616         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15617         return ret_conv;
15618 }
15619
15620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15621         if (!ptr_is_owned(_res)) return;
15622         void* _res_ptr = untag_ptr(_res);
15623         CHECK_ACCESS(_res_ptr);
15624         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15625         FREE(untag_ptr(_res));
15626         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15627 }
15628
15629 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15630         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15631         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15632         return tag_ptr(ret_conv, true);
15633 }
15634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15635         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
15636         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15637         return ret_conv;
15638 }
15639
15640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15641         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
15642         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15643         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15644         return tag_ptr(ret_conv, true);
15645 }
15646
15647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15648         LDKCVec_MessageSendEventZ _res_constr;
15649         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15650         if (_res_constr.datalen > 0)
15651                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15652         else
15653                 _res_constr.data = NULL;
15654         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15655         for (size_t s = 0; s < _res_constr.datalen; s++) {
15656                 int64_t _res_conv_18 = _res_vals[s];
15657                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
15658                 CHECK_ACCESS(_res_conv_18_ptr);
15659                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15660                 FREE(untag_ptr(_res_conv_18));
15661                 _res_constr.data[s] = _res_conv_18_conv;
15662         }
15663         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15664         CVec_MessageSendEventZ_free(_res_constr);
15665 }
15666
15667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15668         void* o_ptr = untag_ptr(o);
15669         CHECK_ACCESS(o_ptr);
15670         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
15671         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
15672         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15673         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
15674         return tag_ptr(ret_conv, true);
15675 }
15676
15677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15678         LDKAccessError e_conv = LDKAccessError_from_java(env, e);
15679         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15680         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
15681         return tag_ptr(ret_conv, true);
15682 }
15683
15684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15685         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
15686         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
15687         return ret_conv;
15688 }
15689
15690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15691         if (!ptr_is_owned(_res)) return;
15692         void* _res_ptr = untag_ptr(_res);
15693         CHECK_ACCESS(_res_ptr);
15694         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
15695         FREE(untag_ptr(_res));
15696         CResult_TxOutAccessErrorZ_free(_res_conv);
15697 }
15698
15699 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
15700         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15701         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
15702         return tag_ptr(ret_conv, true);
15703 }
15704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15705         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
15706         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
15707         return ret_conv;
15708 }
15709
15710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15711         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
15712         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15713         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
15714         return tag_ptr(ret_conv, true);
15715 }
15716
15717 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
15718         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15719         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
15720         return tag_ptr(ret_conv, true);
15721 }
15722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15723         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
15724         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
15725         return ret_conv;
15726 }
15727
15728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15729         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
15730         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15731         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
15732         return tag_ptr(ret_conv, true);
15733 }
15734
15735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
15736         LDKTransaction b_ref;
15737         b_ref.datalen = (*env)->GetArrayLength(env, b);
15738         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
15739         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
15740         b_ref.data_is_owned = true;
15741         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15742         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
15743         return tag_ptr(ret_conv, true);
15744 }
15745
15746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15747         if (!ptr_is_owned(_res)) return;
15748         void* _res_ptr = untag_ptr(_res);
15749         CHECK_ACCESS(_res_ptr);
15750         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
15751         FREE(untag_ptr(_res));
15752         C2Tuple_usizeTransactionZ_free(_res_conv);
15753 }
15754
15755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15756         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
15757         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15758         if (_res_constr.datalen > 0)
15759                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15760         else
15761                 _res_constr.data = NULL;
15762         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15763         for (size_t c = 0; c < _res_constr.datalen; c++) {
15764                 int64_t _res_conv_28 = _res_vals[c];
15765                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
15766                 CHECK_ACCESS(_res_conv_28_ptr);
15767                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
15768                 FREE(untag_ptr(_res_conv_28));
15769                 _res_constr.data[c] = _res_conv_28_conv;
15770         }
15771         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15772         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
15773 }
15774
15775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15776         LDKCVec_TxidZ _res_constr;
15777         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15778         if (_res_constr.datalen > 0)
15779                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
15780         else
15781                 _res_constr.data = NULL;
15782         for (size_t i = 0; i < _res_constr.datalen; i++) {
15783                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15784                 LDKThirtyTwoBytes _res_conv_8_ref;
15785                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
15786                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
15787                 _res_constr.data[i] = _res_conv_8_ref;
15788         }
15789         CVec_TxidZ_free(_res_constr);
15790 }
15791
15792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
15793         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15794         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
15795         return tag_ptr(ret_conv, true);
15796 }
15797
15798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
15799         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
15800         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15801         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
15802         return tag_ptr(ret_conv, true);
15803 }
15804
15805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15806         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
15807         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
15808         return ret_conv;
15809 }
15810
15811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_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_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
15816         FREE(untag_ptr(_res));
15817         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
15818 }
15819
15820 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
15821         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15822         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
15823         return tag_ptr(ret_conv, true);
15824 }
15825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15826         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
15827         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
15828         return ret_conv;
15829 }
15830
15831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15832         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
15833         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15834         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
15835         return tag_ptr(ret_conv, true);
15836 }
15837
15838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15839         LDKCVec_MonitorEventZ _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(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
15843         else
15844                 _res_constr.data = NULL;
15845         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15846         for (size_t o = 0; o < _res_constr.datalen; o++) {
15847                 int64_t _res_conv_14 = _res_vals[o];
15848                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
15849                 CHECK_ACCESS(_res_conv_14_ptr);
15850                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
15851                 FREE(untag_ptr(_res_conv_14));
15852                 _res_constr.data[o] = _res_conv_14_conv;
15853         }
15854         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15855         CVec_MonitorEventZ_free(_res_constr);
15856 }
15857
15858 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
15859         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
15860         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
15861         return tag_ptr(ret_conv, true);
15862 }
15863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15864         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
15865         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
15866         return ret_conv;
15867 }
15868
15869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15870         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
15871         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
15872         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
15873         return tag_ptr(ret_conv, true);
15874 }
15875
15876 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) {
15877         LDKOutPoint a_conv;
15878         a_conv.inner = untag_ptr(a);
15879         a_conv.is_owned = ptr_is_owned(a);
15880         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
15881         a_conv = OutPoint_clone(&a_conv);
15882         LDKCVec_MonitorEventZ b_constr;
15883         b_constr.datalen = (*env)->GetArrayLength(env, b);
15884         if (b_constr.datalen > 0)
15885                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
15886         else
15887                 b_constr.data = NULL;
15888         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
15889         for (size_t o = 0; o < b_constr.datalen; o++) {
15890                 int64_t b_conv_14 = b_vals[o];
15891                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
15892                 CHECK_ACCESS(b_conv_14_ptr);
15893                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
15894                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
15895                 b_constr.data[o] = b_conv_14_conv;
15896         }
15897         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
15898         LDKPublicKey c_ref;
15899         CHECK((*env)->GetArrayLength(env, c) == 33);
15900         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
15901         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
15902         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
15903         return tag_ptr(ret_conv, true);
15904 }
15905
15906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15907         if (!ptr_is_owned(_res)) return;
15908         void* _res_ptr = untag_ptr(_res);
15909         CHECK_ACCESS(_res_ptr);
15910         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
15911         FREE(untag_ptr(_res));
15912         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
15913 }
15914
15915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15916         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
15917         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15918         if (_res_constr.datalen > 0)
15919                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
15920         else
15921                 _res_constr.data = NULL;
15922         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15923         for (size_t x = 0; x < _res_constr.datalen; x++) {
15924                 int64_t _res_conv_49 = _res_vals[x];
15925                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
15926                 CHECK_ACCESS(_res_conv_49_ptr);
15927                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
15928                 FREE(untag_ptr(_res_conv_49));
15929                 _res_constr.data[x] = _res_conv_49_conv;
15930         }
15931         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15932         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
15933 }
15934
15935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15936         void* o_ptr = untag_ptr(o);
15937         CHECK_ACCESS(o_ptr);
15938         LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
15939         o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(o));
15940         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15941         *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
15942         int64_t ret_ref = tag_ptr(ret_copy, true);
15943         return ret_ref;
15944 }
15945
15946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
15947         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15948         *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
15949         int64_t ret_ref = tag_ptr(ret_copy, true);
15950         return ret_ref;
15951 }
15952
15953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15954         if (!ptr_is_owned(_res)) return;
15955         void* _res_ptr = untag_ptr(_res);
15956         CHECK_ACCESS(_res_ptr);
15957         LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
15958         FREE(untag_ptr(_res));
15959         COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
15960 }
15961
15962 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
15963         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15964         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
15965         int64_t ret_ref = tag_ptr(ret_copy, true);
15966         return ret_ref;
15967 }
15968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15969         LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(arg);
15970         int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
15971         return ret_conv;
15972 }
15973
15974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15975         LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(orig);
15976         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15977         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
15978         int64_t ret_ref = tag_ptr(ret_copy, true);
15979         return ret_ref;
15980 }
15981
15982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15983         LDKFixedPenaltyScorer o_conv;
15984         o_conv.inner = untag_ptr(o);
15985         o_conv.is_owned = ptr_is_owned(o);
15986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15987         o_conv = FixedPenaltyScorer_clone(&o_conv);
15988         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15989         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
15990         return tag_ptr(ret_conv, true);
15991 }
15992
15993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15994         LDKDecodeError e_conv;
15995         e_conv.inner = untag_ptr(e);
15996         e_conv.is_owned = ptr_is_owned(e);
15997         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15998         e_conv = DecodeError_clone(&e_conv);
15999         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16000         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
16001         return tag_ptr(ret_conv, true);
16002 }
16003
16004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16005         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
16006         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
16007         return ret_conv;
16008 }
16009
16010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16011         if (!ptr_is_owned(_res)) return;
16012         void* _res_ptr = untag_ptr(_res);
16013         CHECK_ACCESS(_res_ptr);
16014         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
16015         FREE(untag_ptr(_res));
16016         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
16017 }
16018
16019 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
16020         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16021         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
16022         return tag_ptr(ret_conv, true);
16023 }
16024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16025         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
16026         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
16027         return ret_conv;
16028 }
16029
16030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16031         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
16032         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16033         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
16034         return tag_ptr(ret_conv, true);
16035 }
16036
16037 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
16038         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16039         *ret_conv = C2Tuple_u64u64Z_clone(arg);
16040         return tag_ptr(ret_conv, true);
16041 }
16042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16043         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
16044         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
16045         return ret_conv;
16046 }
16047
16048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16049         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
16050         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16051         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
16052         return tag_ptr(ret_conv, true);
16053 }
16054
16055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16056         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16057         *ret_conv = C2Tuple_u64u64Z_new(a, b);
16058         return tag_ptr(ret_conv, true);
16059 }
16060
16061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16062         if (!ptr_is_owned(_res)) return;
16063         void* _res_ptr = untag_ptr(_res);
16064         CHECK_ACCESS(_res_ptr);
16065         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
16066         FREE(untag_ptr(_res));
16067         C2Tuple_u64u64Z_free(_res_conv);
16068 }
16069
16070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16071         void* o_ptr = untag_ptr(o);
16072         CHECK_ACCESS(o_ptr);
16073         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
16074         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
16075         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16076         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
16077         int64_t ret_ref = tag_ptr(ret_copy, true);
16078         return ret_ref;
16079 }
16080
16081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
16082         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16083         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
16084         int64_t ret_ref = tag_ptr(ret_copy, true);
16085         return ret_ref;
16086 }
16087
16088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16089         if (!ptr_is_owned(_res)) return;
16090         void* _res_ptr = untag_ptr(_res);
16091         CHECK_ACCESS(_res_ptr);
16092         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
16093         FREE(untag_ptr(_res));
16094         COption_C2Tuple_u64u64ZZ_free(_res_conv);
16095 }
16096
16097 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
16098         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16099         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
16100         int64_t ret_ref = tag_ptr(ret_copy, true);
16101         return ret_ref;
16102 }
16103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16104         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
16105         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
16106         return ret_conv;
16107 }
16108
16109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16110         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
16111         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16112         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
16113         int64_t ret_ref = tag_ptr(ret_copy, true);
16114         return ret_ref;
16115 }
16116
16117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16118         LDKCVec_NodeIdZ _res_constr;
16119         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16120         if (_res_constr.datalen > 0)
16121                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
16122         else
16123                 _res_constr.data = NULL;
16124         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16125         for (size_t i = 0; i < _res_constr.datalen; i++) {
16126                 int64_t _res_conv_8 = _res_vals[i];
16127                 LDKNodeId _res_conv_8_conv;
16128                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
16129                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
16130                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
16131                 _res_constr.data[i] = _res_conv_8_conv;
16132         }
16133         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16134         CVec_NodeIdZ_free(_res_constr);
16135 }
16136
16137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16138         LDKProbabilisticScorer o_conv;
16139         o_conv.inner = untag_ptr(o);
16140         o_conv.is_owned = ptr_is_owned(o);
16141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16142         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16143         
16144         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16145         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16146         return tag_ptr(ret_conv, true);
16147 }
16148
16149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16150         LDKDecodeError e_conv;
16151         e_conv.inner = untag_ptr(e);
16152         e_conv.is_owned = ptr_is_owned(e);
16153         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16154         e_conv = DecodeError_clone(&e_conv);
16155         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16156         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16157         return tag_ptr(ret_conv, true);
16158 }
16159
16160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16161         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
16162         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
16163         return ret_conv;
16164 }
16165
16166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16167         if (!ptr_is_owned(_res)) return;
16168         void* _res_ptr = untag_ptr(_res);
16169         CHECK_ACCESS(_res_ptr);
16170         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
16171         FREE(untag_ptr(_res));
16172         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
16173 }
16174
16175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16176         LDKInitFeatures o_conv;
16177         o_conv.inner = untag_ptr(o);
16178         o_conv.is_owned = ptr_is_owned(o);
16179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16180         o_conv = InitFeatures_clone(&o_conv);
16181         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16182         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
16183         return tag_ptr(ret_conv, true);
16184 }
16185
16186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16187         LDKDecodeError e_conv;
16188         e_conv.inner = untag_ptr(e);
16189         e_conv.is_owned = ptr_is_owned(e);
16190         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16191         e_conv = DecodeError_clone(&e_conv);
16192         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16193         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
16194         return tag_ptr(ret_conv, true);
16195 }
16196
16197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16198         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
16199         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16200         return ret_conv;
16201 }
16202
16203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16204         if (!ptr_is_owned(_res)) return;
16205         void* _res_ptr = untag_ptr(_res);
16206         CHECK_ACCESS(_res_ptr);
16207         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16208         FREE(untag_ptr(_res));
16209         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16210 }
16211
16212 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16213         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16214         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
16215         return tag_ptr(ret_conv, true);
16216 }
16217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16218         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
16219         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16220         return ret_conv;
16221 }
16222
16223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16224         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
16225         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16226         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
16227         return tag_ptr(ret_conv, true);
16228 }
16229
16230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16231         LDKChannelFeatures o_conv;
16232         o_conv.inner = untag_ptr(o);
16233         o_conv.is_owned = ptr_is_owned(o);
16234         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16235         o_conv = ChannelFeatures_clone(&o_conv);
16236         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16237         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16238         return tag_ptr(ret_conv, true);
16239 }
16240
16241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16242         LDKDecodeError e_conv;
16243         e_conv.inner = untag_ptr(e);
16244         e_conv.is_owned = ptr_is_owned(e);
16245         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16246         e_conv = DecodeError_clone(&e_conv);
16247         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16248         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16249         return tag_ptr(ret_conv, true);
16250 }
16251
16252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16253         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
16254         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16255         return ret_conv;
16256 }
16257
16258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16259         if (!ptr_is_owned(_res)) return;
16260         void* _res_ptr = untag_ptr(_res);
16261         CHECK_ACCESS(_res_ptr);
16262         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16263         FREE(untag_ptr(_res));
16264         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16265 }
16266
16267 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16268         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16269         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
16270         return tag_ptr(ret_conv, true);
16271 }
16272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16273         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
16274         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16275         return ret_conv;
16276 }
16277
16278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16279         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
16280         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16281         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
16282         return tag_ptr(ret_conv, true);
16283 }
16284
16285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16286         LDKNodeFeatures o_conv;
16287         o_conv.inner = untag_ptr(o);
16288         o_conv.is_owned = ptr_is_owned(o);
16289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16290         o_conv = NodeFeatures_clone(&o_conv);
16291         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16292         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16293         return tag_ptr(ret_conv, true);
16294 }
16295
16296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16297         LDKDecodeError e_conv;
16298         e_conv.inner = untag_ptr(e);
16299         e_conv.is_owned = ptr_is_owned(e);
16300         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16301         e_conv = DecodeError_clone(&e_conv);
16302         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16303         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16304         return tag_ptr(ret_conv, true);
16305 }
16306
16307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16308         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
16309         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16310         return ret_conv;
16311 }
16312
16313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16314         if (!ptr_is_owned(_res)) return;
16315         void* _res_ptr = untag_ptr(_res);
16316         CHECK_ACCESS(_res_ptr);
16317         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16318         FREE(untag_ptr(_res));
16319         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16320 }
16321
16322 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16323         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16324         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
16325         return tag_ptr(ret_conv, true);
16326 }
16327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16328         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
16329         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16330         return ret_conv;
16331 }
16332
16333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16334         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
16335         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16336         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
16337         return tag_ptr(ret_conv, true);
16338 }
16339
16340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16341         LDKInvoiceFeatures o_conv;
16342         o_conv.inner = untag_ptr(o);
16343         o_conv.is_owned = ptr_is_owned(o);
16344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16345         o_conv = InvoiceFeatures_clone(&o_conv);
16346         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16347         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16348         return tag_ptr(ret_conv, true);
16349 }
16350
16351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16352         LDKDecodeError e_conv;
16353         e_conv.inner = untag_ptr(e);
16354         e_conv.is_owned = ptr_is_owned(e);
16355         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16356         e_conv = DecodeError_clone(&e_conv);
16357         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16358         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
16359         return tag_ptr(ret_conv, true);
16360 }
16361
16362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16363         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
16364         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
16365         return ret_conv;
16366 }
16367
16368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16369         if (!ptr_is_owned(_res)) return;
16370         void* _res_ptr = untag_ptr(_res);
16371         CHECK_ACCESS(_res_ptr);
16372         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
16373         FREE(untag_ptr(_res));
16374         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
16375 }
16376
16377 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16378         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16379         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
16380         return tag_ptr(ret_conv, true);
16381 }
16382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16383         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
16384         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16385         return ret_conv;
16386 }
16387
16388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16389         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
16390         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16391         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
16392         return tag_ptr(ret_conv, true);
16393 }
16394
16395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16396         LDKChannelTypeFeatures o_conv;
16397         o_conv.inner = untag_ptr(o);
16398         o_conv.is_owned = ptr_is_owned(o);
16399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16400         o_conv = ChannelTypeFeatures_clone(&o_conv);
16401         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16402         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
16403         return tag_ptr(ret_conv, true);
16404 }
16405
16406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16407         LDKDecodeError e_conv;
16408         e_conv.inner = untag_ptr(e);
16409         e_conv.is_owned = ptr_is_owned(e);
16410         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16411         e_conv = DecodeError_clone(&e_conv);
16412         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16413         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
16414         return tag_ptr(ret_conv, true);
16415 }
16416
16417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16418         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
16419         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
16420         return ret_conv;
16421 }
16422
16423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16424         if (!ptr_is_owned(_res)) return;
16425         void* _res_ptr = untag_ptr(_res);
16426         CHECK_ACCESS(_res_ptr);
16427         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
16428         FREE(untag_ptr(_res));
16429         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
16430 }
16431
16432 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16433         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16434         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
16435         return tag_ptr(ret_conv, true);
16436 }
16437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16438         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
16439         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16440         return ret_conv;
16441 }
16442
16443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16444         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
16445         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16446         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
16447         return tag_ptr(ret_conv, true);
16448 }
16449
16450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16451         LDKNodeId o_conv;
16452         o_conv.inner = untag_ptr(o);
16453         o_conv.is_owned = ptr_is_owned(o);
16454         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16455         o_conv = NodeId_clone(&o_conv);
16456         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16457         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
16458         return tag_ptr(ret_conv, true);
16459 }
16460
16461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16462         LDKDecodeError e_conv;
16463         e_conv.inner = untag_ptr(e);
16464         e_conv.is_owned = ptr_is_owned(e);
16465         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16466         e_conv = DecodeError_clone(&e_conv);
16467         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16468         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
16469         return tag_ptr(ret_conv, true);
16470 }
16471
16472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16473         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
16474         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
16475         return ret_conv;
16476 }
16477
16478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16479         if (!ptr_is_owned(_res)) return;
16480         void* _res_ptr = untag_ptr(_res);
16481         CHECK_ACCESS(_res_ptr);
16482         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
16483         FREE(untag_ptr(_res));
16484         CResult_NodeIdDecodeErrorZ_free(_res_conv);
16485 }
16486
16487 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
16488         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16489         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
16490         return tag_ptr(ret_conv, true);
16491 }
16492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16493         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
16494         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
16495         return ret_conv;
16496 }
16497
16498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16499         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
16500         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16501         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
16502         return tag_ptr(ret_conv, true);
16503 }
16504
16505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16506         void* o_ptr = untag_ptr(o);
16507         CHECK_ACCESS(o_ptr);
16508         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
16509         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
16510         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16511         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
16512         return tag_ptr(ret_conv, true);
16513 }
16514
16515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16516         LDKDecodeError e_conv;
16517         e_conv.inner = untag_ptr(e);
16518         e_conv.is_owned = ptr_is_owned(e);
16519         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16520         e_conv = DecodeError_clone(&e_conv);
16521         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16522         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
16523         return tag_ptr(ret_conv, true);
16524 }
16525
16526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16527         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
16528         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
16529         return ret_conv;
16530 }
16531
16532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16533         if (!ptr_is_owned(_res)) return;
16534         void* _res_ptr = untag_ptr(_res);
16535         CHECK_ACCESS(_res_ptr);
16536         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
16537         FREE(untag_ptr(_res));
16538         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
16539 }
16540
16541 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
16542         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16543         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
16544         return tag_ptr(ret_conv, true);
16545 }
16546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16547         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
16548         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
16549         return ret_conv;
16550 }
16551
16552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16553         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
16554         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16555         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
16556         return tag_ptr(ret_conv, true);
16557 }
16558
16559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16560         void* o_ptr = untag_ptr(o);
16561         CHECK_ACCESS(o_ptr);
16562         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
16563         if (o_conv.free == LDKAccess_JCalls_free) {
16564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16565                 LDKAccess_JCalls_cloned(&o_conv);
16566         }
16567         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16568         *ret_copy = COption_AccessZ_some(o_conv);
16569         int64_t ret_ref = tag_ptr(ret_copy, true);
16570         return ret_ref;
16571 }
16572
16573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
16574         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16575         *ret_copy = COption_AccessZ_none();
16576         int64_t ret_ref = tag_ptr(ret_copy, true);
16577         return ret_ref;
16578 }
16579
16580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16581         if (!ptr_is_owned(_res)) return;
16582         void* _res_ptr = untag_ptr(_res);
16583         CHECK_ACCESS(_res_ptr);
16584         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
16585         FREE(untag_ptr(_res));
16586         COption_AccessZ_free(_res_conv);
16587 }
16588
16589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
16590         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16591         *ret_conv = CResult_boolLightningErrorZ_ok(o);
16592         return tag_ptr(ret_conv, true);
16593 }
16594
16595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16596         LDKLightningError e_conv;
16597         e_conv.inner = untag_ptr(e);
16598         e_conv.is_owned = ptr_is_owned(e);
16599         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16600         e_conv = LightningError_clone(&e_conv);
16601         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16602         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
16603         return tag_ptr(ret_conv, true);
16604 }
16605
16606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16607         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
16608         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
16609         return ret_conv;
16610 }
16611
16612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16613         if (!ptr_is_owned(_res)) return;
16614         void* _res_ptr = untag_ptr(_res);
16615         CHECK_ACCESS(_res_ptr);
16616         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
16617         FREE(untag_ptr(_res));
16618         CResult_boolLightningErrorZ_free(_res_conv);
16619 }
16620
16621 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
16622         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16623         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
16624         return tag_ptr(ret_conv, true);
16625 }
16626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16627         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
16628         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
16629         return ret_conv;
16630 }
16631
16632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16633         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
16634         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16635         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
16636         return tag_ptr(ret_conv, true);
16637 }
16638
16639 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
16640         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16641         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
16642         return tag_ptr(ret_conv, true);
16643 }
16644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16645         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
16646         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
16647         return ret_conv;
16648 }
16649
16650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16651         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
16652         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16653         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
16654         return tag_ptr(ret_conv, true);
16655 }
16656
16657 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) {
16658         LDKChannelAnnouncement a_conv;
16659         a_conv.inner = untag_ptr(a);
16660         a_conv.is_owned = ptr_is_owned(a);
16661         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16662         a_conv = ChannelAnnouncement_clone(&a_conv);
16663         LDKChannelUpdate b_conv;
16664         b_conv.inner = untag_ptr(b);
16665         b_conv.is_owned = ptr_is_owned(b);
16666         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16667         b_conv = ChannelUpdate_clone(&b_conv);
16668         LDKChannelUpdate c_conv;
16669         c_conv.inner = untag_ptr(c);
16670         c_conv.is_owned = ptr_is_owned(c);
16671         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16672         c_conv = ChannelUpdate_clone(&c_conv);
16673         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16674         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
16675         return tag_ptr(ret_conv, true);
16676 }
16677
16678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16679         if (!ptr_is_owned(_res)) return;
16680         void* _res_ptr = untag_ptr(_res);
16681         CHECK_ACCESS(_res_ptr);
16682         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
16683         FREE(untag_ptr(_res));
16684         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
16685 }
16686
16687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16688         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
16689         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16690         if (_res_constr.datalen > 0)
16691                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
16692         else
16693                 _res_constr.data = NULL;
16694         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16695         for (size_t h = 0; h < _res_constr.datalen; h++) {
16696                 int64_t _res_conv_59 = _res_vals[h];
16697                 void* _res_conv_59_ptr = untag_ptr(_res_conv_59);
16698                 CHECK_ACCESS(_res_conv_59_ptr);
16699                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
16700                 FREE(untag_ptr(_res_conv_59));
16701                 _res_constr.data[h] = _res_conv_59_conv;
16702         }
16703         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16704         CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
16705 }
16706
16707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16708         LDKCVec_NodeAnnouncementZ _res_constr;
16709         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16710         if (_res_constr.datalen > 0)
16711                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
16712         else
16713                 _res_constr.data = NULL;
16714         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16715         for (size_t s = 0; s < _res_constr.datalen; s++) {
16716                 int64_t _res_conv_18 = _res_vals[s];
16717                 LDKNodeAnnouncement _res_conv_18_conv;
16718                 _res_conv_18_conv.inner = untag_ptr(_res_conv_18);
16719                 _res_conv_18_conv.is_owned = ptr_is_owned(_res_conv_18);
16720                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
16721                 _res_constr.data[s] = _res_conv_18_conv;
16722         }
16723         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16724         CVec_NodeAnnouncementZ_free(_res_constr);
16725 }
16726
16727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
16728         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16729         *ret_conv = CResult_NoneLightningErrorZ_ok();
16730         return tag_ptr(ret_conv, true);
16731 }
16732
16733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16734         LDKLightningError e_conv;
16735         e_conv.inner = untag_ptr(e);
16736         e_conv.is_owned = ptr_is_owned(e);
16737         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16738         e_conv = LightningError_clone(&e_conv);
16739         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16740         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
16741         return tag_ptr(ret_conv, true);
16742 }
16743
16744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16745         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
16746         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
16747         return ret_conv;
16748 }
16749
16750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16751         if (!ptr_is_owned(_res)) return;
16752         void* _res_ptr = untag_ptr(_res);
16753         CHECK_ACCESS(_res_ptr);
16754         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
16755         FREE(untag_ptr(_res));
16756         CResult_NoneLightningErrorZ_free(_res_conv);
16757 }
16758
16759 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
16760         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16761         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
16762         return tag_ptr(ret_conv, true);
16763 }
16764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16765         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
16766         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
16767         return ret_conv;
16768 }
16769
16770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16771         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
16772         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16773         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
16774         return tag_ptr(ret_conv, true);
16775 }
16776
16777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16778         LDKChannelUpdateInfo o_conv;
16779         o_conv.inner = untag_ptr(o);
16780         o_conv.is_owned = ptr_is_owned(o);
16781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16782         o_conv = ChannelUpdateInfo_clone(&o_conv);
16783         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16784         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
16785         return tag_ptr(ret_conv, true);
16786 }
16787
16788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16789         LDKDecodeError e_conv;
16790         e_conv.inner = untag_ptr(e);
16791         e_conv.is_owned = ptr_is_owned(e);
16792         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16793         e_conv = DecodeError_clone(&e_conv);
16794         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16795         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
16796         return tag_ptr(ret_conv, true);
16797 }
16798
16799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16800         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
16801         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
16802         return ret_conv;
16803 }
16804
16805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16806         if (!ptr_is_owned(_res)) return;
16807         void* _res_ptr = untag_ptr(_res);
16808         CHECK_ACCESS(_res_ptr);
16809         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
16810         FREE(untag_ptr(_res));
16811         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
16812 }
16813
16814 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
16815         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16816         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
16817         return tag_ptr(ret_conv, true);
16818 }
16819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16820         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
16821         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
16822         return ret_conv;
16823 }
16824
16825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16826         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
16827         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16828         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
16829         return tag_ptr(ret_conv, true);
16830 }
16831
16832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16833         LDKChannelInfo o_conv;
16834         o_conv.inner = untag_ptr(o);
16835         o_conv.is_owned = ptr_is_owned(o);
16836         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16837         o_conv = ChannelInfo_clone(&o_conv);
16838         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16839         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
16840         return tag_ptr(ret_conv, true);
16841 }
16842
16843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16844         LDKDecodeError e_conv;
16845         e_conv.inner = untag_ptr(e);
16846         e_conv.is_owned = ptr_is_owned(e);
16847         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16848         e_conv = DecodeError_clone(&e_conv);
16849         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16850         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
16851         return tag_ptr(ret_conv, true);
16852 }
16853
16854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16855         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
16856         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
16857         return ret_conv;
16858 }
16859
16860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16861         if (!ptr_is_owned(_res)) return;
16862         void* _res_ptr = untag_ptr(_res);
16863         CHECK_ACCESS(_res_ptr);
16864         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
16865         FREE(untag_ptr(_res));
16866         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
16867 }
16868
16869 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
16870         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16871         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
16872         return tag_ptr(ret_conv, true);
16873 }
16874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16875         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
16876         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
16877         return ret_conv;
16878 }
16879
16880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16881         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
16882         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
16883         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
16884         return tag_ptr(ret_conv, true);
16885 }
16886
16887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16888         LDKRoutingFees o_conv;
16889         o_conv.inner = untag_ptr(o);
16890         o_conv.is_owned = ptr_is_owned(o);
16891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16892         o_conv = RoutingFees_clone(&o_conv);
16893         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16894         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
16895         return tag_ptr(ret_conv, true);
16896 }
16897
16898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16899         LDKDecodeError e_conv;
16900         e_conv.inner = untag_ptr(e);
16901         e_conv.is_owned = ptr_is_owned(e);
16902         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16903         e_conv = DecodeError_clone(&e_conv);
16904         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16905         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
16906         return tag_ptr(ret_conv, true);
16907 }
16908
16909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16910         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
16911         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
16912         return ret_conv;
16913 }
16914
16915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16916         if (!ptr_is_owned(_res)) return;
16917         void* _res_ptr = untag_ptr(_res);
16918         CHECK_ACCESS(_res_ptr);
16919         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
16920         FREE(untag_ptr(_res));
16921         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
16922 }
16923
16924 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
16925         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16926         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
16927         return tag_ptr(ret_conv, true);
16928 }
16929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16930         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
16931         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
16932         return ret_conv;
16933 }
16934
16935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16936         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
16937         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16938         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
16939         return tag_ptr(ret_conv, true);
16940 }
16941
16942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16943         LDKCVec_NetAddressZ _res_constr;
16944         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16945         if (_res_constr.datalen > 0)
16946                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16947         else
16948                 _res_constr.data = NULL;
16949         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16950         for (size_t m = 0; m < _res_constr.datalen; m++) {
16951                 int64_t _res_conv_12 = _res_vals[m];
16952                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
16953                 CHECK_ACCESS(_res_conv_12_ptr);
16954                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
16955                 FREE(untag_ptr(_res_conv_12));
16956                 _res_constr.data[m] = _res_conv_12_conv;
16957         }
16958         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16959         CVec_NetAddressZ_free(_res_constr);
16960 }
16961
16962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16963         LDKNodeAnnouncementInfo o_conv;
16964         o_conv.inner = untag_ptr(o);
16965         o_conv.is_owned = ptr_is_owned(o);
16966         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16967         o_conv = NodeAnnouncementInfo_clone(&o_conv);
16968         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16969         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
16970         return tag_ptr(ret_conv, true);
16971 }
16972
16973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16974         LDKDecodeError e_conv;
16975         e_conv.inner = untag_ptr(e);
16976         e_conv.is_owned = ptr_is_owned(e);
16977         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16978         e_conv = DecodeError_clone(&e_conv);
16979         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16980         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
16981         return tag_ptr(ret_conv, true);
16982 }
16983
16984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16985         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
16986         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
16987         return ret_conv;
16988 }
16989
16990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16991         if (!ptr_is_owned(_res)) return;
16992         void* _res_ptr = untag_ptr(_res);
16993         CHECK_ACCESS(_res_ptr);
16994         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
16995         FREE(untag_ptr(_res));
16996         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
16997 }
16998
16999 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
17000         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17001         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
17002         return tag_ptr(ret_conv, true);
17003 }
17004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17005         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
17006         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
17007         return ret_conv;
17008 }
17009
17010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17011         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
17012         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17013         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
17014         return tag_ptr(ret_conv, true);
17015 }
17016
17017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17018         LDKNodeAlias o_conv;
17019         o_conv.inner = untag_ptr(o);
17020         o_conv.is_owned = ptr_is_owned(o);
17021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17022         o_conv = NodeAlias_clone(&o_conv);
17023         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17024         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
17025         return tag_ptr(ret_conv, true);
17026 }
17027
17028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17029         LDKDecodeError e_conv;
17030         e_conv.inner = untag_ptr(e);
17031         e_conv.is_owned = ptr_is_owned(e);
17032         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17033         e_conv = DecodeError_clone(&e_conv);
17034         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17035         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
17036         return tag_ptr(ret_conv, true);
17037 }
17038
17039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17040         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
17041         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
17042         return ret_conv;
17043 }
17044
17045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17046         if (!ptr_is_owned(_res)) return;
17047         void* _res_ptr = untag_ptr(_res);
17048         CHECK_ACCESS(_res_ptr);
17049         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
17050         FREE(untag_ptr(_res));
17051         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
17052 }
17053
17054 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
17055         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17056         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
17057         return tag_ptr(ret_conv, true);
17058 }
17059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17060         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
17061         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
17062         return ret_conv;
17063 }
17064
17065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17066         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
17067         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17068         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
17069         return tag_ptr(ret_conv, true);
17070 }
17071
17072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17073         LDKNodeInfo o_conv;
17074         o_conv.inner = untag_ptr(o);
17075         o_conv.is_owned = ptr_is_owned(o);
17076         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17077         o_conv = NodeInfo_clone(&o_conv);
17078         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17079         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
17080         return tag_ptr(ret_conv, true);
17081 }
17082
17083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17084         LDKDecodeError e_conv;
17085         e_conv.inner = untag_ptr(e);
17086         e_conv.is_owned = ptr_is_owned(e);
17087         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17088         e_conv = DecodeError_clone(&e_conv);
17089         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17090         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
17091         return tag_ptr(ret_conv, true);
17092 }
17093
17094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17095         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
17096         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
17097         return ret_conv;
17098 }
17099
17100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17101         if (!ptr_is_owned(_res)) return;
17102         void* _res_ptr = untag_ptr(_res);
17103         CHECK_ACCESS(_res_ptr);
17104         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
17105         FREE(untag_ptr(_res));
17106         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
17107 }
17108
17109 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
17110         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17111         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
17112         return tag_ptr(ret_conv, true);
17113 }
17114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17115         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
17116         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
17117         return ret_conv;
17118 }
17119
17120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17121         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
17122         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17123         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
17124         return tag_ptr(ret_conv, true);
17125 }
17126
17127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17128         LDKNetworkGraph o_conv;
17129         o_conv.inner = untag_ptr(o);
17130         o_conv.is_owned = ptr_is_owned(o);
17131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17132         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
17133         
17134         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17135         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
17136         return tag_ptr(ret_conv, true);
17137 }
17138
17139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17140         LDKDecodeError e_conv;
17141         e_conv.inner = untag_ptr(e);
17142         e_conv.is_owned = ptr_is_owned(e);
17143         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17144         e_conv = DecodeError_clone(&e_conv);
17145         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17146         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
17147         return tag_ptr(ret_conv, true);
17148 }
17149
17150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17151         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
17152         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
17153         return ret_conv;
17154 }
17155
17156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17157         if (!ptr_is_owned(_res)) return;
17158         void* _res_ptr = untag_ptr(_res);
17159         CHECK_ACCESS(_res_ptr);
17160         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
17161         FREE(untag_ptr(_res));
17162         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
17163 }
17164
17165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
17166         LDKCVec_NetAddressZ o_constr;
17167         o_constr.datalen = (*env)->GetArrayLength(env, o);
17168         if (o_constr.datalen > 0)
17169                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17170         else
17171                 o_constr.data = NULL;
17172         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17173         for (size_t m = 0; m < o_constr.datalen; m++) {
17174                 int64_t o_conv_12 = o_vals[m];
17175                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
17176                 CHECK_ACCESS(o_conv_12_ptr);
17177                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
17178                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
17179                 o_constr.data[m] = o_conv_12_conv;
17180         }
17181         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17182         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17183         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
17184         int64_t ret_ref = tag_ptr(ret_copy, true);
17185         return ret_ref;
17186 }
17187
17188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
17189         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17190         *ret_copy = COption_CVec_NetAddressZZ_none();
17191         int64_t ret_ref = tag_ptr(ret_copy, true);
17192         return ret_ref;
17193 }
17194
17195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17196         if (!ptr_is_owned(_res)) return;
17197         void* _res_ptr = untag_ptr(_res);
17198         CHECK_ACCESS(_res_ptr);
17199         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
17200         FREE(untag_ptr(_res));
17201         COption_CVec_NetAddressZZ_free(_res_conv);
17202 }
17203
17204 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
17205         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17206         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
17207         int64_t ret_ref = tag_ptr(ret_copy, true);
17208         return ret_ref;
17209 }
17210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17211         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
17212         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
17213         return ret_conv;
17214 }
17215
17216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17217         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
17218         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17219         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
17220         int64_t ret_ref = tag_ptr(ret_copy, true);
17221         return ret_ref;
17222 }
17223
17224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17225         LDKDelayedPaymentOutputDescriptor o_conv;
17226         o_conv.inner = untag_ptr(o);
17227         o_conv.is_owned = ptr_is_owned(o);
17228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17229         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17230         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17231         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17232         return tag_ptr(ret_conv, true);
17233 }
17234
17235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17236         LDKDecodeError e_conv;
17237         e_conv.inner = untag_ptr(e);
17238         e_conv.is_owned = ptr_is_owned(e);
17239         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17240         e_conv = DecodeError_clone(&e_conv);
17241         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17242         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17243         return tag_ptr(ret_conv, true);
17244 }
17245
17246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17247         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17248         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17249         return ret_conv;
17250 }
17251
17252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17253         if (!ptr_is_owned(_res)) return;
17254         void* _res_ptr = untag_ptr(_res);
17255         CHECK_ACCESS(_res_ptr);
17256         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17257         FREE(untag_ptr(_res));
17258         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17259 }
17260
17261 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17262         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17263         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17264         return tag_ptr(ret_conv, true);
17265 }
17266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17267         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17268         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17269         return ret_conv;
17270 }
17271
17272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17273         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17274         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17275         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17276         return tag_ptr(ret_conv, true);
17277 }
17278
17279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17280         LDKStaticPaymentOutputDescriptor o_conv;
17281         o_conv.inner = untag_ptr(o);
17282         o_conv.is_owned = ptr_is_owned(o);
17283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17284         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17285         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17286         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17287         return tag_ptr(ret_conv, true);
17288 }
17289
17290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17291         LDKDecodeError e_conv;
17292         e_conv.inner = untag_ptr(e);
17293         e_conv.is_owned = ptr_is_owned(e);
17294         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17295         e_conv = DecodeError_clone(&e_conv);
17296         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17297         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17298         return tag_ptr(ret_conv, true);
17299 }
17300
17301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17302         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17303         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17304         return ret_conv;
17305 }
17306
17307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17308         if (!ptr_is_owned(_res)) return;
17309         void* _res_ptr = untag_ptr(_res);
17310         CHECK_ACCESS(_res_ptr);
17311         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17312         FREE(untag_ptr(_res));
17313         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17314 }
17315
17316 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17317         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17318         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17319         return tag_ptr(ret_conv, true);
17320 }
17321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17322         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17323         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17324         return ret_conv;
17325 }
17326
17327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17328         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17329         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17330         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17331         return tag_ptr(ret_conv, true);
17332 }
17333
17334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17335         void* o_ptr = untag_ptr(o);
17336         CHECK_ACCESS(o_ptr);
17337         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17338         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
17339         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17340         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17341         return tag_ptr(ret_conv, true);
17342 }
17343
17344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17345         LDKDecodeError e_conv;
17346         e_conv.inner = untag_ptr(e);
17347         e_conv.is_owned = ptr_is_owned(e);
17348         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17349         e_conv = DecodeError_clone(&e_conv);
17350         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17351         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17352         return tag_ptr(ret_conv, true);
17353 }
17354
17355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17356         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17357         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17358         return ret_conv;
17359 }
17360
17361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17362         if (!ptr_is_owned(_res)) return;
17363         void* _res_ptr = untag_ptr(_res);
17364         CHECK_ACCESS(_res_ptr);
17365         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17366         FREE(untag_ptr(_res));
17367         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17368 }
17369
17370 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17371         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17372         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17373         return tag_ptr(ret_conv, true);
17374 }
17375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17376         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17377         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17378         return ret_conv;
17379 }
17380
17381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17382         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17383         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17384         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17385         return tag_ptr(ret_conv, true);
17386 }
17387
17388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17389         LDKCVec_PaymentPreimageZ _res_constr;
17390         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17391         if (_res_constr.datalen > 0)
17392                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
17393         else
17394                 _res_constr.data = NULL;
17395         for (size_t i = 0; i < _res_constr.datalen; i++) {
17396                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17397                 LDKThirtyTwoBytes _res_conv_8_ref;
17398                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
17399                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
17400                 _res_constr.data[i] = _res_conv_8_ref;
17401         }
17402         CVec_PaymentPreimageZ_free(_res_constr);
17403 }
17404
17405 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
17406         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17407         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
17408         return tag_ptr(ret_conv, true);
17409 }
17410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17411         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
17412         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
17413         return ret_conv;
17414 }
17415
17416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17417         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
17418         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17419         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
17420         return tag_ptr(ret_conv, true);
17421 }
17422
17423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
17424         LDKSignature a_ref;
17425         CHECK((*env)->GetArrayLength(env, a) == 64);
17426         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
17427         LDKCVec_SignatureZ b_constr;
17428         b_constr.datalen = (*env)->GetArrayLength(env, b);
17429         if (b_constr.datalen > 0)
17430                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17431         else
17432                 b_constr.data = NULL;
17433         for (size_t i = 0; i < b_constr.datalen; i++) {
17434                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
17435                 LDKSignature b_conv_8_ref;
17436                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
17437                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
17438                 b_constr.data[i] = b_conv_8_ref;
17439         }
17440         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17441         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
17442         return tag_ptr(ret_conv, true);
17443 }
17444
17445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17446         if (!ptr_is_owned(_res)) return;
17447         void* _res_ptr = untag_ptr(_res);
17448         CHECK_ACCESS(_res_ptr);
17449         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
17450         FREE(untag_ptr(_res));
17451         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
17452 }
17453
17454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17455         void* o_ptr = untag_ptr(o);
17456         CHECK_ACCESS(o_ptr);
17457         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
17458         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
17459         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17460         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
17461         return tag_ptr(ret_conv, true);
17462 }
17463
17464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
17465         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17466         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
17467         return tag_ptr(ret_conv, true);
17468 }
17469
17470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17471         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
17472         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
17473         return ret_conv;
17474 }
17475
17476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17477         if (!ptr_is_owned(_res)) return;
17478         void* _res_ptr = untag_ptr(_res);
17479         CHECK_ACCESS(_res_ptr);
17480         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
17481         FREE(untag_ptr(_res));
17482         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
17483 }
17484
17485 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
17486         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17487         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
17488         return tag_ptr(ret_conv, true);
17489 }
17490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17491         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
17492         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
17493         return ret_conv;
17494 }
17495
17496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17497         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
17498         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17499         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
17500         return tag_ptr(ret_conv, true);
17501 }
17502
17503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17504         LDKSignature o_ref;
17505         CHECK((*env)->GetArrayLength(env, o) == 64);
17506         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
17507         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17508         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
17509         return tag_ptr(ret_conv, true);
17510 }
17511
17512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17513         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17514         *ret_conv = CResult_SignatureNoneZ_err();
17515         return tag_ptr(ret_conv, true);
17516 }
17517
17518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17519         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
17520         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
17521         return ret_conv;
17522 }
17523
17524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17525         if (!ptr_is_owned(_res)) return;
17526         void* _res_ptr = untag_ptr(_res);
17527         CHECK_ACCESS(_res_ptr);
17528         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
17529         FREE(untag_ptr(_res));
17530         CResult_SignatureNoneZ_free(_res_conv);
17531 }
17532
17533 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
17534         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17535         *ret_conv = CResult_SignatureNoneZ_clone(arg);
17536         return tag_ptr(ret_conv, true);
17537 }
17538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17539         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
17540         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
17541         return ret_conv;
17542 }
17543
17544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17545         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
17546         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17547         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
17548         return tag_ptr(ret_conv, true);
17549 }
17550
17551 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
17552         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17553         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
17554         return tag_ptr(ret_conv, true);
17555 }
17556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17557         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
17558         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
17559         return ret_conv;
17560 }
17561
17562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17563         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
17564         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17565         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
17566         return tag_ptr(ret_conv, true);
17567 }
17568
17569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17570         LDKSignature a_ref;
17571         CHECK((*env)->GetArrayLength(env, a) == 64);
17572         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
17573         LDKSignature b_ref;
17574         CHECK((*env)->GetArrayLength(env, b) == 64);
17575         (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
17576         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17577         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
17578         return tag_ptr(ret_conv, true);
17579 }
17580
17581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17582         if (!ptr_is_owned(_res)) return;
17583         void* _res_ptr = untag_ptr(_res);
17584         CHECK_ACCESS(_res_ptr);
17585         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
17586         FREE(untag_ptr(_res));
17587         C2Tuple_SignatureSignatureZ_free(_res_conv);
17588 }
17589
17590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17591         void* o_ptr = untag_ptr(o);
17592         CHECK_ACCESS(o_ptr);
17593         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
17594         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
17595         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17596         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
17597         return tag_ptr(ret_conv, true);
17598 }
17599
17600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
17601         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17602         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
17603         return tag_ptr(ret_conv, true);
17604 }
17605
17606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17607         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
17608         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
17609         return ret_conv;
17610 }
17611
17612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17613         if (!ptr_is_owned(_res)) return;
17614         void* _res_ptr = untag_ptr(_res);
17615         CHECK_ACCESS(_res_ptr);
17616         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
17617         FREE(untag_ptr(_res));
17618         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
17619 }
17620
17621 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
17622         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17623         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
17624         return tag_ptr(ret_conv, true);
17625 }
17626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17627         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
17628         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
17629         return ret_conv;
17630 }
17631
17632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17633         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
17634         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17635         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
17636         return tag_ptr(ret_conv, true);
17637 }
17638
17639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17640         LDKSecretKey o_ref;
17641         CHECK((*env)->GetArrayLength(env, o) == 32);
17642         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
17643         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17644         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
17645         return tag_ptr(ret_conv, true);
17646 }
17647
17648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
17649         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17650         *ret_conv = CResult_SecretKeyNoneZ_err();
17651         return tag_ptr(ret_conv, true);
17652 }
17653
17654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17655         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
17656         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
17657         return ret_conv;
17658 }
17659
17660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17661         if (!ptr_is_owned(_res)) return;
17662         void* _res_ptr = untag_ptr(_res);
17663         CHECK_ACCESS(_res_ptr);
17664         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
17665         FREE(untag_ptr(_res));
17666         CResult_SecretKeyNoneZ_free(_res_conv);
17667 }
17668
17669 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
17670         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17671         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
17672         return tag_ptr(ret_conv, true);
17673 }
17674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17675         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
17676         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
17677         return ret_conv;
17678 }
17679
17680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17681         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
17682         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17683         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
17684         return tag_ptr(ret_conv, true);
17685 }
17686
17687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17688         void* o_ptr = untag_ptr(o);
17689         CHECK_ACCESS(o_ptr);
17690         LDKSign o_conv = *(LDKSign*)(o_ptr);
17691         if (o_conv.free == LDKSign_JCalls_free) {
17692                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17693                 LDKSign_JCalls_cloned(&o_conv);
17694         }
17695         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17696         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
17697         return tag_ptr(ret_conv, true);
17698 }
17699
17700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17701         LDKDecodeError e_conv;
17702         e_conv.inner = untag_ptr(e);
17703         e_conv.is_owned = ptr_is_owned(e);
17704         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17705         e_conv = DecodeError_clone(&e_conv);
17706         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17707         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
17708         return tag_ptr(ret_conv, true);
17709 }
17710
17711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17712         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
17713         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
17714         return ret_conv;
17715 }
17716
17717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17718         if (!ptr_is_owned(_res)) return;
17719         void* _res_ptr = untag_ptr(_res);
17720         CHECK_ACCESS(_res_ptr);
17721         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
17722         FREE(untag_ptr(_res));
17723         CResult_SignDecodeErrorZ_free(_res_conv);
17724 }
17725
17726 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
17727         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17728         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
17729         return tag_ptr(ret_conv, true);
17730 }
17731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17732         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
17733         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
17734         return ret_conv;
17735 }
17736
17737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17738         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
17739         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17740         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
17741         return tag_ptr(ret_conv, true);
17742 }
17743
17744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17745         LDKCVec_u5Z _res_constr;
17746         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17747         if (_res_constr.datalen > 0)
17748                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
17749         else
17750                 _res_constr.data = NULL;
17751         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
17752         for (size_t h = 0; h < _res_constr.datalen; h++) {
17753                 int8_t _res_conv_7 = _res_vals[h];
17754                 
17755                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
17756         }
17757         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
17758         CVec_u5Z_free(_res_constr);
17759 }
17760
17761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17762         LDKRecoverableSignature o_ref;
17763         CHECK((*env)->GetArrayLength(env, o) == 68);
17764         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
17765         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17766         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
17767         return tag_ptr(ret_conv, true);
17768 }
17769
17770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17771         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17772         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
17773         return tag_ptr(ret_conv, true);
17774 }
17775
17776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17777         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
17778         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
17779         return ret_conv;
17780 }
17781
17782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17783         if (!ptr_is_owned(_res)) return;
17784         void* _res_ptr = untag_ptr(_res);
17785         CHECK_ACCESS(_res_ptr);
17786         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
17787         FREE(untag_ptr(_res));
17788         CResult_RecoverableSignatureNoneZ_free(_res_conv);
17789 }
17790
17791 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
17792         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17793         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
17794         return tag_ptr(ret_conv, true);
17795 }
17796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17797         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
17798         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
17799         return ret_conv;
17800 }
17801
17802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17803         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
17804         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17805         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
17806         return tag_ptr(ret_conv, true);
17807 }
17808
17809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
17810         LDKCVec_u8Z _res_ref;
17811         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
17812         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
17813         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
17814         CVec_u8Z_free(_res_ref);
17815 }
17816
17817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17818         LDKCVec_CVec_u8ZZ _res_constr;
17819         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17820         if (_res_constr.datalen > 0)
17821                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17822         else
17823                 _res_constr.data = NULL;
17824         for (size_t i = 0; i < _res_constr.datalen; i++) {
17825                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17826                 LDKCVec_u8Z _res_conv_8_ref;
17827                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
17828                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
17829                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
17830                 _res_constr.data[i] = _res_conv_8_ref;
17831         }
17832         CVec_CVec_u8ZZ_free(_res_constr);
17833 }
17834
17835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
17836         LDKCVec_CVec_u8ZZ o_constr;
17837         o_constr.datalen = (*env)->GetArrayLength(env, o);
17838         if (o_constr.datalen > 0)
17839                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17840         else
17841                 o_constr.data = NULL;
17842         for (size_t i = 0; i < o_constr.datalen; i++) {
17843                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
17844                 LDKCVec_u8Z o_conv_8_ref;
17845                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
17846                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
17847                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
17848                 o_constr.data[i] = o_conv_8_ref;
17849         }
17850         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17851         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
17852         return tag_ptr(ret_conv, true);
17853 }
17854
17855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
17856         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17857         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
17858         return tag_ptr(ret_conv, true);
17859 }
17860
17861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17862         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
17863         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
17864         return ret_conv;
17865 }
17866
17867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17868         if (!ptr_is_owned(_res)) return;
17869         void* _res_ptr = untag_ptr(_res);
17870         CHECK_ACCESS(_res_ptr);
17871         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
17872         FREE(untag_ptr(_res));
17873         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
17874 }
17875
17876 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
17877         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17878         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
17879         return tag_ptr(ret_conv, true);
17880 }
17881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17882         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
17883         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
17884         return ret_conv;
17885 }
17886
17887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17888         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
17889         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17890         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
17891         return tag_ptr(ret_conv, true);
17892 }
17893
17894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17895         LDKInMemorySigner o_conv;
17896         o_conv.inner = untag_ptr(o);
17897         o_conv.is_owned = ptr_is_owned(o);
17898         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17899         o_conv = InMemorySigner_clone(&o_conv);
17900         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17901         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
17902         return tag_ptr(ret_conv, true);
17903 }
17904
17905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17906         LDKDecodeError e_conv;
17907         e_conv.inner = untag_ptr(e);
17908         e_conv.is_owned = ptr_is_owned(e);
17909         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17910         e_conv = DecodeError_clone(&e_conv);
17911         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17912         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
17913         return tag_ptr(ret_conv, true);
17914 }
17915
17916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17917         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
17918         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
17919         return ret_conv;
17920 }
17921
17922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17923         if (!ptr_is_owned(_res)) return;
17924         void* _res_ptr = untag_ptr(_res);
17925         CHECK_ACCESS(_res_ptr);
17926         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
17927         FREE(untag_ptr(_res));
17928         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
17929 }
17930
17931 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
17932         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17933         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
17934         return tag_ptr(ret_conv, true);
17935 }
17936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17937         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
17938         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
17939         return ret_conv;
17940 }
17941
17942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17943         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
17944         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17945         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
17946         return tag_ptr(ret_conv, true);
17947 }
17948
17949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17950         LDKCVec_TxOutZ _res_constr;
17951         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17952         if (_res_constr.datalen > 0)
17953                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17954         else
17955                 _res_constr.data = NULL;
17956         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17957         for (size_t h = 0; h < _res_constr.datalen; h++) {
17958                 int64_t _res_conv_7 = _res_vals[h];
17959                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17960                 CHECK_ACCESS(_res_conv_7_ptr);
17961                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17962                 FREE(untag_ptr(_res_conv_7));
17963                 _res_constr.data[h] = _res_conv_7_conv;
17964         }
17965         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17966         CVec_TxOutZ_free(_res_constr);
17967 }
17968
17969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17970         LDKTransaction o_ref;
17971         o_ref.datalen = (*env)->GetArrayLength(env, o);
17972         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
17973         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
17974         o_ref.data_is_owned = true;
17975         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17976         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
17977         return tag_ptr(ret_conv, true);
17978 }
17979
17980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
17981         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17982         *ret_conv = CResult_TransactionNoneZ_err();
17983         return tag_ptr(ret_conv, true);
17984 }
17985
17986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17987         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
17988         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
17989         return ret_conv;
17990 }
17991
17992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17993         if (!ptr_is_owned(_res)) return;
17994         void* _res_ptr = untag_ptr(_res);
17995         CHECK_ACCESS(_res_ptr);
17996         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17997         FREE(untag_ptr(_res));
17998         CResult_TransactionNoneZ_free(_res_conv);
17999 }
18000
18001 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18002         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18003         *ret_conv = CResult_TransactionNoneZ_clone(arg);
18004         return tag_ptr(ret_conv, true);
18005 }
18006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18007         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
18008         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18009         return ret_conv;
18010 }
18011
18012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18013         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
18014         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18015         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18016         return tag_ptr(ret_conv, true);
18017 }
18018
18019 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18020         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18021         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18022         return tag_ptr(ret_conv, true);
18023 }
18024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18025         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18026         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18027         return ret_conv;
18028 }
18029
18030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18031         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18032         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18033         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18034         return tag_ptr(ret_conv, true);
18035 }
18036
18037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18038         LDKThirtyTwoBytes a_ref;
18039         CHECK((*env)->GetArrayLength(env, a) == 32);
18040         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18041         LDKChannelMonitor b_conv;
18042         b_conv.inner = untag_ptr(b);
18043         b_conv.is_owned = ptr_is_owned(b);
18044         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18045         b_conv = ChannelMonitor_clone(&b_conv);
18046         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18047         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18048         return tag_ptr(ret_conv, true);
18049 }
18050
18051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18052         if (!ptr_is_owned(_res)) return;
18053         void* _res_ptr = untag_ptr(_res);
18054         CHECK_ACCESS(_res_ptr);
18055         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18056         FREE(untag_ptr(_res));
18057         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18058 }
18059
18060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18061         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
18062         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18063         if (_res_constr.datalen > 0)
18064                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18065         else
18066                 _res_constr.data = NULL;
18067         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18068         for (size_t j = 0; j < _res_constr.datalen; j++) {
18069                 int64_t _res_conv_35 = _res_vals[j];
18070                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
18071                 CHECK_ACCESS(_res_conv_35_ptr);
18072                 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
18073                 FREE(untag_ptr(_res_conv_35));
18074                 _res_constr.data[j] = _res_conv_35_conv;
18075         }
18076         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18077         CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
18078 }
18079
18080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
18081         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
18082         o_constr.datalen = (*env)->GetArrayLength(env, o);
18083         if (o_constr.datalen > 0)
18084                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18085         else
18086                 o_constr.data = NULL;
18087         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18088         for (size_t j = 0; j < o_constr.datalen; j++) {
18089                 int64_t o_conv_35 = o_vals[j];
18090                 void* o_conv_35_ptr = untag_ptr(o_conv_35);
18091                 CHECK_ACCESS(o_conv_35_ptr);
18092                 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
18093                 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o_conv_35));
18094                 o_constr.data[j] = o_conv_35_conv;
18095         }
18096         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18097         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18098         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
18099         return tag_ptr(ret_conv, true);
18100 }
18101
18102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18103         LDKIOError e_conv = LDKIOError_from_java(env, e);
18104         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18105         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
18106         return tag_ptr(ret_conv, true);
18107 }
18108
18109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18110         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(o);
18111         jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
18112         return ret_conv;
18113 }
18114
18115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18116         if (!ptr_is_owned(_res)) return;
18117         void* _res_ptr = untag_ptr(_res);
18118         CHECK_ACCESS(_res_ptr);
18119         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
18120         FREE(untag_ptr(_res));
18121         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
18122 }
18123
18124 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
18125         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18126         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
18127         return tag_ptr(ret_conv, true);
18128 }
18129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18130         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(arg);
18131         int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
18132         return ret_conv;
18133 }
18134
18135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18136         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(orig);
18137         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18138         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
18139         return tag_ptr(ret_conv, true);
18140 }
18141
18142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
18143         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18144         *ret_copy = COption_u16Z_some(o);
18145         int64_t ret_ref = tag_ptr(ret_copy, true);
18146         return ret_ref;
18147 }
18148
18149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
18150         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18151         *ret_copy = COption_u16Z_none();
18152         int64_t ret_ref = tag_ptr(ret_copy, true);
18153         return ret_ref;
18154 }
18155
18156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18157         if (!ptr_is_owned(_res)) return;
18158         void* _res_ptr = untag_ptr(_res);
18159         CHECK_ACCESS(_res_ptr);
18160         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18161         FREE(untag_ptr(_res));
18162         COption_u16Z_free(_res_conv);
18163 }
18164
18165 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18166         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18167         *ret_copy = COption_u16Z_clone(arg);
18168         int64_t ret_ref = tag_ptr(ret_copy, true);
18169         return ret_ref;
18170 }
18171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18172         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
18173         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18174         return ret_conv;
18175 }
18176
18177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18178         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
18179         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18180         *ret_copy = COption_u16Z_clone(orig_conv);
18181         int64_t ret_ref = tag_ptr(ret_copy, true);
18182         return ret_ref;
18183 }
18184
18185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
18186         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18187         *ret_conv = CResult_NoneAPIErrorZ_ok();
18188         return tag_ptr(ret_conv, true);
18189 }
18190
18191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18192         void* e_ptr = untag_ptr(e);
18193         CHECK_ACCESS(e_ptr);
18194         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18195         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18196         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18197         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18198         return tag_ptr(ret_conv, true);
18199 }
18200
18201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18202         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18203         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18204         return ret_conv;
18205 }
18206
18207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18208         if (!ptr_is_owned(_res)) return;
18209         void* _res_ptr = untag_ptr(_res);
18210         CHECK_ACCESS(_res_ptr);
18211         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18212         FREE(untag_ptr(_res));
18213         CResult_NoneAPIErrorZ_free(_res_conv);
18214 }
18215
18216 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18217         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18218         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18219         return tag_ptr(ret_conv, true);
18220 }
18221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18222         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18223         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18224         return ret_conv;
18225 }
18226
18227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18228         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18229         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18230         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18231         return tag_ptr(ret_conv, true);
18232 }
18233
18234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18235         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18236         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18237         if (_res_constr.datalen > 0)
18238                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18239         else
18240                 _res_constr.data = NULL;
18241         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18242         for (size_t w = 0; w < _res_constr.datalen; w++) {
18243                 int64_t _res_conv_22 = _res_vals[w];
18244                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18245                 CHECK_ACCESS(_res_conv_22_ptr);
18246                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18247                 FREE(untag_ptr(_res_conv_22));
18248                 _res_constr.data[w] = _res_conv_22_conv;
18249         }
18250         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18251         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18252 }
18253
18254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18255         LDKCVec_APIErrorZ _res_constr;
18256         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18257         if (_res_constr.datalen > 0)
18258                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18259         else
18260                 _res_constr.data = NULL;
18261         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18262         for (size_t k = 0; k < _res_constr.datalen; k++) {
18263                 int64_t _res_conv_10 = _res_vals[k];
18264                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18265                 CHECK_ACCESS(_res_conv_10_ptr);
18266                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18267                 FREE(untag_ptr(_res_conv_10));
18268                 _res_constr.data[k] = _res_conv_10_conv;
18269         }
18270         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18271         CVec_APIErrorZ_free(_res_constr);
18272 }
18273
18274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18275         LDKThirtyTwoBytes o_ref;
18276         CHECK((*env)->GetArrayLength(env, o) == 32);
18277         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18278         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18279         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
18280         return tag_ptr(ret_conv, true);
18281 }
18282
18283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18284         void* e_ptr = untag_ptr(e);
18285         CHECK_ACCESS(e_ptr);
18286         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18287         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18288         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18289         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
18290         return tag_ptr(ret_conv, true);
18291 }
18292
18293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18294         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
18295         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
18296         return ret_conv;
18297 }
18298
18299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18300         if (!ptr_is_owned(_res)) return;
18301         void* _res_ptr = untag_ptr(_res);
18302         CHECK_ACCESS(_res_ptr);
18303         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
18304         FREE(untag_ptr(_res));
18305         CResult__u832APIErrorZ_free(_res_conv);
18306 }
18307
18308 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
18309         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18310         *ret_conv = CResult__u832APIErrorZ_clone(arg);
18311         return tag_ptr(ret_conv, true);
18312 }
18313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18314         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
18315         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
18316         return ret_conv;
18317 }
18318
18319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18320         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
18321         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18322         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
18323         return tag_ptr(ret_conv, true);
18324 }
18325
18326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18327         LDKThirtyTwoBytes o_ref;
18328         CHECK((*env)->GetArrayLength(env, o) == 32);
18329         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18330         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18331         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
18332         return tag_ptr(ret_conv, true);
18333 }
18334
18335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18336         void* e_ptr = untag_ptr(e);
18337         CHECK_ACCESS(e_ptr);
18338         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18339         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18340         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18341         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
18342         return tag_ptr(ret_conv, true);
18343 }
18344
18345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18346         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
18347         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
18348         return ret_conv;
18349 }
18350
18351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18352         if (!ptr_is_owned(_res)) return;
18353         void* _res_ptr = untag_ptr(_res);
18354         CHECK_ACCESS(_res_ptr);
18355         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
18356         FREE(untag_ptr(_res));
18357         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
18358 }
18359
18360 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
18361         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18362         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
18363         return tag_ptr(ret_conv, true);
18364 }
18365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18366         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
18367         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
18368         return ret_conv;
18369 }
18370
18371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18372         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
18373         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18374         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
18375         return tag_ptr(ret_conv, true);
18376 }
18377
18378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
18379         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18380         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
18381         return tag_ptr(ret_conv, true);
18382 }
18383
18384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18385         void* e_ptr = untag_ptr(e);
18386         CHECK_ACCESS(e_ptr);
18387         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18388         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18389         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18390         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
18391         return tag_ptr(ret_conv, true);
18392 }
18393
18394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18395         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
18396         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
18397         return ret_conv;
18398 }
18399
18400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18401         if (!ptr_is_owned(_res)) return;
18402         void* _res_ptr = untag_ptr(_res);
18403         CHECK_ACCESS(_res_ptr);
18404         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
18405         FREE(untag_ptr(_res));
18406         CResult_NonePaymentSendFailureZ_free(_res_conv);
18407 }
18408
18409 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
18410         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18411         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
18412         return tag_ptr(ret_conv, true);
18413 }
18414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18415         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
18416         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
18417         return ret_conv;
18418 }
18419
18420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18421         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
18422         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18423         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
18424         return tag_ptr(ret_conv, true);
18425 }
18426
18427 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
18428         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18429         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
18430         return tag_ptr(ret_conv, true);
18431 }
18432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18433         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
18434         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
18435         return ret_conv;
18436 }
18437
18438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18439         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
18440         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18441         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
18442         return tag_ptr(ret_conv, true);
18443 }
18444
18445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18446         LDKThirtyTwoBytes a_ref;
18447         CHECK((*env)->GetArrayLength(env, a) == 32);
18448         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18449         LDKThirtyTwoBytes b_ref;
18450         CHECK((*env)->GetArrayLength(env, b) == 32);
18451         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18452         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18453         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
18454         return tag_ptr(ret_conv, true);
18455 }
18456
18457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18458         if (!ptr_is_owned(_res)) return;
18459         void* _res_ptr = untag_ptr(_res);
18460         CHECK_ACCESS(_res_ptr);
18461         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
18462         FREE(untag_ptr(_res));
18463         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
18464 }
18465
18466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18467         void* o_ptr = untag_ptr(o);
18468         CHECK_ACCESS(o_ptr);
18469         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
18470         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
18471         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18472         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
18473         return tag_ptr(ret_conv, true);
18474 }
18475
18476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18477         void* e_ptr = untag_ptr(e);
18478         CHECK_ACCESS(e_ptr);
18479         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18480         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18481         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18482         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
18483         return tag_ptr(ret_conv, true);
18484 }
18485
18486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18487         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
18488         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
18489         return ret_conv;
18490 }
18491
18492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18493         if (!ptr_is_owned(_res)) return;
18494         void* _res_ptr = untag_ptr(_res);
18495         CHECK_ACCESS(_res_ptr);
18496         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
18497         FREE(untag_ptr(_res));
18498         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
18499 }
18500
18501 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
18502         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18503         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
18504         return tag_ptr(ret_conv, true);
18505 }
18506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18507         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
18508         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
18509         return ret_conv;
18510 }
18511
18512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18513         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
18514         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18515         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
18516         return tag_ptr(ret_conv, true);
18517 }
18518
18519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18520         LDKCVec_ThirtyTwoBytesZ _res_constr;
18521         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18522         if (_res_constr.datalen > 0)
18523                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
18524         else
18525                 _res_constr.data = NULL;
18526         for (size_t i = 0; i < _res_constr.datalen; i++) {
18527                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18528                 LDKThirtyTwoBytes _res_conv_8_ref;
18529                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
18530                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
18531                 _res_constr.data[i] = _res_conv_8_ref;
18532         }
18533         CVec_ThirtyTwoBytesZ_free(_res_constr);
18534 }
18535
18536 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
18537         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18538         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
18539         return tag_ptr(ret_conv, true);
18540 }
18541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18542         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
18543         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
18544         return ret_conv;
18545 }
18546
18547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18548         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
18549         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18550         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
18551         return tag_ptr(ret_conv, true);
18552 }
18553
18554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18555         LDKThirtyTwoBytes a_ref;
18556         CHECK((*env)->GetArrayLength(env, a) == 32);
18557         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18558         LDKThirtyTwoBytes b_ref;
18559         CHECK((*env)->GetArrayLength(env, b) == 32);
18560         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18561         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18562         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
18563         return tag_ptr(ret_conv, true);
18564 }
18565
18566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18567         if (!ptr_is_owned(_res)) return;
18568         void* _res_ptr = untag_ptr(_res);
18569         CHECK_ACCESS(_res_ptr);
18570         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
18571         FREE(untag_ptr(_res));
18572         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
18573 }
18574
18575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18576         void* o_ptr = untag_ptr(o);
18577         CHECK_ACCESS(o_ptr);
18578         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18579         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
18580         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18581         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
18582         return tag_ptr(ret_conv, true);
18583 }
18584
18585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
18586         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18587         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
18588         return tag_ptr(ret_conv, true);
18589 }
18590
18591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18592         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
18593         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
18594         return ret_conv;
18595 }
18596
18597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18598         if (!ptr_is_owned(_res)) return;
18599         void* _res_ptr = untag_ptr(_res);
18600         CHECK_ACCESS(_res_ptr);
18601         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
18602         FREE(untag_ptr(_res));
18603         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
18604 }
18605
18606 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
18607         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18608         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
18609         return tag_ptr(ret_conv, true);
18610 }
18611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18612         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
18613         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
18614         return ret_conv;
18615 }
18616
18617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18618         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
18619         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18620         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
18621         return tag_ptr(ret_conv, true);
18622 }
18623
18624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18625         void* o_ptr = untag_ptr(o);
18626         CHECK_ACCESS(o_ptr);
18627         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18628         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
18629         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18630         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
18631         return tag_ptr(ret_conv, true);
18632 }
18633
18634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18635         void* e_ptr = untag_ptr(e);
18636         CHECK_ACCESS(e_ptr);
18637         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18638         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18639         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18640         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
18641         return tag_ptr(ret_conv, true);
18642 }
18643
18644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18645         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
18646         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
18647         return ret_conv;
18648 }
18649
18650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18651         if (!ptr_is_owned(_res)) return;
18652         void* _res_ptr = untag_ptr(_res);
18653         CHECK_ACCESS(_res_ptr);
18654         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
18655         FREE(untag_ptr(_res));
18656         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
18657 }
18658
18659 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
18660         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18661         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
18662         return tag_ptr(ret_conv, true);
18663 }
18664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18665         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
18666         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
18667         return ret_conv;
18668 }
18669
18670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18671         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
18672         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18673         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
18674         return tag_ptr(ret_conv, true);
18675 }
18676
18677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18678         LDKThirtyTwoBytes o_ref;
18679         CHECK((*env)->GetArrayLength(env, o) == 32);
18680         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18681         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18682         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
18683         return tag_ptr(ret_conv, true);
18684 }
18685
18686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
18687         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18688         *ret_conv = CResult_PaymentSecretNoneZ_err();
18689         return tag_ptr(ret_conv, true);
18690 }
18691
18692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18693         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
18694         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
18695         return ret_conv;
18696 }
18697
18698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18699         if (!ptr_is_owned(_res)) return;
18700         void* _res_ptr = untag_ptr(_res);
18701         CHECK_ACCESS(_res_ptr);
18702         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
18703         FREE(untag_ptr(_res));
18704         CResult_PaymentSecretNoneZ_free(_res_conv);
18705 }
18706
18707 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
18708         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18709         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
18710         return tag_ptr(ret_conv, true);
18711 }
18712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18713         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
18714         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
18715         return ret_conv;
18716 }
18717
18718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18719         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
18720         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18721         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
18722         return tag_ptr(ret_conv, true);
18723 }
18724
18725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18726         LDKThirtyTwoBytes o_ref;
18727         CHECK((*env)->GetArrayLength(env, o) == 32);
18728         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18729         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18730         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
18731         return tag_ptr(ret_conv, true);
18732 }
18733
18734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18735         void* e_ptr = untag_ptr(e);
18736         CHECK_ACCESS(e_ptr);
18737         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18738         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18739         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18740         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
18741         return tag_ptr(ret_conv, true);
18742 }
18743
18744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18745         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
18746         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
18747         return ret_conv;
18748 }
18749
18750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18751         if (!ptr_is_owned(_res)) return;
18752         void* _res_ptr = untag_ptr(_res);
18753         CHECK_ACCESS(_res_ptr);
18754         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
18755         FREE(untag_ptr(_res));
18756         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
18757 }
18758
18759 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
18760         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18761         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
18762         return tag_ptr(ret_conv, true);
18763 }
18764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18765         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
18766         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
18767         return ret_conv;
18768 }
18769
18770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18771         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
18772         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18773         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
18774         return tag_ptr(ret_conv, true);
18775 }
18776
18777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18778         LDKThirtyTwoBytes o_ref;
18779         CHECK((*env)->GetArrayLength(env, o) == 32);
18780         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18781         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18782         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
18783         return tag_ptr(ret_conv, true);
18784 }
18785
18786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18787         void* e_ptr = untag_ptr(e);
18788         CHECK_ACCESS(e_ptr);
18789         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18790         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18791         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18792         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
18793         return tag_ptr(ret_conv, true);
18794 }
18795
18796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18797         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
18798         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
18799         return ret_conv;
18800 }
18801
18802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18803         if (!ptr_is_owned(_res)) return;
18804         void* _res_ptr = untag_ptr(_res);
18805         CHECK_ACCESS(_res_ptr);
18806         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
18807         FREE(untag_ptr(_res));
18808         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
18809 }
18810
18811 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
18812         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18813         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
18814         return tag_ptr(ret_conv, true);
18815 }
18816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18817         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
18818         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
18819         return ret_conv;
18820 }
18821
18822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18823         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
18824         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18825         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
18826         return tag_ptr(ret_conv, true);
18827 }
18828
18829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18830         LDKCounterpartyForwardingInfo o_conv;
18831         o_conv.inner = untag_ptr(o);
18832         o_conv.is_owned = ptr_is_owned(o);
18833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18834         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
18835         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18836         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
18837         return tag_ptr(ret_conv, true);
18838 }
18839
18840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18841         LDKDecodeError e_conv;
18842         e_conv.inner = untag_ptr(e);
18843         e_conv.is_owned = ptr_is_owned(e);
18844         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18845         e_conv = DecodeError_clone(&e_conv);
18846         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18847         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
18848         return tag_ptr(ret_conv, true);
18849 }
18850
18851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18852         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
18853         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
18854         return ret_conv;
18855 }
18856
18857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18858         if (!ptr_is_owned(_res)) return;
18859         void* _res_ptr = untag_ptr(_res);
18860         CHECK_ACCESS(_res_ptr);
18861         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
18862         FREE(untag_ptr(_res));
18863         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
18864 }
18865
18866 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
18867         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18868         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
18869         return tag_ptr(ret_conv, true);
18870 }
18871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18872         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
18873         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
18874         return ret_conv;
18875 }
18876
18877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18878         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
18879         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18880         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
18881         return tag_ptr(ret_conv, true);
18882 }
18883
18884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18885         LDKChannelCounterparty o_conv;
18886         o_conv.inner = untag_ptr(o);
18887         o_conv.is_owned = ptr_is_owned(o);
18888         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18889         o_conv = ChannelCounterparty_clone(&o_conv);
18890         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18891         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
18892         return tag_ptr(ret_conv, true);
18893 }
18894
18895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18896         LDKDecodeError e_conv;
18897         e_conv.inner = untag_ptr(e);
18898         e_conv.is_owned = ptr_is_owned(e);
18899         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18900         e_conv = DecodeError_clone(&e_conv);
18901         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18902         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
18903         return tag_ptr(ret_conv, true);
18904 }
18905
18906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18907         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
18908         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
18909         return ret_conv;
18910 }
18911
18912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18913         if (!ptr_is_owned(_res)) return;
18914         void* _res_ptr = untag_ptr(_res);
18915         CHECK_ACCESS(_res_ptr);
18916         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
18917         FREE(untag_ptr(_res));
18918         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
18919 }
18920
18921 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
18922         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18923         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
18924         return tag_ptr(ret_conv, true);
18925 }
18926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18927         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
18928         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
18929         return ret_conv;
18930 }
18931
18932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18933         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
18934         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18935         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
18936         return tag_ptr(ret_conv, true);
18937 }
18938
18939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18940         LDKChannelDetails o_conv;
18941         o_conv.inner = untag_ptr(o);
18942         o_conv.is_owned = ptr_is_owned(o);
18943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18944         o_conv = ChannelDetails_clone(&o_conv);
18945         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18946         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
18947         return tag_ptr(ret_conv, true);
18948 }
18949
18950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18951         LDKDecodeError e_conv;
18952         e_conv.inner = untag_ptr(e);
18953         e_conv.is_owned = ptr_is_owned(e);
18954         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18955         e_conv = DecodeError_clone(&e_conv);
18956         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18957         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
18958         return tag_ptr(ret_conv, true);
18959 }
18960
18961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18962         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
18963         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
18964         return ret_conv;
18965 }
18966
18967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18968         if (!ptr_is_owned(_res)) return;
18969         void* _res_ptr = untag_ptr(_res);
18970         CHECK_ACCESS(_res_ptr);
18971         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
18972         FREE(untag_ptr(_res));
18973         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
18974 }
18975
18976 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
18977         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18978         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
18979         return tag_ptr(ret_conv, true);
18980 }
18981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18982         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
18983         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
18984         return ret_conv;
18985 }
18986
18987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18988         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
18989         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18990         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
18991         return tag_ptr(ret_conv, true);
18992 }
18993
18994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18995         LDKPhantomRouteHints o_conv;
18996         o_conv.inner = untag_ptr(o);
18997         o_conv.is_owned = ptr_is_owned(o);
18998         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18999         o_conv = PhantomRouteHints_clone(&o_conv);
19000         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19001         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
19002         return tag_ptr(ret_conv, true);
19003 }
19004
19005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19006         LDKDecodeError e_conv;
19007         e_conv.inner = untag_ptr(e);
19008         e_conv.is_owned = ptr_is_owned(e);
19009         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19010         e_conv = DecodeError_clone(&e_conv);
19011         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19012         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
19013         return tag_ptr(ret_conv, true);
19014 }
19015
19016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19017         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
19018         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
19019         return ret_conv;
19020 }
19021
19022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19023         if (!ptr_is_owned(_res)) return;
19024         void* _res_ptr = untag_ptr(_res);
19025         CHECK_ACCESS(_res_ptr);
19026         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
19027         FREE(untag_ptr(_res));
19028         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
19029 }
19030
19031 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
19032         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19033         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
19034         return tag_ptr(ret_conv, true);
19035 }
19036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19037         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
19038         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
19039         return ret_conv;
19040 }
19041
19042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19043         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
19044         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19045         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
19046         return tag_ptr(ret_conv, true);
19047 }
19048
19049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19050         LDKCVec_ChannelMonitorZ _res_constr;
19051         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19052         if (_res_constr.datalen > 0)
19053                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19054         else
19055                 _res_constr.data = NULL;
19056         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19057         for (size_t q = 0; q < _res_constr.datalen; q++) {
19058                 int64_t _res_conv_16 = _res_vals[q];
19059                 LDKChannelMonitor _res_conv_16_conv;
19060                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19061                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19062                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19063                 _res_constr.data[q] = _res_conv_16_conv;
19064         }
19065         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19066         CVec_ChannelMonitorZ_free(_res_constr);
19067 }
19068
19069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19070         LDKThirtyTwoBytes a_ref;
19071         CHECK((*env)->GetArrayLength(env, a) == 32);
19072         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19073         LDKChannelManager b_conv;
19074         b_conv.inner = untag_ptr(b);
19075         b_conv.is_owned = ptr_is_owned(b);
19076         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19077         // WARNING: we need a move here but no clone is available for LDKChannelManager
19078         
19079         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
19080         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
19081         return tag_ptr(ret_conv, true);
19082 }
19083
19084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19085         if (!ptr_is_owned(_res)) return;
19086         void* _res_ptr = untag_ptr(_res);
19087         CHECK_ACCESS(_res_ptr);
19088         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
19089         FREE(untag_ptr(_res));
19090         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
19091 }
19092
19093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19094         void* o_ptr = untag_ptr(o);
19095         CHECK_ACCESS(o_ptr);
19096         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
19097         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
19098         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19099         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
19100         return tag_ptr(ret_conv, true);
19101 }
19102
19103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19104         LDKDecodeError e_conv;
19105         e_conv.inner = untag_ptr(e);
19106         e_conv.is_owned = ptr_is_owned(e);
19107         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19108         e_conv = DecodeError_clone(&e_conv);
19109         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19110         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
19111         return tag_ptr(ret_conv, true);
19112 }
19113
19114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19115         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
19116         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
19117         return ret_conv;
19118 }
19119
19120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19121         if (!ptr_is_owned(_res)) return;
19122         void* _res_ptr = untag_ptr(_res);
19123         CHECK_ACCESS(_res_ptr);
19124         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
19125         FREE(untag_ptr(_res));
19126         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
19127 }
19128
19129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19130         LDKChannelConfig o_conv;
19131         o_conv.inner = untag_ptr(o);
19132         o_conv.is_owned = ptr_is_owned(o);
19133         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19134         o_conv = ChannelConfig_clone(&o_conv);
19135         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19136         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
19137         return tag_ptr(ret_conv, true);
19138 }
19139
19140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19141         LDKDecodeError e_conv;
19142         e_conv.inner = untag_ptr(e);
19143         e_conv.is_owned = ptr_is_owned(e);
19144         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19145         e_conv = DecodeError_clone(&e_conv);
19146         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19147         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
19148         return tag_ptr(ret_conv, true);
19149 }
19150
19151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19152         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
19153         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
19154         return ret_conv;
19155 }
19156
19157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19158         if (!ptr_is_owned(_res)) return;
19159         void* _res_ptr = untag_ptr(_res);
19160         CHECK_ACCESS(_res_ptr);
19161         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
19162         FREE(untag_ptr(_res));
19163         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
19164 }
19165
19166 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
19167         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19168         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
19169         return tag_ptr(ret_conv, true);
19170 }
19171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19172         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
19173         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
19174         return ret_conv;
19175 }
19176
19177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19178         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
19179         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19180         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
19181         return tag_ptr(ret_conv, true);
19182 }
19183
19184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19185         LDKOutPoint o_conv;
19186         o_conv.inner = untag_ptr(o);
19187         o_conv.is_owned = ptr_is_owned(o);
19188         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19189         o_conv = OutPoint_clone(&o_conv);
19190         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19191         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
19192         return tag_ptr(ret_conv, true);
19193 }
19194
19195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19196         LDKDecodeError e_conv;
19197         e_conv.inner = untag_ptr(e);
19198         e_conv.is_owned = ptr_is_owned(e);
19199         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19200         e_conv = DecodeError_clone(&e_conv);
19201         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19202         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
19203         return tag_ptr(ret_conv, true);
19204 }
19205
19206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19207         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
19208         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
19209         return ret_conv;
19210 }
19211
19212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19213         if (!ptr_is_owned(_res)) return;
19214         void* _res_ptr = untag_ptr(_res);
19215         CHECK_ACCESS(_res_ptr);
19216         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
19217         FREE(untag_ptr(_res));
19218         CResult_OutPointDecodeErrorZ_free(_res_conv);
19219 }
19220
19221 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
19222         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19223         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
19224         return tag_ptr(ret_conv, true);
19225 }
19226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19227         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
19228         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
19229         return ret_conv;
19230 }
19231
19232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19233         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
19234         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19235         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
19236         return tag_ptr(ret_conv, true);
19237 }
19238
19239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19240         void* o_ptr = untag_ptr(o);
19241         CHECK_ACCESS(o_ptr);
19242         LDKType o_conv = *(LDKType*)(o_ptr);
19243         if (o_conv.free == LDKType_JCalls_free) {
19244                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19245                 LDKType_JCalls_cloned(&o_conv);
19246         }
19247         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19248         *ret_copy = COption_TypeZ_some(o_conv);
19249         int64_t ret_ref = tag_ptr(ret_copy, true);
19250         return ret_ref;
19251 }
19252
19253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
19254         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19255         *ret_copy = COption_TypeZ_none();
19256         int64_t ret_ref = tag_ptr(ret_copy, true);
19257         return ret_ref;
19258 }
19259
19260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19261         if (!ptr_is_owned(_res)) return;
19262         void* _res_ptr = untag_ptr(_res);
19263         CHECK_ACCESS(_res_ptr);
19264         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
19265         FREE(untag_ptr(_res));
19266         COption_TypeZ_free(_res_conv);
19267 }
19268
19269 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
19270         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19271         *ret_copy = COption_TypeZ_clone(arg);
19272         int64_t ret_ref = tag_ptr(ret_copy, true);
19273         return ret_ref;
19274 }
19275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19276         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
19277         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
19278         return ret_conv;
19279 }
19280
19281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19282         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
19283         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19284         *ret_copy = COption_TypeZ_clone(orig_conv);
19285         int64_t ret_ref = tag_ptr(ret_copy, true);
19286         return ret_ref;
19287 }
19288
19289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19290         void* o_ptr = untag_ptr(o);
19291         CHECK_ACCESS(o_ptr);
19292         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
19293         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
19294         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19295         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
19296         return tag_ptr(ret_conv, true);
19297 }
19298
19299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19300         LDKDecodeError e_conv;
19301         e_conv.inner = untag_ptr(e);
19302         e_conv.is_owned = ptr_is_owned(e);
19303         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19304         e_conv = DecodeError_clone(&e_conv);
19305         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19306         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
19307         return tag_ptr(ret_conv, true);
19308 }
19309
19310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19311         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
19312         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
19313         return ret_conv;
19314 }
19315
19316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19317         if (!ptr_is_owned(_res)) return;
19318         void* _res_ptr = untag_ptr(_res);
19319         CHECK_ACCESS(_res_ptr);
19320         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
19321         FREE(untag_ptr(_res));
19322         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
19323 }
19324
19325 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
19326         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19327         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
19328         return tag_ptr(ret_conv, true);
19329 }
19330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19331         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
19332         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
19333         return ret_conv;
19334 }
19335
19336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19337         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
19338         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19339         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
19340         return tag_ptr(ret_conv, true);
19341 }
19342
19343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19344         LDKThirtyTwoBytes o_ref;
19345         CHECK((*env)->GetArrayLength(env, o) == 32);
19346         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19347         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19348         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
19349         return tag_ptr(ret_conv, true);
19350 }
19351
19352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19353         void* e_ptr = untag_ptr(e);
19354         CHECK_ACCESS(e_ptr);
19355         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
19356         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
19357         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19358         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
19359         return tag_ptr(ret_conv, true);
19360 }
19361
19362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19363         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
19364         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
19365         return ret_conv;
19366 }
19367
19368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19369         if (!ptr_is_owned(_res)) return;
19370         void* _res_ptr = untag_ptr(_res);
19371         CHECK_ACCESS(_res_ptr);
19372         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
19373         FREE(untag_ptr(_res));
19374         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
19375 }
19376
19377 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
19378         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19379         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
19380         return tag_ptr(ret_conv, true);
19381 }
19382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19383         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
19384         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
19385         return ret_conv;
19386 }
19387
19388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19389         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
19390         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19391         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
19392         return tag_ptr(ret_conv, true);
19393 }
19394
19395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
19396         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
19397         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19398         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
19399         return tag_ptr(ret_conv, true);
19400 }
19401
19402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19403         void* e_ptr = untag_ptr(e);
19404         CHECK_ACCESS(e_ptr);
19405         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19406         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19407         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19408         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
19409         return tag_ptr(ret_conv, true);
19410 }
19411
19412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19413         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
19414         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
19415         return ret_conv;
19416 }
19417
19418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19419         if (!ptr_is_owned(_res)) return;
19420         void* _res_ptr = untag_ptr(_res);
19421         CHECK_ACCESS(_res_ptr);
19422         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
19423         FREE(untag_ptr(_res));
19424         CResult_SiPrefixParseErrorZ_free(_res_conv);
19425 }
19426
19427 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
19428         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19429         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
19430         return tag_ptr(ret_conv, true);
19431 }
19432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19433         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
19434         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
19435         return ret_conv;
19436 }
19437
19438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19439         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
19440         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19441         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
19442         return tag_ptr(ret_conv, true);
19443 }
19444
19445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19446         LDKInvoice o_conv;
19447         o_conv.inner = untag_ptr(o);
19448         o_conv.is_owned = ptr_is_owned(o);
19449         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19450         o_conv = Invoice_clone(&o_conv);
19451         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19452         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
19453         return tag_ptr(ret_conv, true);
19454 }
19455
19456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19457         void* e_ptr = untag_ptr(e);
19458         CHECK_ACCESS(e_ptr);
19459         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
19460         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
19461         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19462         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
19463         return tag_ptr(ret_conv, true);
19464 }
19465
19466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19467         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
19468         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
19469         return ret_conv;
19470 }
19471
19472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19473         if (!ptr_is_owned(_res)) return;
19474         void* _res_ptr = untag_ptr(_res);
19475         CHECK_ACCESS(_res_ptr);
19476         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
19477         FREE(untag_ptr(_res));
19478         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
19479 }
19480
19481 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
19482         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19483         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
19484         return tag_ptr(ret_conv, true);
19485 }
19486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19487         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
19488         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
19489         return ret_conv;
19490 }
19491
19492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19493         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
19494         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19495         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
19496         return tag_ptr(ret_conv, true);
19497 }
19498
19499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19500         LDKSignedRawInvoice o_conv;
19501         o_conv.inner = untag_ptr(o);
19502         o_conv.is_owned = ptr_is_owned(o);
19503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19504         o_conv = SignedRawInvoice_clone(&o_conv);
19505         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19506         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
19507         return tag_ptr(ret_conv, true);
19508 }
19509
19510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19511         void* e_ptr = untag_ptr(e);
19512         CHECK_ACCESS(e_ptr);
19513         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19514         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19515         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19516         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
19517         return tag_ptr(ret_conv, true);
19518 }
19519
19520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19521         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
19522         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
19523         return ret_conv;
19524 }
19525
19526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19527         if (!ptr_is_owned(_res)) return;
19528         void* _res_ptr = untag_ptr(_res);
19529         CHECK_ACCESS(_res_ptr);
19530         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
19531         FREE(untag_ptr(_res));
19532         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
19533 }
19534
19535 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
19536         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19537         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
19538         return tag_ptr(ret_conv, true);
19539 }
19540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19541         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
19542         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
19543         return ret_conv;
19544 }
19545
19546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19547         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
19548         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19549         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
19550         return tag_ptr(ret_conv, true);
19551 }
19552
19553 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
19554         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19555         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
19556         return tag_ptr(ret_conv, true);
19557 }
19558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19559         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
19560         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
19561         return ret_conv;
19562 }
19563
19564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19565         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
19566         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19567         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
19568         return tag_ptr(ret_conv, true);
19569 }
19570
19571 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) {
19572         LDKRawInvoice a_conv;
19573         a_conv.inner = untag_ptr(a);
19574         a_conv.is_owned = ptr_is_owned(a);
19575         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19576         a_conv = RawInvoice_clone(&a_conv);
19577         LDKThirtyTwoBytes b_ref;
19578         CHECK((*env)->GetArrayLength(env, b) == 32);
19579         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19580         LDKInvoiceSignature c_conv;
19581         c_conv.inner = untag_ptr(c);
19582         c_conv.is_owned = ptr_is_owned(c);
19583         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19584         c_conv = InvoiceSignature_clone(&c_conv);
19585         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19586         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19587         return tag_ptr(ret_conv, true);
19588 }
19589
19590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19591         if (!ptr_is_owned(_res)) return;
19592         void* _res_ptr = untag_ptr(_res);
19593         CHECK_ACCESS(_res_ptr);
19594         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19595         FREE(untag_ptr(_res));
19596         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19597 }
19598
19599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19600         LDKPayeePubKey o_conv;
19601         o_conv.inner = untag_ptr(o);
19602         o_conv.is_owned = ptr_is_owned(o);
19603         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19604         o_conv = PayeePubKey_clone(&o_conv);
19605         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19606         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19607         return tag_ptr(ret_conv, true);
19608 }
19609
19610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19611         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
19612         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19613         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19614         return tag_ptr(ret_conv, true);
19615 }
19616
19617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19618         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
19619         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19620         return ret_conv;
19621 }
19622
19623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19624         if (!ptr_is_owned(_res)) return;
19625         void* _res_ptr = untag_ptr(_res);
19626         CHECK_ACCESS(_res_ptr);
19627         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19628         FREE(untag_ptr(_res));
19629         CResult_PayeePubKeyErrorZ_free(_res_conv);
19630 }
19631
19632 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19633         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19634         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19635         return tag_ptr(ret_conv, true);
19636 }
19637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19638         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
19639         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19640         return ret_conv;
19641 }
19642
19643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19644         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
19645         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19646         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19647         return tag_ptr(ret_conv, true);
19648 }
19649
19650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19651         LDKCVec_PrivateRouteZ _res_constr;
19652         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19653         if (_res_constr.datalen > 0)
19654                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19655         else
19656                 _res_constr.data = NULL;
19657         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19658         for (size_t o = 0; o < _res_constr.datalen; o++) {
19659                 int64_t _res_conv_14 = _res_vals[o];
19660                 LDKPrivateRoute _res_conv_14_conv;
19661                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19662                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19663                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19664                 _res_constr.data[o] = _res_conv_14_conv;
19665         }
19666         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19667         CVec_PrivateRouteZ_free(_res_constr);
19668 }
19669
19670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19671         LDKPositiveTimestamp o_conv;
19672         o_conv.inner = untag_ptr(o);
19673         o_conv.is_owned = ptr_is_owned(o);
19674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19675         o_conv = PositiveTimestamp_clone(&o_conv);
19676         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19677         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19678         return tag_ptr(ret_conv, true);
19679 }
19680
19681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19682         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19683         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19684         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19685         return tag_ptr(ret_conv, true);
19686 }
19687
19688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19689         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
19690         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19691         return ret_conv;
19692 }
19693
19694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19695         if (!ptr_is_owned(_res)) return;
19696         void* _res_ptr = untag_ptr(_res);
19697         CHECK_ACCESS(_res_ptr);
19698         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19699         FREE(untag_ptr(_res));
19700         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19701 }
19702
19703 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19704         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19705         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19706         return tag_ptr(ret_conv, true);
19707 }
19708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19709         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
19710         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19711         return ret_conv;
19712 }
19713
19714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19715         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
19716         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19717         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19718         return tag_ptr(ret_conv, true);
19719 }
19720
19721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
19722         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19723         *ret_conv = CResult_NoneSemanticErrorZ_ok();
19724         return tag_ptr(ret_conv, true);
19725 }
19726
19727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19728         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19729         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19730         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19731         return tag_ptr(ret_conv, true);
19732 }
19733
19734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19735         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
19736         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19737         return ret_conv;
19738 }
19739
19740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19741         if (!ptr_is_owned(_res)) return;
19742         void* _res_ptr = untag_ptr(_res);
19743         CHECK_ACCESS(_res_ptr);
19744         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19745         FREE(untag_ptr(_res));
19746         CResult_NoneSemanticErrorZ_free(_res_conv);
19747 }
19748
19749 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19750         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19751         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19752         return tag_ptr(ret_conv, true);
19753 }
19754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19755         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
19756         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19757         return ret_conv;
19758 }
19759
19760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19761         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
19762         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19763         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19764         return tag_ptr(ret_conv, true);
19765 }
19766
19767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19768         LDKInvoice o_conv;
19769         o_conv.inner = untag_ptr(o);
19770         o_conv.is_owned = ptr_is_owned(o);
19771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19772         o_conv = Invoice_clone(&o_conv);
19773         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19774         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19775         return tag_ptr(ret_conv, true);
19776 }
19777
19778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19779         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19780         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19781         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19782         return tag_ptr(ret_conv, true);
19783 }
19784
19785 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19786         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
19787         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19788         return ret_conv;
19789 }
19790
19791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19792         if (!ptr_is_owned(_res)) return;
19793         void* _res_ptr = untag_ptr(_res);
19794         CHECK_ACCESS(_res_ptr);
19795         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19796         FREE(untag_ptr(_res));
19797         CResult_InvoiceSemanticErrorZ_free(_res_conv);
19798 }
19799
19800 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
19801         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19802         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
19803         return tag_ptr(ret_conv, true);
19804 }
19805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19806         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
19807         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
19808         return ret_conv;
19809 }
19810
19811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19812         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
19813         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19814         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
19815         return tag_ptr(ret_conv, true);
19816 }
19817
19818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19819         LDKDescription o_conv;
19820         o_conv.inner = untag_ptr(o);
19821         o_conv.is_owned = ptr_is_owned(o);
19822         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19823         o_conv = Description_clone(&o_conv);
19824         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19825         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
19826         return tag_ptr(ret_conv, true);
19827 }
19828
19829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19830         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19831         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19832         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
19833         return tag_ptr(ret_conv, true);
19834 }
19835
19836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19837         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
19838         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
19839         return ret_conv;
19840 }
19841
19842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19843         if (!ptr_is_owned(_res)) return;
19844         void* _res_ptr = untag_ptr(_res);
19845         CHECK_ACCESS(_res_ptr);
19846         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
19847         FREE(untag_ptr(_res));
19848         CResult_DescriptionCreationErrorZ_free(_res_conv);
19849 }
19850
19851 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
19852         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19853         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
19854         return tag_ptr(ret_conv, true);
19855 }
19856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19857         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
19858         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
19859         return ret_conv;
19860 }
19861
19862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19863         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
19864         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19865         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
19866         return tag_ptr(ret_conv, true);
19867 }
19868
19869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19870         LDKPrivateRoute o_conv;
19871         o_conv.inner = untag_ptr(o);
19872         o_conv.is_owned = ptr_is_owned(o);
19873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19874         o_conv = PrivateRoute_clone(&o_conv);
19875         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19876         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
19877         return tag_ptr(ret_conv, true);
19878 }
19879
19880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19881         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19882         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19883         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
19884         return tag_ptr(ret_conv, true);
19885 }
19886
19887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19888         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
19889         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
19890         return ret_conv;
19891 }
19892
19893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19894         if (!ptr_is_owned(_res)) return;
19895         void* _res_ptr = untag_ptr(_res);
19896         CHECK_ACCESS(_res_ptr);
19897         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
19898         FREE(untag_ptr(_res));
19899         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
19900 }
19901
19902 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
19903         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19904         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
19905         return tag_ptr(ret_conv, true);
19906 }
19907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19908         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
19909         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
19910         return ret_conv;
19911 }
19912
19913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19914         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
19915         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19916         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
19917         return tag_ptr(ret_conv, true);
19918 }
19919
19920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
19921         LDKStr o_conv = java_to_owned_str(env, o);
19922         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19923         *ret_conv = CResult_StringErrorZ_ok(o_conv);
19924         return tag_ptr(ret_conv, true);
19925 }
19926
19927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19928         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
19929         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19930         *ret_conv = CResult_StringErrorZ_err(e_conv);
19931         return tag_ptr(ret_conv, true);
19932 }
19933
19934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19935         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
19936         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
19937         return ret_conv;
19938 }
19939
19940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19941         if (!ptr_is_owned(_res)) return;
19942         void* _res_ptr = untag_ptr(_res);
19943         CHECK_ACCESS(_res_ptr);
19944         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
19945         FREE(untag_ptr(_res));
19946         CResult_StringErrorZ_free(_res_conv);
19947 }
19948
19949 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
19950         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19951         *ret_conv = CResult_StringErrorZ_clone(arg);
19952         return tag_ptr(ret_conv, true);
19953 }
19954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19955         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
19956         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
19957         return ret_conv;
19958 }
19959
19960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19961         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
19962         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19963         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
19964         return tag_ptr(ret_conv, true);
19965 }
19966
19967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19968         LDKChannelMonitorUpdate o_conv;
19969         o_conv.inner = untag_ptr(o);
19970         o_conv.is_owned = ptr_is_owned(o);
19971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19972         o_conv = ChannelMonitorUpdate_clone(&o_conv);
19973         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19974         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
19975         return tag_ptr(ret_conv, true);
19976 }
19977
19978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19979         LDKDecodeError e_conv;
19980         e_conv.inner = untag_ptr(e);
19981         e_conv.is_owned = ptr_is_owned(e);
19982         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19983         e_conv = DecodeError_clone(&e_conv);
19984         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19985         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
19986         return tag_ptr(ret_conv, true);
19987 }
19988
19989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19990         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
19991         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
19992         return ret_conv;
19993 }
19994
19995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_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_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
20000         FREE(untag_ptr(_res));
20001         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
20002 }
20003
20004 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
20005         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20006         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
20007         return tag_ptr(ret_conv, true);
20008 }
20009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20010         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
20011         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
20012         return ret_conv;
20013 }
20014
20015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20016         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
20017         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20018         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
20019         return tag_ptr(ret_conv, true);
20020 }
20021
20022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20023         void* o_ptr = untag_ptr(o);
20024         CHECK_ACCESS(o_ptr);
20025         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
20026         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
20027         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20028         *ret_copy = COption_MonitorEventZ_some(o_conv);
20029         int64_t ret_ref = tag_ptr(ret_copy, true);
20030         return ret_ref;
20031 }
20032
20033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
20034         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20035         *ret_copy = COption_MonitorEventZ_none();
20036         int64_t ret_ref = tag_ptr(ret_copy, true);
20037         return ret_ref;
20038 }
20039
20040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20041         if (!ptr_is_owned(_res)) return;
20042         void* _res_ptr = untag_ptr(_res);
20043         CHECK_ACCESS(_res_ptr);
20044         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
20045         FREE(untag_ptr(_res));
20046         COption_MonitorEventZ_free(_res_conv);
20047 }
20048
20049 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
20050         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20051         *ret_copy = COption_MonitorEventZ_clone(arg);
20052         int64_t ret_ref = tag_ptr(ret_copy, true);
20053         return ret_ref;
20054 }
20055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20056         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
20057         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
20058         return ret_conv;
20059 }
20060
20061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20062         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
20063         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20064         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
20065         int64_t ret_ref = tag_ptr(ret_copy, true);
20066         return ret_ref;
20067 }
20068
20069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20070         void* o_ptr = untag_ptr(o);
20071         CHECK_ACCESS(o_ptr);
20072         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
20073         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
20074         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20075         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
20076         return tag_ptr(ret_conv, true);
20077 }
20078
20079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20080         LDKDecodeError e_conv;
20081         e_conv.inner = untag_ptr(e);
20082         e_conv.is_owned = ptr_is_owned(e);
20083         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20084         e_conv = DecodeError_clone(&e_conv);
20085         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20086         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
20087         return tag_ptr(ret_conv, true);
20088 }
20089
20090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20091         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
20092         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
20093         return ret_conv;
20094 }
20095
20096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_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_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
20101         FREE(untag_ptr(_res));
20102         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
20103 }
20104
20105 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
20106         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20107         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
20108         return tag_ptr(ret_conv, true);
20109 }
20110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20111         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
20112         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
20113         return ret_conv;
20114 }
20115
20116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20117         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
20118         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20119         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
20120         return tag_ptr(ret_conv, true);
20121 }
20122
20123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20124         LDKHTLCUpdate o_conv;
20125         o_conv.inner = untag_ptr(o);
20126         o_conv.is_owned = ptr_is_owned(o);
20127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20128         o_conv = HTLCUpdate_clone(&o_conv);
20129         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20130         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
20131         return tag_ptr(ret_conv, true);
20132 }
20133
20134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20135         LDKDecodeError e_conv;
20136         e_conv.inner = untag_ptr(e);
20137         e_conv.is_owned = ptr_is_owned(e);
20138         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20139         e_conv = DecodeError_clone(&e_conv);
20140         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20141         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
20142         return tag_ptr(ret_conv, true);
20143 }
20144
20145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20146         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
20147         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
20148         return ret_conv;
20149 }
20150
20151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20152         if (!ptr_is_owned(_res)) return;
20153         void* _res_ptr = untag_ptr(_res);
20154         CHECK_ACCESS(_res_ptr);
20155         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
20156         FREE(untag_ptr(_res));
20157         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
20158 }
20159
20160 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
20161         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20162         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
20163         return tag_ptr(ret_conv, true);
20164 }
20165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20166         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
20167         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
20168         return ret_conv;
20169 }
20170
20171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20172         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
20173         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20174         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
20175         return tag_ptr(ret_conv, true);
20176 }
20177
20178 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
20179         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20180         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
20181         return tag_ptr(ret_conv, true);
20182 }
20183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20184         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
20185         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
20186         return ret_conv;
20187 }
20188
20189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20190         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
20191         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20192         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
20193         return tag_ptr(ret_conv, true);
20194 }
20195
20196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
20197         LDKOutPoint a_conv;
20198         a_conv.inner = untag_ptr(a);
20199         a_conv.is_owned = ptr_is_owned(a);
20200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20201         a_conv = OutPoint_clone(&a_conv);
20202         LDKCVec_u8Z b_ref;
20203         b_ref.datalen = (*env)->GetArrayLength(env, b);
20204         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20205         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20206         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20207         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
20208         return tag_ptr(ret_conv, true);
20209 }
20210
20211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20212         if (!ptr_is_owned(_res)) return;
20213         void* _res_ptr = untag_ptr(_res);
20214         CHECK_ACCESS(_res_ptr);
20215         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
20216         FREE(untag_ptr(_res));
20217         C2Tuple_OutPointScriptZ_free(_res_conv);
20218 }
20219
20220 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
20221         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20222         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
20223         return tag_ptr(ret_conv, true);
20224 }
20225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20226         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
20227         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
20228         return ret_conv;
20229 }
20230
20231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20232         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
20233         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20234         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
20235         return tag_ptr(ret_conv, true);
20236 }
20237
20238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
20239         LDKCVec_u8Z b_ref;
20240         b_ref.datalen = (*env)->GetArrayLength(env, b);
20241         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20242         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20243         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20244         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
20245         return tag_ptr(ret_conv, true);
20246 }
20247
20248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20249         if (!ptr_is_owned(_res)) return;
20250         void* _res_ptr = untag_ptr(_res);
20251         CHECK_ACCESS(_res_ptr);
20252         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
20253         FREE(untag_ptr(_res));
20254         C2Tuple_u32ScriptZ_free(_res_conv);
20255 }
20256
20257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20258         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
20259         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20260         if (_res_constr.datalen > 0)
20261                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20262         else
20263                 _res_constr.data = NULL;
20264         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20265         for (size_t v = 0; v < _res_constr.datalen; v++) {
20266                 int64_t _res_conv_21 = _res_vals[v];
20267                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
20268                 CHECK_ACCESS(_res_conv_21_ptr);
20269                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
20270                 FREE(untag_ptr(_res_conv_21));
20271                 _res_constr.data[v] = _res_conv_21_conv;
20272         }
20273         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20274         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
20275 }
20276
20277 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
20278         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20279         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
20280         return tag_ptr(ret_conv, true);
20281 }
20282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20283         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
20284         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
20285         return ret_conv;
20286 }
20287
20288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20289         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
20290         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20291         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
20292         return tag_ptr(ret_conv, true);
20293 }
20294
20295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
20296         LDKThirtyTwoBytes a_ref;
20297         CHECK((*env)->GetArrayLength(env, a) == 32);
20298         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20299         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
20300         b_constr.datalen = (*env)->GetArrayLength(env, b);
20301         if (b_constr.datalen > 0)
20302                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20303         else
20304                 b_constr.data = NULL;
20305         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
20306         for (size_t v = 0; v < b_constr.datalen; v++) {
20307                 int64_t b_conv_21 = b_vals[v];
20308                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
20309                 CHECK_ACCESS(b_conv_21_ptr);
20310                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
20311                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
20312                 b_constr.data[v] = b_conv_21_conv;
20313         }
20314         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
20315         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20316         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
20317         return tag_ptr(ret_conv, true);
20318 }
20319
20320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20321         if (!ptr_is_owned(_res)) return;
20322         void* _res_ptr = untag_ptr(_res);
20323         CHECK_ACCESS(_res_ptr);
20324         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
20325         FREE(untag_ptr(_res));
20326         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
20327 }
20328
20329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20330         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
20331         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20332         if (_res_constr.datalen > 0)
20333                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
20334         else
20335                 _res_constr.data = NULL;
20336         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20337         for (size_t o = 0; o < _res_constr.datalen; o++) {
20338                 int64_t _res_conv_40 = _res_vals[o];
20339                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
20340                 CHECK_ACCESS(_res_conv_40_ptr);
20341                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
20342                 FREE(untag_ptr(_res_conv_40));
20343                 _res_constr.data[o] = _res_conv_40_conv;
20344         }
20345         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20346         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
20347 }
20348
20349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20350         LDKCVec_EventZ _res_constr;
20351         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20352         if (_res_constr.datalen > 0)
20353                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
20354         else
20355                 _res_constr.data = NULL;
20356         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20357         for (size_t h = 0; h < _res_constr.datalen; h++) {
20358                 int64_t _res_conv_7 = _res_vals[h];
20359                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
20360                 CHECK_ACCESS(_res_conv_7_ptr);
20361                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
20362                 FREE(untag_ptr(_res_conv_7));
20363                 _res_constr.data[h] = _res_conv_7_conv;
20364         }
20365         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20366         CVec_EventZ_free(_res_constr);
20367 }
20368
20369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20370         LDKCVec_TransactionZ _res_constr;
20371         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20372         if (_res_constr.datalen > 0)
20373                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
20374         else
20375                 _res_constr.data = NULL;
20376         for (size_t i = 0; i < _res_constr.datalen; i++) {
20377                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20378                 LDKTransaction _res_conv_8_ref;
20379                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
20380                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
20381                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
20382                 _res_conv_8_ref.data_is_owned = true;
20383                 _res_constr.data[i] = _res_conv_8_ref;
20384         }
20385         CVec_TransactionZ_free(_res_constr);
20386 }
20387
20388 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
20389         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20390         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
20391         return tag_ptr(ret_conv, true);
20392 }
20393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20394         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
20395         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
20396         return ret_conv;
20397 }
20398
20399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20400         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
20401         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20402         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
20403         return tag_ptr(ret_conv, true);
20404 }
20405
20406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
20407         void* b_ptr = untag_ptr(b);
20408         CHECK_ACCESS(b_ptr);
20409         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
20410         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
20411         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20412         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
20413         return tag_ptr(ret_conv, true);
20414 }
20415
20416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20417         if (!ptr_is_owned(_res)) return;
20418         void* _res_ptr = untag_ptr(_res);
20419         CHECK_ACCESS(_res_ptr);
20420         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
20421         FREE(untag_ptr(_res));
20422         C2Tuple_u32TxOutZ_free(_res_conv);
20423 }
20424
20425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20426         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
20427         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20428         if (_res_constr.datalen > 0)
20429                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
20430         else
20431                 _res_constr.data = NULL;
20432         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20433         for (size_t u = 0; u < _res_constr.datalen; u++) {
20434                 int64_t _res_conv_20 = _res_vals[u];
20435                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
20436                 CHECK_ACCESS(_res_conv_20_ptr);
20437                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
20438                 FREE(untag_ptr(_res_conv_20));
20439                 _res_constr.data[u] = _res_conv_20_conv;
20440         }
20441         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20442         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
20443 }
20444
20445 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
20446         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20447         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
20448         return tag_ptr(ret_conv, true);
20449 }
20450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20451         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
20452         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
20453         return ret_conv;
20454 }
20455
20456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20457         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
20458         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20459         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
20460         return tag_ptr(ret_conv, true);
20461 }
20462
20463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
20464         LDKThirtyTwoBytes a_ref;
20465         CHECK((*env)->GetArrayLength(env, a) == 32);
20466         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20467         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
20468         b_constr.datalen = (*env)->GetArrayLength(env, b);
20469         if (b_constr.datalen > 0)
20470                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
20471         else
20472                 b_constr.data = NULL;
20473         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
20474         for (size_t u = 0; u < b_constr.datalen; u++) {
20475                 int64_t b_conv_20 = b_vals[u];
20476                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
20477                 CHECK_ACCESS(b_conv_20_ptr);
20478                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
20479                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
20480                 b_constr.data[u] = b_conv_20_conv;
20481         }
20482         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
20483         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20484         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
20485         return tag_ptr(ret_conv, true);
20486 }
20487
20488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20489         if (!ptr_is_owned(_res)) return;
20490         void* _res_ptr = untag_ptr(_res);
20491         CHECK_ACCESS(_res_ptr);
20492         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
20493         FREE(untag_ptr(_res));
20494         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
20495 }
20496
20497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20498         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
20499         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20500         if (_res_constr.datalen > 0)
20501                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
20502         else
20503                 _res_constr.data = NULL;
20504         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20505         for (size_t n = 0; n < _res_constr.datalen; n++) {
20506                 int64_t _res_conv_39 = _res_vals[n];
20507                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
20508                 CHECK_ACCESS(_res_conv_39_ptr);
20509                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
20510                 FREE(untag_ptr(_res_conv_39));
20511                 _res_constr.data[n] = _res_conv_39_conv;
20512         }
20513         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20514         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
20515 }
20516
20517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20518         LDKCVec_BalanceZ _res_constr;
20519         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20520         if (_res_constr.datalen > 0)
20521                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
20522         else
20523                 _res_constr.data = NULL;
20524         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20525         for (size_t j = 0; j < _res_constr.datalen; j++) {
20526                 int64_t _res_conv_9 = _res_vals[j];
20527                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
20528                 CHECK_ACCESS(_res_conv_9_ptr);
20529                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
20530                 FREE(untag_ptr(_res_conv_9));
20531                 _res_constr.data[j] = _res_conv_9_conv;
20532         }
20533         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20534         CVec_BalanceZ_free(_res_constr);
20535 }
20536
20537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20538         void* o_ptr = untag_ptr(o);
20539         CHECK_ACCESS(o_ptr);
20540         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
20541         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
20542         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20543         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
20544         return tag_ptr(ret_conv, true);
20545 }
20546
20547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20548         LDKDecodeError e_conv;
20549         e_conv.inner = untag_ptr(e);
20550         e_conv.is_owned = ptr_is_owned(e);
20551         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20552         e_conv = DecodeError_clone(&e_conv);
20553         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20554         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
20555         return tag_ptr(ret_conv, true);
20556 }
20557
20558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20559         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
20560         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
20561         return ret_conv;
20562 }
20563
20564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20565         if (!ptr_is_owned(_res)) return;
20566         void* _res_ptr = untag_ptr(_res);
20567         CHECK_ACCESS(_res_ptr);
20568         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
20569         FREE(untag_ptr(_res));
20570         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
20571 }
20572
20573 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
20574         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20575         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
20576         return tag_ptr(ret_conv, true);
20577 }
20578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20579         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
20580         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
20581         return ret_conv;
20582 }
20583
20584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20585         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
20586         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20587         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
20588         return tag_ptr(ret_conv, true);
20589 }
20590
20591 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
20592         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20593         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
20594         return tag_ptr(ret_conv, true);
20595 }
20596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20597         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
20598         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
20599         return ret_conv;
20600 }
20601
20602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20603         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
20604         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20605         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
20606         return tag_ptr(ret_conv, true);
20607 }
20608
20609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20610         LDKPublicKey a_ref;
20611         CHECK((*env)->GetArrayLength(env, a) == 33);
20612         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
20613         void* b_ptr = untag_ptr(b);
20614         CHECK_ACCESS(b_ptr);
20615         LDKType b_conv = *(LDKType*)(b_ptr);
20616         if (b_conv.free == LDKType_JCalls_free) {
20617                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20618                 LDKType_JCalls_cloned(&b_conv);
20619         }
20620         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20621         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
20622         return tag_ptr(ret_conv, true);
20623 }
20624
20625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20626         if (!ptr_is_owned(_res)) return;
20627         void* _res_ptr = untag_ptr(_res);
20628         CHECK_ACCESS(_res_ptr);
20629         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
20630         FREE(untag_ptr(_res));
20631         C2Tuple_PublicKeyTypeZ_free(_res_conv);
20632 }
20633
20634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20635         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
20636         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20637         if (_res_constr.datalen > 0)
20638                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
20639         else
20640                 _res_constr.data = NULL;
20641         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20642         for (size_t z = 0; z < _res_constr.datalen; z++) {
20643                 int64_t _res_conv_25 = _res_vals[z];
20644                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
20645                 CHECK_ACCESS(_res_conv_25_ptr);
20646                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
20647                 FREE(untag_ptr(_res_conv_25));
20648                 _res_constr.data[z] = _res_conv_25_conv;
20649         }
20650         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20651         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
20652 }
20653
20654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20655         void* o_ptr = untag_ptr(o);
20656         CHECK_ACCESS(o_ptr);
20657         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20658         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
20659         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20660         *ret_copy = COption_NetAddressZ_some(o_conv);
20661         int64_t ret_ref = tag_ptr(ret_copy, true);
20662         return ret_ref;
20663 }
20664
20665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
20666         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20667         *ret_copy = COption_NetAddressZ_none();
20668         int64_t ret_ref = tag_ptr(ret_copy, true);
20669         return ret_ref;
20670 }
20671
20672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20673         if (!ptr_is_owned(_res)) return;
20674         void* _res_ptr = untag_ptr(_res);
20675         CHECK_ACCESS(_res_ptr);
20676         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
20677         FREE(untag_ptr(_res));
20678         COption_NetAddressZ_free(_res_conv);
20679 }
20680
20681 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
20682         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20683         *ret_copy = COption_NetAddressZ_clone(arg);
20684         int64_t ret_ref = tag_ptr(ret_copy, true);
20685         return ret_ref;
20686 }
20687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20688         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
20689         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
20690         return ret_conv;
20691 }
20692
20693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20694         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
20695         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20696         *ret_copy = COption_NetAddressZ_clone(orig_conv);
20697         int64_t ret_ref = tag_ptr(ret_copy, true);
20698         return ret_ref;
20699 }
20700
20701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20702         LDKCVec_u8Z o_ref;
20703         o_ref.datalen = (*env)->GetArrayLength(env, o);
20704         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20705         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20706         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20707         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
20708         return tag_ptr(ret_conv, true);
20709 }
20710
20711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20712         LDKPeerHandleError e_conv;
20713         e_conv.inner = untag_ptr(e);
20714         e_conv.is_owned = ptr_is_owned(e);
20715         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20716         e_conv = PeerHandleError_clone(&e_conv);
20717         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20718         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
20719         return tag_ptr(ret_conv, true);
20720 }
20721
20722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20723         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
20724         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
20725         return ret_conv;
20726 }
20727
20728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20729         if (!ptr_is_owned(_res)) return;
20730         void* _res_ptr = untag_ptr(_res);
20731         CHECK_ACCESS(_res_ptr);
20732         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
20733         FREE(untag_ptr(_res));
20734         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
20735 }
20736
20737 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
20738         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20739         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
20740         return tag_ptr(ret_conv, true);
20741 }
20742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20743         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
20744         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
20745         return ret_conv;
20746 }
20747
20748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20749         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
20750         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20751         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
20752         return tag_ptr(ret_conv, true);
20753 }
20754
20755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
20756         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20757         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
20758         return tag_ptr(ret_conv, true);
20759 }
20760
20761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20762         LDKPeerHandleError e_conv;
20763         e_conv.inner = untag_ptr(e);
20764         e_conv.is_owned = ptr_is_owned(e);
20765         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20766         e_conv = PeerHandleError_clone(&e_conv);
20767         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20768         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
20769         return tag_ptr(ret_conv, true);
20770 }
20771
20772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20773         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
20774         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
20775         return ret_conv;
20776 }
20777
20778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20779         if (!ptr_is_owned(_res)) return;
20780         void* _res_ptr = untag_ptr(_res);
20781         CHECK_ACCESS(_res_ptr);
20782         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
20783         FREE(untag_ptr(_res));
20784         CResult_NonePeerHandleErrorZ_free(_res_conv);
20785 }
20786
20787 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
20788         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20789         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
20790         return tag_ptr(ret_conv, true);
20791 }
20792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20793         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
20794         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
20795         return ret_conv;
20796 }
20797
20798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20799         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
20800         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20801         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
20802         return tag_ptr(ret_conv, true);
20803 }
20804
20805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
20806         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20807         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
20808         return tag_ptr(ret_conv, true);
20809 }
20810
20811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20812         LDKPeerHandleError e_conv;
20813         e_conv.inner = untag_ptr(e);
20814         e_conv.is_owned = ptr_is_owned(e);
20815         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20816         e_conv = PeerHandleError_clone(&e_conv);
20817         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20818         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
20819         return tag_ptr(ret_conv, true);
20820 }
20821
20822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20823         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
20824         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
20825         return ret_conv;
20826 }
20827
20828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20829         if (!ptr_is_owned(_res)) return;
20830         void* _res_ptr = untag_ptr(_res);
20831         CHECK_ACCESS(_res_ptr);
20832         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
20833         FREE(untag_ptr(_res));
20834         CResult_boolPeerHandleErrorZ_free(_res_conv);
20835 }
20836
20837 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
20838         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20839         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
20840         return tag_ptr(ret_conv, true);
20841 }
20842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20843         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
20844         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
20845         return ret_conv;
20846 }
20847
20848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20849         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
20850         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20851         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
20852         return tag_ptr(ret_conv, true);
20853 }
20854
20855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
20856         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
20857         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
20858         return tag_ptr(ret_conv, true);
20859 }
20860
20861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20862         void* e_ptr = untag_ptr(e);
20863         CHECK_ACCESS(e_ptr);
20864         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
20865         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
20866         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
20867         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
20868         return tag_ptr(ret_conv, true);
20869 }
20870
20871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20872         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
20873         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
20874         return ret_conv;
20875 }
20876
20877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20878         if (!ptr_is_owned(_res)) return;
20879         void* _res_ptr = untag_ptr(_res);
20880         CHECK_ACCESS(_res_ptr);
20881         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
20882         FREE(untag_ptr(_res));
20883         CResult_u32GraphSyncErrorZ_free(_res_conv);
20884 }
20885
20886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20887         void* o_ptr = untag_ptr(o);
20888         CHECK_ACCESS(o_ptr);
20889         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20890         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
20891         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20892         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
20893         return tag_ptr(ret_conv, true);
20894 }
20895
20896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20897         LDKDecodeError e_conv;
20898         e_conv.inner = untag_ptr(e);
20899         e_conv.is_owned = ptr_is_owned(e);
20900         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20901         e_conv = DecodeError_clone(&e_conv);
20902         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20903         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
20904         return tag_ptr(ret_conv, true);
20905 }
20906
20907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20908         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
20909         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
20910         return ret_conv;
20911 }
20912
20913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20914         if (!ptr_is_owned(_res)) return;
20915         void* _res_ptr = untag_ptr(_res);
20916         CHECK_ACCESS(_res_ptr);
20917         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
20918         FREE(untag_ptr(_res));
20919         CResult_NetAddressDecodeErrorZ_free(_res_conv);
20920 }
20921
20922 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
20923         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20924         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
20925         return tag_ptr(ret_conv, true);
20926 }
20927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20928         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
20929         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
20930         return ret_conv;
20931 }
20932
20933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20934         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
20935         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20936         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
20937         return tag_ptr(ret_conv, true);
20938 }
20939
20940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20941         LDKCVec_UpdateAddHTLCZ _res_constr;
20942         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20943         if (_res_constr.datalen > 0)
20944                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20945         else
20946                 _res_constr.data = NULL;
20947         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20948         for (size_t p = 0; p < _res_constr.datalen; p++) {
20949                 int64_t _res_conv_15 = _res_vals[p];
20950                 LDKUpdateAddHTLC _res_conv_15_conv;
20951                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
20952                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
20953                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
20954                 _res_constr.data[p] = _res_conv_15_conv;
20955         }
20956         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20957         CVec_UpdateAddHTLCZ_free(_res_constr);
20958 }
20959
20960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20961         LDKCVec_UpdateFulfillHTLCZ _res_constr;
20962         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20963         if (_res_constr.datalen > 0)
20964                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20965         else
20966                 _res_constr.data = NULL;
20967         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20968         for (size_t t = 0; t < _res_constr.datalen; t++) {
20969                 int64_t _res_conv_19 = _res_vals[t];
20970                 LDKUpdateFulfillHTLC _res_conv_19_conv;
20971                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
20972                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
20973                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
20974                 _res_constr.data[t] = _res_conv_19_conv;
20975         }
20976         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20977         CVec_UpdateFulfillHTLCZ_free(_res_constr);
20978 }
20979
20980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20981         LDKCVec_UpdateFailHTLCZ _res_constr;
20982         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20983         if (_res_constr.datalen > 0)
20984                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20985         else
20986                 _res_constr.data = NULL;
20987         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20988         for (size_t q = 0; q < _res_constr.datalen; q++) {
20989                 int64_t _res_conv_16 = _res_vals[q];
20990                 LDKUpdateFailHTLC _res_conv_16_conv;
20991                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20992                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20993                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20994                 _res_constr.data[q] = _res_conv_16_conv;
20995         }
20996         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20997         CVec_UpdateFailHTLCZ_free(_res_constr);
20998 }
20999
21000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21001         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
21002         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21003         if (_res_constr.datalen > 0)
21004                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21005         else
21006                 _res_constr.data = NULL;
21007         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21008         for (size_t z = 0; z < _res_constr.datalen; z++) {
21009                 int64_t _res_conv_25 = _res_vals[z];
21010                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
21011                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
21012                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
21013                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
21014                 _res_constr.data[z] = _res_conv_25_conv;
21015         }
21016         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21017         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
21018 }
21019
21020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21021         LDKAcceptChannel o_conv;
21022         o_conv.inner = untag_ptr(o);
21023         o_conv.is_owned = ptr_is_owned(o);
21024         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21025         o_conv = AcceptChannel_clone(&o_conv);
21026         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21027         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
21028         return tag_ptr(ret_conv, true);
21029 }
21030
21031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21032         LDKDecodeError e_conv;
21033         e_conv.inner = untag_ptr(e);
21034         e_conv.is_owned = ptr_is_owned(e);
21035         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21036         e_conv = DecodeError_clone(&e_conv);
21037         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21038         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
21039         return tag_ptr(ret_conv, true);
21040 }
21041
21042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21043         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
21044         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
21045         return ret_conv;
21046 }
21047
21048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21049         if (!ptr_is_owned(_res)) return;
21050         void* _res_ptr = untag_ptr(_res);
21051         CHECK_ACCESS(_res_ptr);
21052         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
21053         FREE(untag_ptr(_res));
21054         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
21055 }
21056
21057 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
21058         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21059         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
21060         return tag_ptr(ret_conv, true);
21061 }
21062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21063         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
21064         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
21065         return ret_conv;
21066 }
21067
21068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21069         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
21070         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21071         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
21072         return tag_ptr(ret_conv, true);
21073 }
21074
21075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21076         LDKAnnouncementSignatures o_conv;
21077         o_conv.inner = untag_ptr(o);
21078         o_conv.is_owned = ptr_is_owned(o);
21079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21080         o_conv = AnnouncementSignatures_clone(&o_conv);
21081         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21082         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
21083         return tag_ptr(ret_conv, true);
21084 }
21085
21086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21087         LDKDecodeError e_conv;
21088         e_conv.inner = untag_ptr(e);
21089         e_conv.is_owned = ptr_is_owned(e);
21090         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21091         e_conv = DecodeError_clone(&e_conv);
21092         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21093         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
21094         return tag_ptr(ret_conv, true);
21095 }
21096
21097 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21098         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
21099         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
21100         return ret_conv;
21101 }
21102
21103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21104         if (!ptr_is_owned(_res)) return;
21105         void* _res_ptr = untag_ptr(_res);
21106         CHECK_ACCESS(_res_ptr);
21107         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
21108         FREE(untag_ptr(_res));
21109         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
21110 }
21111
21112 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
21113         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21114         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
21115         return tag_ptr(ret_conv, true);
21116 }
21117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21118         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
21119         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
21120         return ret_conv;
21121 }
21122
21123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21124         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
21125         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21126         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
21127         return tag_ptr(ret_conv, true);
21128 }
21129
21130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21131         LDKChannelReestablish o_conv;
21132         o_conv.inner = untag_ptr(o);
21133         o_conv.is_owned = ptr_is_owned(o);
21134         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21135         o_conv = ChannelReestablish_clone(&o_conv);
21136         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21137         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
21138         return tag_ptr(ret_conv, true);
21139 }
21140
21141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21142         LDKDecodeError e_conv;
21143         e_conv.inner = untag_ptr(e);
21144         e_conv.is_owned = ptr_is_owned(e);
21145         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21146         e_conv = DecodeError_clone(&e_conv);
21147         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21148         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
21149         return tag_ptr(ret_conv, true);
21150 }
21151
21152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21153         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
21154         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
21155         return ret_conv;
21156 }
21157
21158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21159         if (!ptr_is_owned(_res)) return;
21160         void* _res_ptr = untag_ptr(_res);
21161         CHECK_ACCESS(_res_ptr);
21162         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
21163         FREE(untag_ptr(_res));
21164         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
21165 }
21166
21167 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
21168         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21169         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
21170         return tag_ptr(ret_conv, true);
21171 }
21172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21173         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
21174         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
21175         return ret_conv;
21176 }
21177
21178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21179         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
21180         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21181         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
21182         return tag_ptr(ret_conv, true);
21183 }
21184
21185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21186         LDKClosingSigned o_conv;
21187         o_conv.inner = untag_ptr(o);
21188         o_conv.is_owned = ptr_is_owned(o);
21189         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21190         o_conv = ClosingSigned_clone(&o_conv);
21191         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21192         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
21193         return tag_ptr(ret_conv, true);
21194 }
21195
21196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21197         LDKDecodeError e_conv;
21198         e_conv.inner = untag_ptr(e);
21199         e_conv.is_owned = ptr_is_owned(e);
21200         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21201         e_conv = DecodeError_clone(&e_conv);
21202         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21203         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
21204         return tag_ptr(ret_conv, true);
21205 }
21206
21207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21208         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
21209         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
21210         return ret_conv;
21211 }
21212
21213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21214         if (!ptr_is_owned(_res)) return;
21215         void* _res_ptr = untag_ptr(_res);
21216         CHECK_ACCESS(_res_ptr);
21217         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
21218         FREE(untag_ptr(_res));
21219         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
21220 }
21221
21222 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
21223         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21224         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
21225         return tag_ptr(ret_conv, true);
21226 }
21227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21228         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
21229         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
21230         return ret_conv;
21231 }
21232
21233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21234         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
21235         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21236         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
21237         return tag_ptr(ret_conv, true);
21238 }
21239
21240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21241         LDKClosingSignedFeeRange o_conv;
21242         o_conv.inner = untag_ptr(o);
21243         o_conv.is_owned = ptr_is_owned(o);
21244         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21245         o_conv = ClosingSignedFeeRange_clone(&o_conv);
21246         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21247         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
21248         return tag_ptr(ret_conv, true);
21249 }
21250
21251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21252         LDKDecodeError e_conv;
21253         e_conv.inner = untag_ptr(e);
21254         e_conv.is_owned = ptr_is_owned(e);
21255         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21256         e_conv = DecodeError_clone(&e_conv);
21257         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21258         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
21259         return tag_ptr(ret_conv, true);
21260 }
21261
21262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21263         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
21264         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
21265         return ret_conv;
21266 }
21267
21268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21269         if (!ptr_is_owned(_res)) return;
21270         void* _res_ptr = untag_ptr(_res);
21271         CHECK_ACCESS(_res_ptr);
21272         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
21273         FREE(untag_ptr(_res));
21274         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
21275 }
21276
21277 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
21278         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21279         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
21280         return tag_ptr(ret_conv, true);
21281 }
21282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21283         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
21284         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
21285         return ret_conv;
21286 }
21287
21288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21289         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
21290         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21291         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
21292         return tag_ptr(ret_conv, true);
21293 }
21294
21295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21296         LDKCommitmentSigned o_conv;
21297         o_conv.inner = untag_ptr(o);
21298         o_conv.is_owned = ptr_is_owned(o);
21299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21300         o_conv = CommitmentSigned_clone(&o_conv);
21301         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21302         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
21303         return tag_ptr(ret_conv, true);
21304 }
21305
21306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21307         LDKDecodeError e_conv;
21308         e_conv.inner = untag_ptr(e);
21309         e_conv.is_owned = ptr_is_owned(e);
21310         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21311         e_conv = DecodeError_clone(&e_conv);
21312         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21313         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
21314         return tag_ptr(ret_conv, true);
21315 }
21316
21317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21318         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
21319         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
21320         return ret_conv;
21321 }
21322
21323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21324         if (!ptr_is_owned(_res)) return;
21325         void* _res_ptr = untag_ptr(_res);
21326         CHECK_ACCESS(_res_ptr);
21327         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
21328         FREE(untag_ptr(_res));
21329         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
21330 }
21331
21332 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
21333         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21334         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
21335         return tag_ptr(ret_conv, true);
21336 }
21337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21338         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
21339         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
21340         return ret_conv;
21341 }
21342
21343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21344         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
21345         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21346         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
21347         return tag_ptr(ret_conv, true);
21348 }
21349
21350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21351         LDKFundingCreated o_conv;
21352         o_conv.inner = untag_ptr(o);
21353         o_conv.is_owned = ptr_is_owned(o);
21354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21355         o_conv = FundingCreated_clone(&o_conv);
21356         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21357         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
21358         return tag_ptr(ret_conv, true);
21359 }
21360
21361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21362         LDKDecodeError e_conv;
21363         e_conv.inner = untag_ptr(e);
21364         e_conv.is_owned = ptr_is_owned(e);
21365         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21366         e_conv = DecodeError_clone(&e_conv);
21367         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21368         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
21369         return tag_ptr(ret_conv, true);
21370 }
21371
21372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21373         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
21374         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
21375         return ret_conv;
21376 }
21377
21378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21379         if (!ptr_is_owned(_res)) return;
21380         void* _res_ptr = untag_ptr(_res);
21381         CHECK_ACCESS(_res_ptr);
21382         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
21383         FREE(untag_ptr(_res));
21384         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
21385 }
21386
21387 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
21388         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21389         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
21390         return tag_ptr(ret_conv, true);
21391 }
21392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21393         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
21394         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
21395         return ret_conv;
21396 }
21397
21398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21399         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
21400         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21401         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
21402         return tag_ptr(ret_conv, true);
21403 }
21404
21405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21406         LDKFundingSigned o_conv;
21407         o_conv.inner = untag_ptr(o);
21408         o_conv.is_owned = ptr_is_owned(o);
21409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21410         o_conv = FundingSigned_clone(&o_conv);
21411         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21412         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
21413         return tag_ptr(ret_conv, true);
21414 }
21415
21416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21417         LDKDecodeError e_conv;
21418         e_conv.inner = untag_ptr(e);
21419         e_conv.is_owned = ptr_is_owned(e);
21420         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21421         e_conv = DecodeError_clone(&e_conv);
21422         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21423         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
21424         return tag_ptr(ret_conv, true);
21425 }
21426
21427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21428         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
21429         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
21430         return ret_conv;
21431 }
21432
21433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21434         if (!ptr_is_owned(_res)) return;
21435         void* _res_ptr = untag_ptr(_res);
21436         CHECK_ACCESS(_res_ptr);
21437         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
21438         FREE(untag_ptr(_res));
21439         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
21440 }
21441
21442 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
21443         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21444         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
21445         return tag_ptr(ret_conv, true);
21446 }
21447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21448         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
21449         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
21450         return ret_conv;
21451 }
21452
21453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21454         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
21455         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21456         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
21457         return tag_ptr(ret_conv, true);
21458 }
21459
21460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21461         LDKChannelReady o_conv;
21462         o_conv.inner = untag_ptr(o);
21463         o_conv.is_owned = ptr_is_owned(o);
21464         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21465         o_conv = ChannelReady_clone(&o_conv);
21466         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21467         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
21468         return tag_ptr(ret_conv, true);
21469 }
21470
21471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21472         LDKDecodeError e_conv;
21473         e_conv.inner = untag_ptr(e);
21474         e_conv.is_owned = ptr_is_owned(e);
21475         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21476         e_conv = DecodeError_clone(&e_conv);
21477         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21478         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
21479         return tag_ptr(ret_conv, true);
21480 }
21481
21482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21483         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
21484         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
21485         return ret_conv;
21486 }
21487
21488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21489         if (!ptr_is_owned(_res)) return;
21490         void* _res_ptr = untag_ptr(_res);
21491         CHECK_ACCESS(_res_ptr);
21492         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
21493         FREE(untag_ptr(_res));
21494         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
21495 }
21496
21497 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
21498         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21499         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
21500         return tag_ptr(ret_conv, true);
21501 }
21502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21503         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
21504         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
21505         return ret_conv;
21506 }
21507
21508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21509         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
21510         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21511         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
21512         return tag_ptr(ret_conv, true);
21513 }
21514
21515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21516         LDKInit o_conv;
21517         o_conv.inner = untag_ptr(o);
21518         o_conv.is_owned = ptr_is_owned(o);
21519         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21520         o_conv = Init_clone(&o_conv);
21521         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21522         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
21523         return tag_ptr(ret_conv, true);
21524 }
21525
21526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21527         LDKDecodeError e_conv;
21528         e_conv.inner = untag_ptr(e);
21529         e_conv.is_owned = ptr_is_owned(e);
21530         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21531         e_conv = DecodeError_clone(&e_conv);
21532         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21533         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
21534         return tag_ptr(ret_conv, true);
21535 }
21536
21537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21538         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
21539         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
21540         return ret_conv;
21541 }
21542
21543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21544         if (!ptr_is_owned(_res)) return;
21545         void* _res_ptr = untag_ptr(_res);
21546         CHECK_ACCESS(_res_ptr);
21547         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
21548         FREE(untag_ptr(_res));
21549         CResult_InitDecodeErrorZ_free(_res_conv);
21550 }
21551
21552 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
21553         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21554         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
21555         return tag_ptr(ret_conv, true);
21556 }
21557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21558         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
21559         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
21560         return ret_conv;
21561 }
21562
21563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21564         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
21565         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21566         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
21567         return tag_ptr(ret_conv, true);
21568 }
21569
21570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21571         LDKOpenChannel o_conv;
21572         o_conv.inner = untag_ptr(o);
21573         o_conv.is_owned = ptr_is_owned(o);
21574         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21575         o_conv = OpenChannel_clone(&o_conv);
21576         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21577         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
21578         return tag_ptr(ret_conv, true);
21579 }
21580
21581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21582         LDKDecodeError e_conv;
21583         e_conv.inner = untag_ptr(e);
21584         e_conv.is_owned = ptr_is_owned(e);
21585         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21586         e_conv = DecodeError_clone(&e_conv);
21587         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21588         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
21589         return tag_ptr(ret_conv, true);
21590 }
21591
21592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21593         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
21594         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
21595         return ret_conv;
21596 }
21597
21598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21599         if (!ptr_is_owned(_res)) return;
21600         void* _res_ptr = untag_ptr(_res);
21601         CHECK_ACCESS(_res_ptr);
21602         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
21603         FREE(untag_ptr(_res));
21604         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
21605 }
21606
21607 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
21608         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21609         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
21610         return tag_ptr(ret_conv, true);
21611 }
21612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21613         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
21614         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
21615         return ret_conv;
21616 }
21617
21618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21619         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
21620         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21621         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
21622         return tag_ptr(ret_conv, true);
21623 }
21624
21625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21626         LDKRevokeAndACK o_conv;
21627         o_conv.inner = untag_ptr(o);
21628         o_conv.is_owned = ptr_is_owned(o);
21629         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21630         o_conv = RevokeAndACK_clone(&o_conv);
21631         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21632         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
21633         return tag_ptr(ret_conv, true);
21634 }
21635
21636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21637         LDKDecodeError e_conv;
21638         e_conv.inner = untag_ptr(e);
21639         e_conv.is_owned = ptr_is_owned(e);
21640         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21641         e_conv = DecodeError_clone(&e_conv);
21642         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21643         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
21644         return tag_ptr(ret_conv, true);
21645 }
21646
21647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21648         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
21649         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
21650         return ret_conv;
21651 }
21652
21653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21654         if (!ptr_is_owned(_res)) return;
21655         void* _res_ptr = untag_ptr(_res);
21656         CHECK_ACCESS(_res_ptr);
21657         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
21658         FREE(untag_ptr(_res));
21659         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
21660 }
21661
21662 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
21663         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21664         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
21665         return tag_ptr(ret_conv, true);
21666 }
21667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21668         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
21669         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
21670         return ret_conv;
21671 }
21672
21673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21674         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
21675         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21676         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
21677         return tag_ptr(ret_conv, true);
21678 }
21679
21680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21681         LDKShutdown o_conv;
21682         o_conv.inner = untag_ptr(o);
21683         o_conv.is_owned = ptr_is_owned(o);
21684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21685         o_conv = Shutdown_clone(&o_conv);
21686         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21687         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
21688         return tag_ptr(ret_conv, true);
21689 }
21690
21691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21692         LDKDecodeError e_conv;
21693         e_conv.inner = untag_ptr(e);
21694         e_conv.is_owned = ptr_is_owned(e);
21695         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21696         e_conv = DecodeError_clone(&e_conv);
21697         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21698         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
21699         return tag_ptr(ret_conv, true);
21700 }
21701
21702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21703         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
21704         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
21705         return ret_conv;
21706 }
21707
21708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21709         if (!ptr_is_owned(_res)) return;
21710         void* _res_ptr = untag_ptr(_res);
21711         CHECK_ACCESS(_res_ptr);
21712         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
21713         FREE(untag_ptr(_res));
21714         CResult_ShutdownDecodeErrorZ_free(_res_conv);
21715 }
21716
21717 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
21718         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21719         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
21720         return tag_ptr(ret_conv, true);
21721 }
21722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21723         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
21724         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
21725         return ret_conv;
21726 }
21727
21728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21729         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
21730         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21731         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
21732         return tag_ptr(ret_conv, true);
21733 }
21734
21735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21736         LDKUpdateFailHTLC o_conv;
21737         o_conv.inner = untag_ptr(o);
21738         o_conv.is_owned = ptr_is_owned(o);
21739         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21740         o_conv = UpdateFailHTLC_clone(&o_conv);
21741         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21742         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
21743         return tag_ptr(ret_conv, true);
21744 }
21745
21746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21747         LDKDecodeError e_conv;
21748         e_conv.inner = untag_ptr(e);
21749         e_conv.is_owned = ptr_is_owned(e);
21750         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21751         e_conv = DecodeError_clone(&e_conv);
21752         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21753         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
21754         return tag_ptr(ret_conv, true);
21755 }
21756
21757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21758         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
21759         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
21760         return ret_conv;
21761 }
21762
21763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21764         if (!ptr_is_owned(_res)) return;
21765         void* _res_ptr = untag_ptr(_res);
21766         CHECK_ACCESS(_res_ptr);
21767         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
21768         FREE(untag_ptr(_res));
21769         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
21770 }
21771
21772 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
21773         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21774         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
21775         return tag_ptr(ret_conv, true);
21776 }
21777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21778         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
21779         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
21780         return ret_conv;
21781 }
21782
21783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21784         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
21785         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21786         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
21787         return tag_ptr(ret_conv, true);
21788 }
21789
21790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21791         LDKUpdateFailMalformedHTLC o_conv;
21792         o_conv.inner = untag_ptr(o);
21793         o_conv.is_owned = ptr_is_owned(o);
21794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21795         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
21796         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21797         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
21798         return tag_ptr(ret_conv, true);
21799 }
21800
21801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21802         LDKDecodeError e_conv;
21803         e_conv.inner = untag_ptr(e);
21804         e_conv.is_owned = ptr_is_owned(e);
21805         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21806         e_conv = DecodeError_clone(&e_conv);
21807         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21808         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
21809         return tag_ptr(ret_conv, true);
21810 }
21811
21812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21813         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
21814         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
21815         return ret_conv;
21816 }
21817
21818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21819         if (!ptr_is_owned(_res)) return;
21820         void* _res_ptr = untag_ptr(_res);
21821         CHECK_ACCESS(_res_ptr);
21822         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
21823         FREE(untag_ptr(_res));
21824         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
21825 }
21826
21827 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
21828         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21829         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
21830         return tag_ptr(ret_conv, true);
21831 }
21832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21833         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
21834         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
21835         return ret_conv;
21836 }
21837
21838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21839         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
21840         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21841         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
21842         return tag_ptr(ret_conv, true);
21843 }
21844
21845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21846         LDKUpdateFee o_conv;
21847         o_conv.inner = untag_ptr(o);
21848         o_conv.is_owned = ptr_is_owned(o);
21849         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21850         o_conv = UpdateFee_clone(&o_conv);
21851         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21852         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
21853         return tag_ptr(ret_conv, true);
21854 }
21855
21856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21857         LDKDecodeError e_conv;
21858         e_conv.inner = untag_ptr(e);
21859         e_conv.is_owned = ptr_is_owned(e);
21860         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21861         e_conv = DecodeError_clone(&e_conv);
21862         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21863         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
21864         return tag_ptr(ret_conv, true);
21865 }
21866
21867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21868         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
21869         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
21870         return ret_conv;
21871 }
21872
21873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21874         if (!ptr_is_owned(_res)) return;
21875         void* _res_ptr = untag_ptr(_res);
21876         CHECK_ACCESS(_res_ptr);
21877         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
21878         FREE(untag_ptr(_res));
21879         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
21880 }
21881
21882 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
21883         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21884         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
21885         return tag_ptr(ret_conv, true);
21886 }
21887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21888         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
21889         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
21890         return ret_conv;
21891 }
21892
21893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21894         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
21895         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21896         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
21897         return tag_ptr(ret_conv, true);
21898 }
21899
21900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21901         LDKUpdateFulfillHTLC o_conv;
21902         o_conv.inner = untag_ptr(o);
21903         o_conv.is_owned = ptr_is_owned(o);
21904         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21905         o_conv = UpdateFulfillHTLC_clone(&o_conv);
21906         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21907         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
21908         return tag_ptr(ret_conv, true);
21909 }
21910
21911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21912         LDKDecodeError e_conv;
21913         e_conv.inner = untag_ptr(e);
21914         e_conv.is_owned = ptr_is_owned(e);
21915         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21916         e_conv = DecodeError_clone(&e_conv);
21917         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21918         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
21919         return tag_ptr(ret_conv, true);
21920 }
21921
21922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21923         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
21924         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
21925         return ret_conv;
21926 }
21927
21928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21929         if (!ptr_is_owned(_res)) return;
21930         void* _res_ptr = untag_ptr(_res);
21931         CHECK_ACCESS(_res_ptr);
21932         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
21933         FREE(untag_ptr(_res));
21934         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
21935 }
21936
21937 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
21938         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21939         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
21940         return tag_ptr(ret_conv, true);
21941 }
21942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21943         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
21944         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
21945         return ret_conv;
21946 }
21947
21948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21949         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
21950         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21951         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
21952         return tag_ptr(ret_conv, true);
21953 }
21954
21955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21956         LDKUpdateAddHTLC o_conv;
21957         o_conv.inner = untag_ptr(o);
21958         o_conv.is_owned = ptr_is_owned(o);
21959         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21960         o_conv = UpdateAddHTLC_clone(&o_conv);
21961         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21962         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
21963         return tag_ptr(ret_conv, true);
21964 }
21965
21966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21967         LDKDecodeError e_conv;
21968         e_conv.inner = untag_ptr(e);
21969         e_conv.is_owned = ptr_is_owned(e);
21970         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21971         e_conv = DecodeError_clone(&e_conv);
21972         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21973         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
21974         return tag_ptr(ret_conv, true);
21975 }
21976
21977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21978         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
21979         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
21980         return ret_conv;
21981 }
21982
21983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21984         if (!ptr_is_owned(_res)) return;
21985         void* _res_ptr = untag_ptr(_res);
21986         CHECK_ACCESS(_res_ptr);
21987         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
21988         FREE(untag_ptr(_res));
21989         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
21990 }
21991
21992 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
21993         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21994         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
21995         return tag_ptr(ret_conv, true);
21996 }
21997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21998         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
21999         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
22000         return ret_conv;
22001 }
22002
22003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22004         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
22005         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22006         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
22007         return tag_ptr(ret_conv, true);
22008 }
22009
22010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22011         LDKPing o_conv;
22012         o_conv.inner = untag_ptr(o);
22013         o_conv.is_owned = ptr_is_owned(o);
22014         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22015         o_conv = Ping_clone(&o_conv);
22016         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22017         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
22018         return tag_ptr(ret_conv, true);
22019 }
22020
22021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22022         LDKDecodeError e_conv;
22023         e_conv.inner = untag_ptr(e);
22024         e_conv.is_owned = ptr_is_owned(e);
22025         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22026         e_conv = DecodeError_clone(&e_conv);
22027         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22028         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
22029         return tag_ptr(ret_conv, true);
22030 }
22031
22032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22033         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
22034         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
22035         return ret_conv;
22036 }
22037
22038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22039         if (!ptr_is_owned(_res)) return;
22040         void* _res_ptr = untag_ptr(_res);
22041         CHECK_ACCESS(_res_ptr);
22042         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
22043         FREE(untag_ptr(_res));
22044         CResult_PingDecodeErrorZ_free(_res_conv);
22045 }
22046
22047 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
22048         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22049         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
22050         return tag_ptr(ret_conv, true);
22051 }
22052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22053         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
22054         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
22055         return ret_conv;
22056 }
22057
22058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22059         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
22060         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22061         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
22062         return tag_ptr(ret_conv, true);
22063 }
22064
22065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22066         LDKPong o_conv;
22067         o_conv.inner = untag_ptr(o);
22068         o_conv.is_owned = ptr_is_owned(o);
22069         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22070         o_conv = Pong_clone(&o_conv);
22071         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22072         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
22073         return tag_ptr(ret_conv, true);
22074 }
22075
22076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22077         LDKDecodeError e_conv;
22078         e_conv.inner = untag_ptr(e);
22079         e_conv.is_owned = ptr_is_owned(e);
22080         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22081         e_conv = DecodeError_clone(&e_conv);
22082         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22083         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
22084         return tag_ptr(ret_conv, true);
22085 }
22086
22087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22088         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
22089         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
22090         return ret_conv;
22091 }
22092
22093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22094         if (!ptr_is_owned(_res)) return;
22095         void* _res_ptr = untag_ptr(_res);
22096         CHECK_ACCESS(_res_ptr);
22097         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
22098         FREE(untag_ptr(_res));
22099         CResult_PongDecodeErrorZ_free(_res_conv);
22100 }
22101
22102 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
22103         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22104         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
22105         return tag_ptr(ret_conv, true);
22106 }
22107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22108         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
22109         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
22110         return ret_conv;
22111 }
22112
22113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22114         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
22115         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22116         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
22117         return tag_ptr(ret_conv, true);
22118 }
22119
22120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22121         LDKUnsignedChannelAnnouncement o_conv;
22122         o_conv.inner = untag_ptr(o);
22123         o_conv.is_owned = ptr_is_owned(o);
22124         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22125         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
22126         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22127         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
22128         return tag_ptr(ret_conv, true);
22129 }
22130
22131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22132         LDKDecodeError e_conv;
22133         e_conv.inner = untag_ptr(e);
22134         e_conv.is_owned = ptr_is_owned(e);
22135         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22136         e_conv = DecodeError_clone(&e_conv);
22137         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22138         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
22139         return tag_ptr(ret_conv, true);
22140 }
22141
22142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22143         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
22144         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22145         return ret_conv;
22146 }
22147
22148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22149         if (!ptr_is_owned(_res)) return;
22150         void* _res_ptr = untag_ptr(_res);
22151         CHECK_ACCESS(_res_ptr);
22152         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22153         FREE(untag_ptr(_res));
22154         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
22155 }
22156
22157 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22158         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22159         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
22160         return tag_ptr(ret_conv, true);
22161 }
22162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22163         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
22164         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22165         return ret_conv;
22166 }
22167
22168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22169         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
22170         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22171         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22172         return tag_ptr(ret_conv, true);
22173 }
22174
22175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22176         LDKChannelAnnouncement o_conv;
22177         o_conv.inner = untag_ptr(o);
22178         o_conv.is_owned = ptr_is_owned(o);
22179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22180         o_conv = ChannelAnnouncement_clone(&o_conv);
22181         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22182         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
22183         return tag_ptr(ret_conv, true);
22184 }
22185
22186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22187         LDKDecodeError e_conv;
22188         e_conv.inner = untag_ptr(e);
22189         e_conv.is_owned = ptr_is_owned(e);
22190         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22191         e_conv = DecodeError_clone(&e_conv);
22192         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22193         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
22194         return tag_ptr(ret_conv, true);
22195 }
22196
22197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22198         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
22199         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22200         return ret_conv;
22201 }
22202
22203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22204         if (!ptr_is_owned(_res)) return;
22205         void* _res_ptr = untag_ptr(_res);
22206         CHECK_ACCESS(_res_ptr);
22207         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22208         FREE(untag_ptr(_res));
22209         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
22210 }
22211
22212 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22213         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22214         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
22215         return tag_ptr(ret_conv, true);
22216 }
22217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22218         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
22219         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22220         return ret_conv;
22221 }
22222
22223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22224         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
22225         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22226         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22227         return tag_ptr(ret_conv, true);
22228 }
22229
22230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22231         LDKUnsignedChannelUpdate o_conv;
22232         o_conv.inner = untag_ptr(o);
22233         o_conv.is_owned = ptr_is_owned(o);
22234         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22235         o_conv = UnsignedChannelUpdate_clone(&o_conv);
22236         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22237         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
22238         return tag_ptr(ret_conv, true);
22239 }
22240
22241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22242         LDKDecodeError e_conv;
22243         e_conv.inner = untag_ptr(e);
22244         e_conv.is_owned = ptr_is_owned(e);
22245         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22246         e_conv = DecodeError_clone(&e_conv);
22247         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22248         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
22249         return tag_ptr(ret_conv, true);
22250 }
22251
22252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22253         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
22254         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
22255         return ret_conv;
22256 }
22257
22258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22259         if (!ptr_is_owned(_res)) return;
22260         void* _res_ptr = untag_ptr(_res);
22261         CHECK_ACCESS(_res_ptr);
22262         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
22263         FREE(untag_ptr(_res));
22264         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
22265 }
22266
22267 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22268         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22269         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
22270         return tag_ptr(ret_conv, true);
22271 }
22272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22273         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
22274         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22275         return ret_conv;
22276 }
22277
22278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22279         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
22280         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22281         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
22282         return tag_ptr(ret_conv, true);
22283 }
22284
22285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22286         LDKChannelUpdate o_conv;
22287         o_conv.inner = untag_ptr(o);
22288         o_conv.is_owned = ptr_is_owned(o);
22289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22290         o_conv = ChannelUpdate_clone(&o_conv);
22291         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22292         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
22293         return tag_ptr(ret_conv, true);
22294 }
22295
22296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22297         LDKDecodeError e_conv;
22298         e_conv.inner = untag_ptr(e);
22299         e_conv.is_owned = ptr_is_owned(e);
22300         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22301         e_conv = DecodeError_clone(&e_conv);
22302         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22303         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
22304         return tag_ptr(ret_conv, true);
22305 }
22306
22307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22308         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
22309         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
22310         return ret_conv;
22311 }
22312
22313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22314         if (!ptr_is_owned(_res)) return;
22315         void* _res_ptr = untag_ptr(_res);
22316         CHECK_ACCESS(_res_ptr);
22317         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
22318         FREE(untag_ptr(_res));
22319         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
22320 }
22321
22322 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22323         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22324         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
22325         return tag_ptr(ret_conv, true);
22326 }
22327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22328         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
22329         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22330         return ret_conv;
22331 }
22332
22333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22334         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
22335         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22336         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
22337         return tag_ptr(ret_conv, true);
22338 }
22339
22340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22341         LDKErrorMessage o_conv;
22342         o_conv.inner = untag_ptr(o);
22343         o_conv.is_owned = ptr_is_owned(o);
22344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22345         o_conv = ErrorMessage_clone(&o_conv);
22346         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22347         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
22348         return tag_ptr(ret_conv, true);
22349 }
22350
22351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22352         LDKDecodeError e_conv;
22353         e_conv.inner = untag_ptr(e);
22354         e_conv.is_owned = ptr_is_owned(e);
22355         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22356         e_conv = DecodeError_clone(&e_conv);
22357         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22358         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
22359         return tag_ptr(ret_conv, true);
22360 }
22361
22362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22363         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
22364         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
22365         return ret_conv;
22366 }
22367
22368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22369         if (!ptr_is_owned(_res)) return;
22370         void* _res_ptr = untag_ptr(_res);
22371         CHECK_ACCESS(_res_ptr);
22372         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
22373         FREE(untag_ptr(_res));
22374         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
22375 }
22376
22377 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
22378         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22379         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
22380         return tag_ptr(ret_conv, true);
22381 }
22382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22383         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
22384         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
22385         return ret_conv;
22386 }
22387
22388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22389         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
22390         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22391         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
22392         return tag_ptr(ret_conv, true);
22393 }
22394
22395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22396         LDKWarningMessage o_conv;
22397         o_conv.inner = untag_ptr(o);
22398         o_conv.is_owned = ptr_is_owned(o);
22399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22400         o_conv = WarningMessage_clone(&o_conv);
22401         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22402         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
22403         return tag_ptr(ret_conv, true);
22404 }
22405
22406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22407         LDKDecodeError e_conv;
22408         e_conv.inner = untag_ptr(e);
22409         e_conv.is_owned = ptr_is_owned(e);
22410         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22411         e_conv = DecodeError_clone(&e_conv);
22412         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22413         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
22414         return tag_ptr(ret_conv, true);
22415 }
22416
22417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22418         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
22419         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
22420         return ret_conv;
22421 }
22422
22423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22424         if (!ptr_is_owned(_res)) return;
22425         void* _res_ptr = untag_ptr(_res);
22426         CHECK_ACCESS(_res_ptr);
22427         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
22428         FREE(untag_ptr(_res));
22429         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
22430 }
22431
22432 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
22433         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22434         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
22435         return tag_ptr(ret_conv, true);
22436 }
22437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22438         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
22439         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
22440         return ret_conv;
22441 }
22442
22443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22444         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
22445         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22446         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
22447         return tag_ptr(ret_conv, true);
22448 }
22449
22450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22451         LDKUnsignedNodeAnnouncement o_conv;
22452         o_conv.inner = untag_ptr(o);
22453         o_conv.is_owned = ptr_is_owned(o);
22454         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22455         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
22456         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22457         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
22458         return tag_ptr(ret_conv, true);
22459 }
22460
22461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22462         LDKDecodeError e_conv;
22463         e_conv.inner = untag_ptr(e);
22464         e_conv.is_owned = ptr_is_owned(e);
22465         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22466         e_conv = DecodeError_clone(&e_conv);
22467         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22468         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
22469         return tag_ptr(ret_conv, true);
22470 }
22471
22472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22473         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
22474         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22475         return ret_conv;
22476 }
22477
22478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22479         if (!ptr_is_owned(_res)) return;
22480         void* _res_ptr = untag_ptr(_res);
22481         CHECK_ACCESS(_res_ptr);
22482         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
22483         FREE(untag_ptr(_res));
22484         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
22485 }
22486
22487 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22488         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22489         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
22490         return tag_ptr(ret_conv, true);
22491 }
22492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22493         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
22494         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22495         return ret_conv;
22496 }
22497
22498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22499         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
22500         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22501         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
22502         return tag_ptr(ret_conv, true);
22503 }
22504
22505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22506         LDKNodeAnnouncement o_conv;
22507         o_conv.inner = untag_ptr(o);
22508         o_conv.is_owned = ptr_is_owned(o);
22509         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22510         o_conv = NodeAnnouncement_clone(&o_conv);
22511         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22512         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
22513         return tag_ptr(ret_conv, true);
22514 }
22515
22516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22517         LDKDecodeError e_conv;
22518         e_conv.inner = untag_ptr(e);
22519         e_conv.is_owned = ptr_is_owned(e);
22520         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22521         e_conv = DecodeError_clone(&e_conv);
22522         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22523         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
22524         return tag_ptr(ret_conv, true);
22525 }
22526
22527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22528         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
22529         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22530         return ret_conv;
22531 }
22532
22533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22534         if (!ptr_is_owned(_res)) return;
22535         void* _res_ptr = untag_ptr(_res);
22536         CHECK_ACCESS(_res_ptr);
22537         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
22538         FREE(untag_ptr(_res));
22539         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
22540 }
22541
22542 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22543         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22544         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
22545         return tag_ptr(ret_conv, true);
22546 }
22547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22548         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
22549         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22550         return ret_conv;
22551 }
22552
22553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22554         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
22555         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22556         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
22557         return tag_ptr(ret_conv, true);
22558 }
22559
22560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22561         LDKQueryShortChannelIds o_conv;
22562         o_conv.inner = untag_ptr(o);
22563         o_conv.is_owned = ptr_is_owned(o);
22564         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22565         o_conv = QueryShortChannelIds_clone(&o_conv);
22566         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22567         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
22568         return tag_ptr(ret_conv, true);
22569 }
22570
22571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22572         LDKDecodeError e_conv;
22573         e_conv.inner = untag_ptr(e);
22574         e_conv.is_owned = ptr_is_owned(e);
22575         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22576         e_conv = DecodeError_clone(&e_conv);
22577         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22578         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
22579         return tag_ptr(ret_conv, true);
22580 }
22581
22582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22583         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
22584         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
22585         return ret_conv;
22586 }
22587
22588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22589         if (!ptr_is_owned(_res)) return;
22590         void* _res_ptr = untag_ptr(_res);
22591         CHECK_ACCESS(_res_ptr);
22592         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
22593         FREE(untag_ptr(_res));
22594         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
22595 }
22596
22597 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
22598         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22599         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
22600         return tag_ptr(ret_conv, true);
22601 }
22602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22603         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
22604         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
22605         return ret_conv;
22606 }
22607
22608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22609         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
22610         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22611         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
22612         return tag_ptr(ret_conv, true);
22613 }
22614
22615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22616         LDKReplyShortChannelIdsEnd o_conv;
22617         o_conv.inner = untag_ptr(o);
22618         o_conv.is_owned = ptr_is_owned(o);
22619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22620         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
22621         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22622         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
22623         return tag_ptr(ret_conv, true);
22624 }
22625
22626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22627         LDKDecodeError e_conv;
22628         e_conv.inner = untag_ptr(e);
22629         e_conv.is_owned = ptr_is_owned(e);
22630         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22631         e_conv = DecodeError_clone(&e_conv);
22632         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22633         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
22634         return tag_ptr(ret_conv, true);
22635 }
22636
22637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22638         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
22639         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
22640         return ret_conv;
22641 }
22642
22643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22644         if (!ptr_is_owned(_res)) return;
22645         void* _res_ptr = untag_ptr(_res);
22646         CHECK_ACCESS(_res_ptr);
22647         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
22648         FREE(untag_ptr(_res));
22649         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
22650 }
22651
22652 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
22653         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22654         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
22655         return tag_ptr(ret_conv, true);
22656 }
22657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22658         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
22659         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
22660         return ret_conv;
22661 }
22662
22663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22664         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
22665         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22666         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
22667         return tag_ptr(ret_conv, true);
22668 }
22669
22670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22671         LDKQueryChannelRange o_conv;
22672         o_conv.inner = untag_ptr(o);
22673         o_conv.is_owned = ptr_is_owned(o);
22674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22675         o_conv = QueryChannelRange_clone(&o_conv);
22676         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22677         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
22678         return tag_ptr(ret_conv, true);
22679 }
22680
22681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22682         LDKDecodeError e_conv;
22683         e_conv.inner = untag_ptr(e);
22684         e_conv.is_owned = ptr_is_owned(e);
22685         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22686         e_conv = DecodeError_clone(&e_conv);
22687         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22688         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
22689         return tag_ptr(ret_conv, true);
22690 }
22691
22692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22693         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
22694         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
22695         return ret_conv;
22696 }
22697
22698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22699         if (!ptr_is_owned(_res)) return;
22700         void* _res_ptr = untag_ptr(_res);
22701         CHECK_ACCESS(_res_ptr);
22702         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
22703         FREE(untag_ptr(_res));
22704         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
22705 }
22706
22707 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22708         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22709         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
22710         return tag_ptr(ret_conv, true);
22711 }
22712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22713         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
22714         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22715         return ret_conv;
22716 }
22717
22718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22719         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
22720         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22721         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
22722         return tag_ptr(ret_conv, true);
22723 }
22724
22725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22726         LDKReplyChannelRange o_conv;
22727         o_conv.inner = untag_ptr(o);
22728         o_conv.is_owned = ptr_is_owned(o);
22729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22730         o_conv = ReplyChannelRange_clone(&o_conv);
22731         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22732         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
22733         return tag_ptr(ret_conv, true);
22734 }
22735
22736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22737         LDKDecodeError e_conv;
22738         e_conv.inner = untag_ptr(e);
22739         e_conv.is_owned = ptr_is_owned(e);
22740         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22741         e_conv = DecodeError_clone(&e_conv);
22742         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22743         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
22744         return tag_ptr(ret_conv, true);
22745 }
22746
22747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22748         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
22749         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
22750         return ret_conv;
22751 }
22752
22753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22754         if (!ptr_is_owned(_res)) return;
22755         void* _res_ptr = untag_ptr(_res);
22756         CHECK_ACCESS(_res_ptr);
22757         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
22758         FREE(untag_ptr(_res));
22759         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
22760 }
22761
22762 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22763         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22764         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
22765         return tag_ptr(ret_conv, true);
22766 }
22767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22768         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
22769         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22770         return ret_conv;
22771 }
22772
22773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22774         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
22775         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22776         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
22777         return tag_ptr(ret_conv, true);
22778 }
22779
22780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22781         LDKGossipTimestampFilter o_conv;
22782         o_conv.inner = untag_ptr(o);
22783         o_conv.is_owned = ptr_is_owned(o);
22784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22785         o_conv = GossipTimestampFilter_clone(&o_conv);
22786         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22787         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
22788         return tag_ptr(ret_conv, true);
22789 }
22790
22791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22792         LDKDecodeError e_conv;
22793         e_conv.inner = untag_ptr(e);
22794         e_conv.is_owned = ptr_is_owned(e);
22795         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22796         e_conv = DecodeError_clone(&e_conv);
22797         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22798         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
22799         return tag_ptr(ret_conv, true);
22800 }
22801
22802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22803         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
22804         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
22805         return ret_conv;
22806 }
22807
22808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22809         if (!ptr_is_owned(_res)) return;
22810         void* _res_ptr = untag_ptr(_res);
22811         CHECK_ACCESS(_res_ptr);
22812         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
22813         FREE(untag_ptr(_res));
22814         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
22815 }
22816
22817 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
22818         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22819         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
22820         return tag_ptr(ret_conv, true);
22821 }
22822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22823         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
22824         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
22825         return ret_conv;
22826 }
22827
22828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22829         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
22830         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22831         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
22832         return tag_ptr(ret_conv, true);
22833 }
22834
22835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22836         LDKCVec_PhantomRouteHintsZ _res_constr;
22837         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22838         if (_res_constr.datalen > 0)
22839                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22840         else
22841                 _res_constr.data = NULL;
22842         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22843         for (size_t t = 0; t < _res_constr.datalen; t++) {
22844                 int64_t _res_conv_19 = _res_vals[t];
22845                 LDKPhantomRouteHints _res_conv_19_conv;
22846                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
22847                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
22848                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22849                 _res_constr.data[t] = _res_conv_19_conv;
22850         }
22851         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22852         CVec_PhantomRouteHintsZ_free(_res_constr);
22853 }
22854
22855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22856         LDKInvoice o_conv;
22857         o_conv.inner = untag_ptr(o);
22858         o_conv.is_owned = ptr_is_owned(o);
22859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22860         o_conv = Invoice_clone(&o_conv);
22861         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22862         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22863         return tag_ptr(ret_conv, true);
22864 }
22865
22866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22867         void* e_ptr = untag_ptr(e);
22868         CHECK_ACCESS(e_ptr);
22869         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22870         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
22871         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22872         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22873         return tag_ptr(ret_conv, true);
22874 }
22875
22876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22877         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
22878         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22879         return ret_conv;
22880 }
22881
22882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22883         if (!ptr_is_owned(_res)) return;
22884         void* _res_ptr = untag_ptr(_res);
22885         CHECK_ACCESS(_res_ptr);
22886         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22887         FREE(untag_ptr(_res));
22888         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22889 }
22890
22891 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22892         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22893         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22894         return tag_ptr(ret_conv, true);
22895 }
22896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22897         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
22898         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22899         return ret_conv;
22900 }
22901
22902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22903         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
22904         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22905         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22906         return tag_ptr(ret_conv, true);
22907 }
22908
22909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22910         void* o_ptr = untag_ptr(o);
22911         CHECK_ACCESS(o_ptr);
22912         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
22913         if (o_conv.free == LDKFilter_JCalls_free) {
22914                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22915                 LDKFilter_JCalls_cloned(&o_conv);
22916         }
22917         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22918         *ret_copy = COption_FilterZ_some(o_conv);
22919         int64_t ret_ref = tag_ptr(ret_copy, true);
22920         return ret_ref;
22921 }
22922
22923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
22924         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22925         *ret_copy = COption_FilterZ_none();
22926         int64_t ret_ref = tag_ptr(ret_copy, true);
22927         return ret_ref;
22928 }
22929
22930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22931         if (!ptr_is_owned(_res)) return;
22932         void* _res_ptr = untag_ptr(_res);
22933         CHECK_ACCESS(_res_ptr);
22934         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
22935         FREE(untag_ptr(_res));
22936         COption_FilterZ_free(_res_conv);
22937 }
22938
22939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22940         LDKLockedChannelMonitor o_conv;
22941         o_conv.inner = untag_ptr(o);
22942         o_conv.is_owned = ptr_is_owned(o);
22943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22944         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
22945         
22946         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22947         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
22948         return tag_ptr(ret_conv, true);
22949 }
22950
22951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
22952         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22953         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
22954         return tag_ptr(ret_conv, true);
22955 }
22956
22957 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22958         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
22959         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
22960         return ret_conv;
22961 }
22962
22963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22964         if (!ptr_is_owned(_res)) return;
22965         void* _res_ptr = untag_ptr(_res);
22966         CHECK_ACCESS(_res_ptr);
22967         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
22968         FREE(untag_ptr(_res));
22969         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
22970 }
22971
22972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22973         LDKCVec_OutPointZ _res_constr;
22974         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22975         if (_res_constr.datalen > 0)
22976                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
22977         else
22978                 _res_constr.data = NULL;
22979         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22980         for (size_t k = 0; k < _res_constr.datalen; k++) {
22981                 int64_t _res_conv_10 = _res_vals[k];
22982                 LDKOutPoint _res_conv_10_conv;
22983                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
22984                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
22985                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
22986                 _res_constr.data[k] = _res_conv_10_conv;
22987         }
22988         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22989         CVec_OutPointZ_free(_res_constr);
22990 }
22991
22992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22993         if (!ptr_is_owned(this_ptr)) return;
22994         void* this_ptr_ptr = untag_ptr(this_ptr);
22995         CHECK_ACCESS(this_ptr_ptr);
22996         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
22997         FREE(untag_ptr(this_ptr));
22998         PaymentPurpose_free(this_ptr_conv);
22999 }
23000
23001 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
23002         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23003         *ret_copy = PaymentPurpose_clone(arg);
23004         int64_t ret_ref = tag_ptr(ret_copy, true);
23005         return ret_ref;
23006 }
23007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23008         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
23009         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
23010         return ret_conv;
23011 }
23012
23013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23014         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
23015         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23016         *ret_copy = PaymentPurpose_clone(orig_conv);
23017         int64_t ret_ref = tag_ptr(ret_copy, true);
23018         return ret_ref;
23019 }
23020
23021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
23022         LDKThirtyTwoBytes payment_preimage_ref;
23023         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23024         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23025         LDKThirtyTwoBytes payment_secret_ref;
23026         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
23027         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
23028         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23029         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
23030         int64_t ret_ref = tag_ptr(ret_copy, true);
23031         return ret_ref;
23032 }
23033
23034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
23035         LDKThirtyTwoBytes a_ref;
23036         CHECK((*env)->GetArrayLength(env, a) == 32);
23037         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23038         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23039         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
23040         int64_t ret_ref = tag_ptr(ret_copy, true);
23041         return ret_ref;
23042 }
23043
23044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
23045         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
23046         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
23047         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23048         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23049         CVec_u8Z_free(ret_var);
23050         return ret_arr;
23051 }
23052
23053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23054         LDKu8slice ser_ref;
23055         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23056         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23057         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
23058         *ret_conv = PaymentPurpose_read(ser_ref);
23059         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23060         return tag_ptr(ret_conv, true);
23061 }
23062
23063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23064         if (!ptr_is_owned(this_ptr)) return;
23065         void* this_ptr_ptr = untag_ptr(this_ptr);
23066         CHECK_ACCESS(this_ptr_ptr);
23067         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
23068         FREE(untag_ptr(this_ptr));
23069         ClosureReason_free(this_ptr_conv);
23070 }
23071
23072 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
23073         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23074         *ret_copy = ClosureReason_clone(arg);
23075         int64_t ret_ref = tag_ptr(ret_copy, true);
23076         return ret_ref;
23077 }
23078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23079         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
23080         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
23081         return ret_conv;
23082 }
23083
23084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23085         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
23086         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23087         *ret_copy = ClosureReason_clone(orig_conv);
23088         int64_t ret_ref = tag_ptr(ret_copy, true);
23089         return ret_ref;
23090 }
23091
23092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
23093         LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
23094         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23095         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
23096         int64_t ret_ref = tag_ptr(ret_copy, true);
23097         return ret_ref;
23098 }
23099
23100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
23101         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23102         *ret_copy = ClosureReason_holder_force_closed();
23103         int64_t ret_ref = tag_ptr(ret_copy, true);
23104         return ret_ref;
23105 }
23106
23107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
23108         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23109         *ret_copy = ClosureReason_cooperative_closure();
23110         int64_t ret_ref = tag_ptr(ret_copy, true);
23111         return ret_ref;
23112 }
23113
23114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
23115         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23116         *ret_copy = ClosureReason_commitment_tx_confirmed();
23117         int64_t ret_ref = tag_ptr(ret_copy, true);
23118         return ret_ref;
23119 }
23120
23121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
23122         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23123         *ret_copy = ClosureReason_funding_timed_out();
23124         int64_t ret_ref = tag_ptr(ret_copy, true);
23125         return ret_ref;
23126 }
23127
23128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
23129         LDKStr err_conv = java_to_owned_str(env, err);
23130         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23131         *ret_copy = ClosureReason_processing_error(err_conv);
23132         int64_t ret_ref = tag_ptr(ret_copy, true);
23133         return ret_ref;
23134 }
23135
23136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
23137         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23138         *ret_copy = ClosureReason_disconnected_peer();
23139         int64_t ret_ref = tag_ptr(ret_copy, true);
23140         return ret_ref;
23141 }
23142
23143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
23144         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23145         *ret_copy = ClosureReason_outdated_channel_manager();
23146         int64_t ret_ref = tag_ptr(ret_copy, true);
23147         return ret_ref;
23148 }
23149
23150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
23151         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
23152         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
23153         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23154         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23155         CVec_u8Z_free(ret_var);
23156         return ret_arr;
23157 }
23158
23159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23160         LDKu8slice ser_ref;
23161         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23162         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23163         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
23164         *ret_conv = ClosureReason_read(ser_ref);
23165         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23166         return tag_ptr(ret_conv, true);
23167 }
23168
23169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23170         if (!ptr_is_owned(this_ptr)) return;
23171         void* this_ptr_ptr = untag_ptr(this_ptr);
23172         CHECK_ACCESS(this_ptr_ptr);
23173         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
23174         FREE(untag_ptr(this_ptr));
23175         HTLCDestination_free(this_ptr_conv);
23176 }
23177
23178 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
23179         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23180         *ret_copy = HTLCDestination_clone(arg);
23181         int64_t ret_ref = tag_ptr(ret_copy, true);
23182         return ret_ref;
23183 }
23184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23185         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
23186         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
23187         return ret_conv;
23188 }
23189
23190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23191         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
23192         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23193         *ret_copy = HTLCDestination_clone(orig_conv);
23194         int64_t ret_ref = tag_ptr(ret_copy, true);
23195         return ret_ref;
23196 }
23197
23198 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) {
23199         LDKPublicKey node_id_ref;
23200         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23201         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23202         LDKThirtyTwoBytes channel_id_ref;
23203         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23204         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23205         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23206         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
23207         int64_t ret_ref = tag_ptr(ret_copy, true);
23208         return ret_ref;
23209 }
23210
23211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
23212         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23213         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
23214         int64_t ret_ref = tag_ptr(ret_copy, true);
23215         return ret_ref;
23216 }
23217
23218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
23219         LDKThirtyTwoBytes payment_hash_ref;
23220         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23221         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23222         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23223         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
23224         int64_t ret_ref = tag_ptr(ret_copy, true);
23225         return ret_ref;
23226 }
23227
23228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
23229         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
23230         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
23231         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23232         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23233         CVec_u8Z_free(ret_var);
23234         return ret_arr;
23235 }
23236
23237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23238         LDKu8slice ser_ref;
23239         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23240         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23241         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
23242         *ret_conv = HTLCDestination_read(ser_ref);
23243         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23244         return tag_ptr(ret_conv, true);
23245 }
23246
23247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23248         if (!ptr_is_owned(this_ptr)) return;
23249         void* this_ptr_ptr = untag_ptr(this_ptr);
23250         CHECK_ACCESS(this_ptr_ptr);
23251         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
23252         FREE(untag_ptr(this_ptr));
23253         Event_free(this_ptr_conv);
23254 }
23255
23256 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
23257         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23258         *ret_copy = Event_clone(arg);
23259         int64_t ret_ref = tag_ptr(ret_copy, true);
23260         return ret_ref;
23261 }
23262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23263         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
23264         int64_t ret_conv = Event_clone_ptr(arg_conv);
23265         return ret_conv;
23266 }
23267
23268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23269         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
23270         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23271         *ret_copy = Event_clone(orig_conv);
23272         int64_t ret_ref = tag_ptr(ret_copy, true);
23273         return ret_ref;
23274 }
23275
23276 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) {
23277         LDKThirtyTwoBytes temporary_channel_id_ref;
23278         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23279         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23280         LDKPublicKey counterparty_node_id_ref;
23281         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23282         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23283         LDKCVec_u8Z output_script_ref;
23284         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
23285         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
23286         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
23287         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23288         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
23289         int64_t ret_ref = tag_ptr(ret_copy, true);
23290         return ret_ref;
23291 }
23292
23293 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) {
23294         LDKThirtyTwoBytes payment_hash_ref;
23295         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23296         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23297         void* purpose_ptr = untag_ptr(purpose);
23298         CHECK_ACCESS(purpose_ptr);
23299         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23300         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
23301         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23302         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
23303         int64_t ret_ref = tag_ptr(ret_copy, true);
23304         return ret_ref;
23305 }
23306
23307 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) {
23308         LDKThirtyTwoBytes payment_hash_ref;
23309         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23310         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23311         void* purpose_ptr = untag_ptr(purpose);
23312         CHECK_ACCESS(purpose_ptr);
23313         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23314         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
23315         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23316         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
23317         int64_t ret_ref = tag_ptr(ret_copy, true);
23318         return ret_ref;
23319 }
23320
23321 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) {
23322         LDKThirtyTwoBytes payment_id_ref;
23323         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23324         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23325         LDKThirtyTwoBytes payment_preimage_ref;
23326         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23327         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23328         LDKThirtyTwoBytes payment_hash_ref;
23329         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23330         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23331         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
23332         CHECK_ACCESS(fee_paid_msat_ptr);
23333         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
23334         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
23335         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23336         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
23337         int64_t ret_ref = tag_ptr(ret_copy, true);
23338         return ret_ref;
23339 }
23340
23341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
23342         LDKThirtyTwoBytes payment_id_ref;
23343         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23344         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23345         LDKThirtyTwoBytes payment_hash_ref;
23346         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23347         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23348         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23349         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
23350         int64_t ret_ref = tag_ptr(ret_copy, true);
23351         return ret_ref;
23352 }
23353
23354 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) {
23355         LDKThirtyTwoBytes payment_id_ref;
23356         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23357         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23358         LDKThirtyTwoBytes payment_hash_ref;
23359         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23360         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23361         LDKCVec_RouteHopZ path_constr;
23362         path_constr.datalen = (*env)->GetArrayLength(env, path);
23363         if (path_constr.datalen > 0)
23364                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23365         else
23366                 path_constr.data = NULL;
23367         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23368         for (size_t k = 0; k < path_constr.datalen; k++) {
23369                 int64_t path_conv_10 = path_vals[k];
23370                 LDKRouteHop path_conv_10_conv;
23371                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23372                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23373                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23374                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23375                 path_constr.data[k] = path_conv_10_conv;
23376         }
23377         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23378         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23379         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
23380         int64_t ret_ref = tag_ptr(ret_copy, true);
23381         return ret_ref;
23382 }
23383
23384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) {
23385         LDKThirtyTwoBytes payment_id_ref;
23386         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23387         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23388         LDKThirtyTwoBytes payment_hash_ref;
23389         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23390         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23391         void* network_update_ptr = untag_ptr(network_update);
23392         CHECK_ACCESS(network_update_ptr);
23393         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
23394         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
23395         LDKCVec_RouteHopZ path_constr;
23396         path_constr.datalen = (*env)->GetArrayLength(env, path);
23397         if (path_constr.datalen > 0)
23398                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23399         else
23400                 path_constr.data = NULL;
23401         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23402         for (size_t k = 0; k < path_constr.datalen; k++) {
23403                 int64_t path_conv_10 = path_vals[k];
23404                 LDKRouteHop path_conv_10_conv;
23405                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23406                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23407                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23408                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23409                 path_constr.data[k] = path_conv_10_conv;
23410         }
23411         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23412         void* short_channel_id_ptr = untag_ptr(short_channel_id);
23413         CHECK_ACCESS(short_channel_id_ptr);
23414         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23415         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
23416         LDKRouteParameters retry_conv;
23417         retry_conv.inner = untag_ptr(retry);
23418         retry_conv.is_owned = ptr_is_owned(retry);
23419         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
23420         retry_conv = RouteParameters_clone(&retry_conv);
23421         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23422         *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
23423         int64_t ret_ref = tag_ptr(ret_copy, true);
23424         return ret_ref;
23425 }
23426
23427 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) {
23428         LDKThirtyTwoBytes payment_id_ref;
23429         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23430         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23431         LDKThirtyTwoBytes payment_hash_ref;
23432         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23433         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23434         LDKCVec_RouteHopZ path_constr;
23435         path_constr.datalen = (*env)->GetArrayLength(env, path);
23436         if (path_constr.datalen > 0)
23437                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23438         else
23439                 path_constr.data = NULL;
23440         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23441         for (size_t k = 0; k < path_constr.datalen; k++) {
23442                 int64_t path_conv_10 = path_vals[k];
23443                 LDKRouteHop path_conv_10_conv;
23444                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23445                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23446                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23447                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23448                 path_constr.data[k] = path_conv_10_conv;
23449         }
23450         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23451         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23452         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
23453         int64_t ret_ref = tag_ptr(ret_copy, true);
23454         return ret_ref;
23455 }
23456
23457 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) {
23458         LDKThirtyTwoBytes payment_id_ref;
23459         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23460         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23461         LDKThirtyTwoBytes payment_hash_ref;
23462         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23463         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23464         LDKCVec_RouteHopZ path_constr;
23465         path_constr.datalen = (*env)->GetArrayLength(env, path);
23466         if (path_constr.datalen > 0)
23467                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23468         else
23469                 path_constr.data = NULL;
23470         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23471         for (size_t k = 0; k < path_constr.datalen; k++) {
23472                 int64_t path_conv_10 = path_vals[k];
23473                 LDKRouteHop path_conv_10_conv;
23474                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23475                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23476                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23477                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23478                 path_constr.data[k] = path_conv_10_conv;
23479         }
23480         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23481         void* short_channel_id_ptr = untag_ptr(short_channel_id);
23482         CHECK_ACCESS(short_channel_id_ptr);
23483         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23484         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
23485         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23486         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
23487         int64_t ret_ref = tag_ptr(ret_copy, true);
23488         return ret_ref;
23489 }
23490
23491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
23492         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23493         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
23494         int64_t ret_ref = tag_ptr(ret_copy, true);
23495         return ret_ref;
23496 }
23497
23498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
23499         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
23500         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
23501         if (outputs_constr.datalen > 0)
23502                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23503         else
23504                 outputs_constr.data = NULL;
23505         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
23506         for (size_t b = 0; b < outputs_constr.datalen; b++) {
23507                 int64_t outputs_conv_27 = outputs_vals[b];
23508                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
23509                 CHECK_ACCESS(outputs_conv_27_ptr);
23510                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
23511                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
23512                 outputs_constr.data[b] = outputs_conv_27_conv;
23513         }
23514         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
23515         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23516         *ret_copy = Event_spendable_outputs(outputs_constr);
23517         int64_t ret_ref = tag_ptr(ret_copy, true);
23518         return ret_ref;
23519 }
23520
23521 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) {
23522         LDKThirtyTwoBytes prev_channel_id_ref;
23523         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
23524         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
23525         LDKThirtyTwoBytes next_channel_id_ref;
23526         CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
23527         (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
23528         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
23529         CHECK_ACCESS(fee_earned_msat_ptr);
23530         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
23531         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
23532         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23533         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
23534         int64_t ret_ref = tag_ptr(ret_copy, true);
23535         return ret_ref;
23536 }
23537
23538 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) {
23539         LDKThirtyTwoBytes channel_id_ref;
23540         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23541         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23542         void* reason_ptr = untag_ptr(reason);
23543         CHECK_ACCESS(reason_ptr);
23544         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
23545         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
23546         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23547         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
23548         int64_t ret_ref = tag_ptr(ret_copy, true);
23549         return ret_ref;
23550 }
23551
23552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
23553         LDKThirtyTwoBytes channel_id_ref;
23554         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23555         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23556         LDKTransaction transaction_ref;
23557         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
23558         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
23559         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
23560         transaction_ref.data_is_owned = true;
23561         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23562         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
23563         int64_t ret_ref = tag_ptr(ret_copy, true);
23564         return ret_ref;
23565 }
23566
23567 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) {
23568         LDKThirtyTwoBytes temporary_channel_id_ref;
23569         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23570         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23571         LDKPublicKey counterparty_node_id_ref;
23572         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23573         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23574         LDKChannelTypeFeatures channel_type_conv;
23575         channel_type_conv.inner = untag_ptr(channel_type);
23576         channel_type_conv.is_owned = ptr_is_owned(channel_type);
23577         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
23578         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
23579         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23580         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
23581         int64_t ret_ref = tag_ptr(ret_copy, true);
23582         return ret_ref;
23583 }
23584
23585 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) {
23586         LDKThirtyTwoBytes prev_channel_id_ref;
23587         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
23588         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
23589         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
23590         CHECK_ACCESS(failed_next_destination_ptr);
23591         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
23592         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
23593         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23594         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
23595         int64_t ret_ref = tag_ptr(ret_copy, true);
23596         return ret_ref;
23597 }
23598
23599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
23600         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
23601         LDKCVec_u8Z ret_var = Event_write(obj_conv);
23602         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23603         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23604         CVec_u8Z_free(ret_var);
23605         return ret_arr;
23606 }
23607
23608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23609         LDKu8slice ser_ref;
23610         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23611         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23612         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
23613         *ret_conv = Event_read(ser_ref);
23614         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23615         return tag_ptr(ret_conv, true);
23616 }
23617
23618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23619         if (!ptr_is_owned(this_ptr)) return;
23620         void* this_ptr_ptr = untag_ptr(this_ptr);
23621         CHECK_ACCESS(this_ptr_ptr);
23622         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
23623         FREE(untag_ptr(this_ptr));
23624         MessageSendEvent_free(this_ptr_conv);
23625 }
23626
23627 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
23628         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23629         *ret_copy = MessageSendEvent_clone(arg);
23630         int64_t ret_ref = tag_ptr(ret_copy, true);
23631         return ret_ref;
23632 }
23633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23634         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
23635         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
23636         return ret_conv;
23637 }
23638
23639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23640         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
23641         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23642         *ret_copy = MessageSendEvent_clone(orig_conv);
23643         int64_t ret_ref = tag_ptr(ret_copy, true);
23644         return ret_ref;
23645 }
23646
23647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23648         LDKPublicKey node_id_ref;
23649         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23650         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23651         LDKAcceptChannel msg_conv;
23652         msg_conv.inner = untag_ptr(msg);
23653         msg_conv.is_owned = ptr_is_owned(msg);
23654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23655         msg_conv = AcceptChannel_clone(&msg_conv);
23656         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23657         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
23658         int64_t ret_ref = tag_ptr(ret_copy, true);
23659         return ret_ref;
23660 }
23661
23662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23663         LDKPublicKey node_id_ref;
23664         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23665         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23666         LDKOpenChannel msg_conv;
23667         msg_conv.inner = untag_ptr(msg);
23668         msg_conv.is_owned = ptr_is_owned(msg);
23669         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23670         msg_conv = OpenChannel_clone(&msg_conv);
23671         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23672         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
23673         int64_t ret_ref = tag_ptr(ret_copy, true);
23674         return ret_ref;
23675 }
23676
23677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23678         LDKPublicKey node_id_ref;
23679         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23680         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23681         LDKFundingCreated msg_conv;
23682         msg_conv.inner = untag_ptr(msg);
23683         msg_conv.is_owned = ptr_is_owned(msg);
23684         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23685         msg_conv = FundingCreated_clone(&msg_conv);
23686         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23687         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
23688         int64_t ret_ref = tag_ptr(ret_copy, true);
23689         return ret_ref;
23690 }
23691
23692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23693         LDKPublicKey node_id_ref;
23694         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23695         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23696         LDKFundingSigned msg_conv;
23697         msg_conv.inner = untag_ptr(msg);
23698         msg_conv.is_owned = ptr_is_owned(msg);
23699         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23700         msg_conv = FundingSigned_clone(&msg_conv);
23701         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23702         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
23703         int64_t ret_ref = tag_ptr(ret_copy, true);
23704         return ret_ref;
23705 }
23706
23707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23708         LDKPublicKey node_id_ref;
23709         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23710         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23711         LDKChannelReady msg_conv;
23712         msg_conv.inner = untag_ptr(msg);
23713         msg_conv.is_owned = ptr_is_owned(msg);
23714         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23715         msg_conv = ChannelReady_clone(&msg_conv);
23716         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23717         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
23718         int64_t ret_ref = tag_ptr(ret_copy, true);
23719         return ret_ref;
23720 }
23721
23722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23723         LDKPublicKey node_id_ref;
23724         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23725         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23726         LDKAnnouncementSignatures msg_conv;
23727         msg_conv.inner = untag_ptr(msg);
23728         msg_conv.is_owned = ptr_is_owned(msg);
23729         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23730         msg_conv = AnnouncementSignatures_clone(&msg_conv);
23731         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23732         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
23733         int64_t ret_ref = tag_ptr(ret_copy, true);
23734         return ret_ref;
23735 }
23736
23737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
23738         LDKPublicKey node_id_ref;
23739         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23740         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23741         LDKCommitmentUpdate updates_conv;
23742         updates_conv.inner = untag_ptr(updates);
23743         updates_conv.is_owned = ptr_is_owned(updates);
23744         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23745         updates_conv = CommitmentUpdate_clone(&updates_conv);
23746         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23747         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
23748         int64_t ret_ref = tag_ptr(ret_copy, true);
23749         return ret_ref;
23750 }
23751
23752 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) {
23753         LDKPublicKey node_id_ref;
23754         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23755         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23756         LDKRevokeAndACK msg_conv;
23757         msg_conv.inner = untag_ptr(msg);
23758         msg_conv.is_owned = ptr_is_owned(msg);
23759         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23760         msg_conv = RevokeAndACK_clone(&msg_conv);
23761         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23762         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
23763         int64_t ret_ref = tag_ptr(ret_copy, true);
23764         return ret_ref;
23765 }
23766
23767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23768         LDKPublicKey node_id_ref;
23769         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23770         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23771         LDKClosingSigned msg_conv;
23772         msg_conv.inner = untag_ptr(msg);
23773         msg_conv.is_owned = ptr_is_owned(msg);
23774         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23775         msg_conv = ClosingSigned_clone(&msg_conv);
23776         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23777         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
23778         int64_t ret_ref = tag_ptr(ret_copy, true);
23779         return ret_ref;
23780 }
23781
23782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23783         LDKPublicKey node_id_ref;
23784         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23785         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23786         LDKShutdown msg_conv;
23787         msg_conv.inner = untag_ptr(msg);
23788         msg_conv.is_owned = ptr_is_owned(msg);
23789         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23790         msg_conv = Shutdown_clone(&msg_conv);
23791         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23792         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
23793         int64_t ret_ref = tag_ptr(ret_copy, true);
23794         return ret_ref;
23795 }
23796
23797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23798         LDKPublicKey node_id_ref;
23799         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23800         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23801         LDKChannelReestablish msg_conv;
23802         msg_conv.inner = untag_ptr(msg);
23803         msg_conv.is_owned = ptr_is_owned(msg);
23804         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23805         msg_conv = ChannelReestablish_clone(&msg_conv);
23806         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23807         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
23808         int64_t ret_ref = tag_ptr(ret_copy, true);
23809         return ret_ref;
23810 }
23811
23812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
23813         LDKChannelAnnouncement msg_conv;
23814         msg_conv.inner = untag_ptr(msg);
23815         msg_conv.is_owned = ptr_is_owned(msg);
23816         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23817         msg_conv = ChannelAnnouncement_clone(&msg_conv);
23818         LDKChannelUpdate update_msg_conv;
23819         update_msg_conv.inner = untag_ptr(update_msg);
23820         update_msg_conv.is_owned = ptr_is_owned(update_msg);
23821         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
23822         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
23823         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23824         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
23825         int64_t ret_ref = tag_ptr(ret_copy, true);
23826         return ret_ref;
23827 }
23828
23829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
23830         LDKNodeAnnouncement msg_conv;
23831         msg_conv.inner = untag_ptr(msg);
23832         msg_conv.is_owned = ptr_is_owned(msg);
23833         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23834         msg_conv = NodeAnnouncement_clone(&msg_conv);
23835         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23836         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
23837         int64_t ret_ref = tag_ptr(ret_copy, true);
23838         return ret_ref;
23839 }
23840
23841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
23842         LDKChannelUpdate msg_conv;
23843         msg_conv.inner = untag_ptr(msg);
23844         msg_conv.is_owned = ptr_is_owned(msg);
23845         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23846         msg_conv = ChannelUpdate_clone(&msg_conv);
23847         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23848         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
23849         int64_t ret_ref = tag_ptr(ret_copy, true);
23850         return ret_ref;
23851 }
23852
23853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23854         LDKPublicKey node_id_ref;
23855         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23856         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23857         LDKChannelUpdate msg_conv;
23858         msg_conv.inner = untag_ptr(msg);
23859         msg_conv.is_owned = ptr_is_owned(msg);
23860         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23861         msg_conv = ChannelUpdate_clone(&msg_conv);
23862         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23863         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
23864         int64_t ret_ref = tag_ptr(ret_copy, true);
23865         return ret_ref;
23866 }
23867
23868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
23869         LDKPublicKey node_id_ref;
23870         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23871         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23872         void* action_ptr = untag_ptr(action);
23873         CHECK_ACCESS(action_ptr);
23874         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
23875         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
23876         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23877         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
23878         int64_t ret_ref = tag_ptr(ret_copy, true);
23879         return ret_ref;
23880 }
23881
23882 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) {
23883         LDKPublicKey node_id_ref;
23884         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23885         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23886         LDKQueryChannelRange msg_conv;
23887         msg_conv.inner = untag_ptr(msg);
23888         msg_conv.is_owned = ptr_is_owned(msg);
23889         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23890         msg_conv = QueryChannelRange_clone(&msg_conv);
23891         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23892         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
23893         int64_t ret_ref = tag_ptr(ret_copy, true);
23894         return ret_ref;
23895 }
23896
23897 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) {
23898         LDKPublicKey node_id_ref;
23899         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23900         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23901         LDKQueryShortChannelIds msg_conv;
23902         msg_conv.inner = untag_ptr(msg);
23903         msg_conv.is_owned = ptr_is_owned(msg);
23904         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23905         msg_conv = QueryShortChannelIds_clone(&msg_conv);
23906         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23907         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
23908         int64_t ret_ref = tag_ptr(ret_copy, true);
23909         return ret_ref;
23910 }
23911
23912 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) {
23913         LDKPublicKey node_id_ref;
23914         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23915         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23916         LDKReplyChannelRange msg_conv;
23917         msg_conv.inner = untag_ptr(msg);
23918         msg_conv.is_owned = ptr_is_owned(msg);
23919         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23920         msg_conv = ReplyChannelRange_clone(&msg_conv);
23921         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23922         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
23923         int64_t ret_ref = tag_ptr(ret_copy, true);
23924         return ret_ref;
23925 }
23926
23927 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) {
23928         LDKPublicKey node_id_ref;
23929         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23930         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23931         LDKGossipTimestampFilter msg_conv;
23932         msg_conv.inner = untag_ptr(msg);
23933         msg_conv.is_owned = ptr_is_owned(msg);
23934         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23935         msg_conv = GossipTimestampFilter_clone(&msg_conv);
23936         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23937         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
23938         int64_t ret_ref = tag_ptr(ret_copy, true);
23939         return ret_ref;
23940 }
23941
23942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23943         if (!ptr_is_owned(this_ptr)) return;
23944         void* this_ptr_ptr = untag_ptr(this_ptr);
23945         CHECK_ACCESS(this_ptr_ptr);
23946         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
23947         FREE(untag_ptr(this_ptr));
23948         MessageSendEventsProvider_free(this_ptr_conv);
23949 }
23950
23951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23952         if (!ptr_is_owned(this_ptr)) return;
23953         void* this_ptr_ptr = untag_ptr(this_ptr);
23954         CHECK_ACCESS(this_ptr_ptr);
23955         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
23956         FREE(untag_ptr(this_ptr));
23957         EventsProvider_free(this_ptr_conv);
23958 }
23959
23960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23961         if (!ptr_is_owned(this_ptr)) return;
23962         void* this_ptr_ptr = untag_ptr(this_ptr);
23963         CHECK_ACCESS(this_ptr_ptr);
23964         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
23965         FREE(untag_ptr(this_ptr));
23966         EventHandler_free(this_ptr_conv);
23967 }
23968
23969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23970         if (!ptr_is_owned(this_ptr)) return;
23971         void* this_ptr_ptr = untag_ptr(this_ptr);
23972         CHECK_ACCESS(this_ptr_ptr);
23973         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
23974         FREE(untag_ptr(this_ptr));
23975         APIError_free(this_ptr_conv);
23976 }
23977
23978 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
23979         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23980         *ret_copy = APIError_clone(arg);
23981         int64_t ret_ref = tag_ptr(ret_copy, true);
23982         return ret_ref;
23983 }
23984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23985         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
23986         int64_t ret_conv = APIError_clone_ptr(arg_conv);
23987         return ret_conv;
23988 }
23989
23990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23991         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
23992         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23993         *ret_copy = APIError_clone(orig_conv);
23994         int64_t ret_ref = tag_ptr(ret_copy, true);
23995         return ret_ref;
23996 }
23997
23998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
23999         LDKStr err_conv = java_to_owned_str(env, err);
24000         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24001         *ret_copy = APIError_apimisuse_error(err_conv);
24002         int64_t ret_ref = tag_ptr(ret_copy, true);
24003         return ret_ref;
24004 }
24005
24006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
24007         LDKStr err_conv = java_to_owned_str(env, err);
24008         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24009         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
24010         int64_t ret_ref = tag_ptr(ret_copy, true);
24011         return ret_ref;
24012 }
24013
24014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
24015         LDKStr err_conv = java_to_owned_str(env, err);
24016         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24017         *ret_copy = APIError_route_error(err_conv);
24018         int64_t ret_ref = tag_ptr(ret_copy, true);
24019         return ret_ref;
24020 }
24021
24022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
24023         LDKStr err_conv = java_to_owned_str(env, err);
24024         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24025         *ret_copy = APIError_channel_unavailable(err_conv);
24026         int64_t ret_ref = tag_ptr(ret_copy, true);
24027         return ret_ref;
24028 }
24029
24030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
24031         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24032         *ret_copy = APIError_monitor_update_failed();
24033         int64_t ret_ref = tag_ptr(ret_copy, true);
24034         return ret_ref;
24035 }
24036
24037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
24038         LDKShutdownScript script_conv;
24039         script_conv.inner = untag_ptr(script);
24040         script_conv.is_owned = ptr_is_owned(script);
24041         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
24042         script_conv = ShutdownScript_clone(&script_conv);
24043         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24044         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
24045         int64_t ret_ref = tag_ptr(ret_copy, true);
24046         return ret_ref;
24047 }
24048
24049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24050         LDKBigSize this_obj_conv;
24051         this_obj_conv.inner = untag_ptr(this_obj);
24052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24054         BigSize_free(this_obj_conv);
24055 }
24056
24057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
24058         LDKBigSize this_ptr_conv;
24059         this_ptr_conv.inner = untag_ptr(this_ptr);
24060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24062         this_ptr_conv.is_owned = false;
24063         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
24064         return ret_conv;
24065 }
24066
24067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24068         LDKBigSize this_ptr_conv;
24069         this_ptr_conv.inner = untag_ptr(this_ptr);
24070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24072         this_ptr_conv.is_owned = false;
24073         BigSize_set_a(&this_ptr_conv, val);
24074 }
24075
24076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
24077         LDKBigSize ret_var = BigSize_new(a_arg);
24078         int64_t ret_ref = 0;
24079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24081         return ret_ref;
24082 }
24083
24084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24085         LDKHostname this_obj_conv;
24086         this_obj_conv.inner = untag_ptr(this_obj);
24087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24089         Hostname_free(this_obj_conv);
24090 }
24091
24092 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
24093         LDKHostname ret_var = Hostname_clone(arg);
24094         int64_t ret_ref = 0;
24095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24097         return ret_ref;
24098 }
24099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24100         LDKHostname arg_conv;
24101         arg_conv.inner = untag_ptr(arg);
24102         arg_conv.is_owned = ptr_is_owned(arg);
24103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24104         arg_conv.is_owned = false;
24105         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
24106         return ret_conv;
24107 }
24108
24109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24110         LDKHostname orig_conv;
24111         orig_conv.inner = untag_ptr(orig);
24112         orig_conv.is_owned = ptr_is_owned(orig);
24113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24114         orig_conv.is_owned = false;
24115         LDKHostname ret_var = Hostname_clone(&orig_conv);
24116         int64_t ret_ref = 0;
24117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24119         return ret_ref;
24120 }
24121
24122 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
24123         LDKHostname this_arg_conv;
24124         this_arg_conv.inner = untag_ptr(this_arg);
24125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24127         this_arg_conv.is_owned = false;
24128         int8_t ret_conv = Hostname_len(&this_arg_conv);
24129         return ret_conv;
24130 }
24131
24132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
24133         LDKu8slice msg_ref;
24134         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24135         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24136         unsigned char sk_arr[32];
24137         CHECK((*env)->GetArrayLength(env, sk) == 32);
24138         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
24139         unsigned char (*sk_ref)[32] = &sk_arr;
24140         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
24141         *ret_conv = sign(msg_ref, sk_ref);
24142         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24143         return tag_ptr(ret_conv, true);
24144 }
24145
24146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
24147         LDKu8slice msg_ref;
24148         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24149         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24150         LDKStr sig_conv = java_to_owned_str(env, sig);
24151         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24152         *ret_conv = recover_pk(msg_ref, sig_conv);
24153         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24154         return tag_ptr(ret_conv, true);
24155 }
24156
24157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
24158         LDKu8slice msg_ref;
24159         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24160         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24161         LDKStr sig_conv = java_to_owned_str(env, sig);
24162         LDKPublicKey pk_ref;
24163         CHECK((*env)->GetArrayLength(env, pk) == 33);
24164         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
24165         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
24166         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24167         return ret_conv;
24168 }
24169
24170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
24171         LDKu8slice hrp_bytes_ref;
24172         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
24173         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
24174         LDKCVec_u5Z data_without_signature_constr;
24175         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
24176         if (data_without_signature_constr.datalen > 0)
24177                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
24178         else
24179                 data_without_signature_constr.data = NULL;
24180         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
24181         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
24182                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
24183                 
24184                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
24185         }
24186         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
24187         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
24188         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24189         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24190         CVec_u8Z_free(ret_var);
24191         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
24192         return ret_arr;
24193 }
24194
24195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24196         if (!ptr_is_owned(this_ptr)) return;
24197         void* this_ptr_ptr = untag_ptr(this_ptr);
24198         CHECK_ACCESS(this_ptr_ptr);
24199         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
24200         FREE(untag_ptr(this_ptr));
24201         Persister_free(this_ptr_conv);
24202 }
24203
24204 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24205         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
24206         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
24207         return ret_conv;
24208 }
24209
24210 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
24211         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
24212         return ret_conv;
24213 }
24214
24215 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
24216         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
24217         return ret_conv;
24218 }
24219
24220 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
24221         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
24222         return ret_conv;
24223 }
24224
24225 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
24226         jclass ret_conv = LDKLevel_to_java(env, Level_info());
24227         return ret_conv;
24228 }
24229
24230 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
24231         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
24232         return ret_conv;
24233 }
24234
24235 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
24236         jclass ret_conv = LDKLevel_to_java(env, Level_error());
24237         return ret_conv;
24238 }
24239
24240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24241         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
24242         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
24243         jboolean ret_conv = Level_eq(a_conv, b_conv);
24244         return ret_conv;
24245 }
24246
24247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
24248         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
24249         int64_t ret_conv = Level_hash(o_conv);
24250         return ret_conv;
24251 }
24252
24253 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
24254         jclass ret_conv = LDKLevel_to_java(env, Level_max());
24255         return ret_conv;
24256 }
24257
24258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24259         LDKRecord this_obj_conv;
24260         this_obj_conv.inner = untag_ptr(this_obj);
24261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24263         Record_free(this_obj_conv);
24264 }
24265
24266 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
24267         LDKRecord this_ptr_conv;
24268         this_ptr_conv.inner = untag_ptr(this_ptr);
24269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24271         this_ptr_conv.is_owned = false;
24272         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
24273         return ret_conv;
24274 }
24275
24276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24277         LDKRecord this_ptr_conv;
24278         this_ptr_conv.inner = untag_ptr(this_ptr);
24279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24281         this_ptr_conv.is_owned = false;
24282         LDKLevel val_conv = LDKLevel_from_java(env, val);
24283         Record_set_level(&this_ptr_conv, val_conv);
24284 }
24285
24286 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
24287         LDKRecord this_ptr_conv;
24288         this_ptr_conv.inner = untag_ptr(this_ptr);
24289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24291         this_ptr_conv.is_owned = false;
24292         LDKStr ret_str = Record_get_args(&this_ptr_conv);
24293         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24294         Str_free(ret_str);
24295         return ret_conv;
24296 }
24297
24298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24299         LDKRecord this_ptr_conv;
24300         this_ptr_conv.inner = untag_ptr(this_ptr);
24301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24303         this_ptr_conv.is_owned = false;
24304         LDKStr val_conv = java_to_owned_str(env, val);
24305         Record_set_args(&this_ptr_conv, val_conv);
24306 }
24307
24308 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
24309         LDKRecord this_ptr_conv;
24310         this_ptr_conv.inner = untag_ptr(this_ptr);
24311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24313         this_ptr_conv.is_owned = false;
24314         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
24315         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24316         Str_free(ret_str);
24317         return ret_conv;
24318 }
24319
24320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24321         LDKRecord this_ptr_conv;
24322         this_ptr_conv.inner = untag_ptr(this_ptr);
24323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24325         this_ptr_conv.is_owned = false;
24326         LDKStr val_conv = java_to_owned_str(env, val);
24327         Record_set_module_path(&this_ptr_conv, val_conv);
24328 }
24329
24330 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
24331         LDKRecord this_ptr_conv;
24332         this_ptr_conv.inner = untag_ptr(this_ptr);
24333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24335         this_ptr_conv.is_owned = false;
24336         LDKStr ret_str = Record_get_file(&this_ptr_conv);
24337         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24338         Str_free(ret_str);
24339         return ret_conv;
24340 }
24341
24342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24343         LDKRecord this_ptr_conv;
24344         this_ptr_conv.inner = untag_ptr(this_ptr);
24345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24347         this_ptr_conv.is_owned = false;
24348         LDKStr val_conv = java_to_owned_str(env, val);
24349         Record_set_file(&this_ptr_conv, val_conv);
24350 }
24351
24352 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
24353         LDKRecord this_ptr_conv;
24354         this_ptr_conv.inner = untag_ptr(this_ptr);
24355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24357         this_ptr_conv.is_owned = false;
24358         int32_t ret_conv = Record_get_line(&this_ptr_conv);
24359         return ret_conv;
24360 }
24361
24362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24363         LDKRecord this_ptr_conv;
24364         this_ptr_conv.inner = untag_ptr(this_ptr);
24365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24367         this_ptr_conv.is_owned = false;
24368         Record_set_line(&this_ptr_conv, val);
24369 }
24370
24371 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
24372         LDKRecord ret_var = Record_clone(arg);
24373         int64_t ret_ref = 0;
24374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24376         return ret_ref;
24377 }
24378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24379         LDKRecord arg_conv;
24380         arg_conv.inner = untag_ptr(arg);
24381         arg_conv.is_owned = ptr_is_owned(arg);
24382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24383         arg_conv.is_owned = false;
24384         int64_t ret_conv = Record_clone_ptr(&arg_conv);
24385         return ret_conv;
24386 }
24387
24388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24389         LDKRecord orig_conv;
24390         orig_conv.inner = untag_ptr(orig);
24391         orig_conv.is_owned = ptr_is_owned(orig);
24392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24393         orig_conv.is_owned = false;
24394         LDKRecord ret_var = Record_clone(&orig_conv);
24395         int64_t ret_ref = 0;
24396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24398         return ret_ref;
24399 }
24400
24401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24402         if (!ptr_is_owned(this_ptr)) return;
24403         void* this_ptr_ptr = untag_ptr(this_ptr);
24404         CHECK_ACCESS(this_ptr_ptr);
24405         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
24406         FREE(untag_ptr(this_ptr));
24407         Logger_free(this_ptr_conv);
24408 }
24409
24410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24411         LDKChannelHandshakeConfig this_obj_conv;
24412         this_obj_conv.inner = untag_ptr(this_obj);
24413         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24415         ChannelHandshakeConfig_free(this_obj_conv);
24416 }
24417
24418 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24419         LDKChannelHandshakeConfig this_ptr_conv;
24420         this_ptr_conv.inner = untag_ptr(this_ptr);
24421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24423         this_ptr_conv.is_owned = false;
24424         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
24425         return ret_conv;
24426 }
24427
24428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24429         LDKChannelHandshakeConfig this_ptr_conv;
24430         this_ptr_conv.inner = untag_ptr(this_ptr);
24431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24433         this_ptr_conv.is_owned = false;
24434         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
24435 }
24436
24437 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24438         LDKChannelHandshakeConfig this_ptr_conv;
24439         this_ptr_conv.inner = untag_ptr(this_ptr);
24440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24442         this_ptr_conv.is_owned = false;
24443         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
24444         return ret_conv;
24445 }
24446
24447 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) {
24448         LDKChannelHandshakeConfig this_ptr_conv;
24449         this_ptr_conv.inner = untag_ptr(this_ptr);
24450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24452         this_ptr_conv.is_owned = false;
24453         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
24454 }
24455
24456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24457         LDKChannelHandshakeConfig this_ptr_conv;
24458         this_ptr_conv.inner = untag_ptr(this_ptr);
24459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24461         this_ptr_conv.is_owned = false;
24462         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
24463         return ret_conv;
24464 }
24465
24466 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) {
24467         LDKChannelHandshakeConfig this_ptr_conv;
24468         this_ptr_conv.inner = untag_ptr(this_ptr);
24469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24471         this_ptr_conv.is_owned = false;
24472         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
24473 }
24474
24475 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) {
24476         LDKChannelHandshakeConfig this_ptr_conv;
24477         this_ptr_conv.inner = untag_ptr(this_ptr);
24478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24480         this_ptr_conv.is_owned = false;
24481         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
24482         return ret_conv;
24483 }
24484
24485 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) {
24486         LDKChannelHandshakeConfig this_ptr_conv;
24487         this_ptr_conv.inner = untag_ptr(this_ptr);
24488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24490         this_ptr_conv.is_owned = false;
24491         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
24492 }
24493
24494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
24495         LDKChannelHandshakeConfig this_ptr_conv;
24496         this_ptr_conv.inner = untag_ptr(this_ptr);
24497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24499         this_ptr_conv.is_owned = false;
24500         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
24501         return ret_conv;
24502 }
24503
24504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24505         LDKChannelHandshakeConfig this_ptr_conv;
24506         this_ptr_conv.inner = untag_ptr(this_ptr);
24507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24509         this_ptr_conv.is_owned = false;
24510         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
24511 }
24512
24513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
24514         LDKChannelHandshakeConfig this_ptr_conv;
24515         this_ptr_conv.inner = untag_ptr(this_ptr);
24516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24518         this_ptr_conv.is_owned = false;
24519         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
24520         return ret_conv;
24521 }
24522
24523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24524         LDKChannelHandshakeConfig this_ptr_conv;
24525         this_ptr_conv.inner = untag_ptr(this_ptr);
24526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24528         this_ptr_conv.is_owned = false;
24529         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
24530 }
24531
24532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24533         LDKChannelHandshakeConfig this_ptr_conv;
24534         this_ptr_conv.inner = untag_ptr(this_ptr);
24535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24537         this_ptr_conv.is_owned = false;
24538         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
24539         return ret_conv;
24540 }
24541
24542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24543         LDKChannelHandshakeConfig this_ptr_conv;
24544         this_ptr_conv.inner = untag_ptr(this_ptr);
24545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24547         this_ptr_conv.is_owned = false;
24548         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
24549 }
24550
24551 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) {
24552         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);
24553         int64_t ret_ref = 0;
24554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24556         return ret_ref;
24557 }
24558
24559 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
24560         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
24561         int64_t ret_ref = 0;
24562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24564         return ret_ref;
24565 }
24566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24567         LDKChannelHandshakeConfig arg_conv;
24568         arg_conv.inner = untag_ptr(arg);
24569         arg_conv.is_owned = ptr_is_owned(arg);
24570         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24571         arg_conv.is_owned = false;
24572         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
24573         return ret_conv;
24574 }
24575
24576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24577         LDKChannelHandshakeConfig orig_conv;
24578         orig_conv.inner = untag_ptr(orig);
24579         orig_conv.is_owned = ptr_is_owned(orig);
24580         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24581         orig_conv.is_owned = false;
24582         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
24583         int64_t ret_ref = 0;
24584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24586         return ret_ref;
24587 }
24588
24589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
24590         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
24591         int64_t ret_ref = 0;
24592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24594         return ret_ref;
24595 }
24596
24597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24598         LDKChannelHandshakeLimits this_obj_conv;
24599         this_obj_conv.inner = untag_ptr(this_obj);
24600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24602         ChannelHandshakeLimits_free(this_obj_conv);
24603 }
24604
24605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24606         LDKChannelHandshakeLimits this_ptr_conv;
24607         this_ptr_conv.inner = untag_ptr(this_ptr);
24608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24610         this_ptr_conv.is_owned = false;
24611         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
24612         return ret_conv;
24613 }
24614
24615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24616         LDKChannelHandshakeLimits this_ptr_conv;
24617         this_ptr_conv.inner = untag_ptr(this_ptr);
24618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24620         this_ptr_conv.is_owned = false;
24621         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
24622 }
24623
24624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24625         LDKChannelHandshakeLimits this_ptr_conv;
24626         this_ptr_conv.inner = untag_ptr(this_ptr);
24627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24629         this_ptr_conv.is_owned = false;
24630         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
24631         return ret_conv;
24632 }
24633
24634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24635         LDKChannelHandshakeLimits this_ptr_conv;
24636         this_ptr_conv.inner = untag_ptr(this_ptr);
24637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24639         this_ptr_conv.is_owned = false;
24640         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
24641 }
24642
24643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24644         LDKChannelHandshakeLimits this_ptr_conv;
24645         this_ptr_conv.inner = untag_ptr(this_ptr);
24646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24648         this_ptr_conv.is_owned = false;
24649         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
24650         return ret_conv;
24651 }
24652
24653 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) {
24654         LDKChannelHandshakeLimits this_ptr_conv;
24655         this_ptr_conv.inner = untag_ptr(this_ptr);
24656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24658         this_ptr_conv.is_owned = false;
24659         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
24660 }
24661
24662 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) {
24663         LDKChannelHandshakeLimits this_ptr_conv;
24664         this_ptr_conv.inner = untag_ptr(this_ptr);
24665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24667         this_ptr_conv.is_owned = false;
24668         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
24669         return ret_conv;
24670 }
24671
24672 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) {
24673         LDKChannelHandshakeLimits this_ptr_conv;
24674         this_ptr_conv.inner = untag_ptr(this_ptr);
24675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24677         this_ptr_conv.is_owned = false;
24678         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
24679 }
24680
24681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24682         LDKChannelHandshakeLimits this_ptr_conv;
24683         this_ptr_conv.inner = untag_ptr(this_ptr);
24684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24686         this_ptr_conv.is_owned = false;
24687         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
24688         return ret_conv;
24689 }
24690
24691 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) {
24692         LDKChannelHandshakeLimits this_ptr_conv;
24693         this_ptr_conv.inner = untag_ptr(this_ptr);
24694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24696         this_ptr_conv.is_owned = false;
24697         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
24698 }
24699
24700 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24701         LDKChannelHandshakeLimits this_ptr_conv;
24702         this_ptr_conv.inner = untag_ptr(this_ptr);
24703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24705         this_ptr_conv.is_owned = false;
24706         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
24707         return ret_conv;
24708 }
24709
24710 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) {
24711         LDKChannelHandshakeLimits this_ptr_conv;
24712         this_ptr_conv.inner = untag_ptr(this_ptr);
24713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24715         this_ptr_conv.is_owned = false;
24716         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
24717 }
24718
24719 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24720         LDKChannelHandshakeLimits this_ptr_conv;
24721         this_ptr_conv.inner = untag_ptr(this_ptr);
24722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24724         this_ptr_conv.is_owned = false;
24725         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
24726         return ret_conv;
24727 }
24728
24729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24730         LDKChannelHandshakeLimits this_ptr_conv;
24731         this_ptr_conv.inner = untag_ptr(this_ptr);
24732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24734         this_ptr_conv.is_owned = false;
24735         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
24736 }
24737
24738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
24739         LDKChannelHandshakeLimits this_ptr_conv;
24740         this_ptr_conv.inner = untag_ptr(this_ptr);
24741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24743         this_ptr_conv.is_owned = false;
24744         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
24745         return ret_conv;
24746 }
24747
24748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24749         LDKChannelHandshakeLimits this_ptr_conv;
24750         this_ptr_conv.inner = untag_ptr(this_ptr);
24751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24753         this_ptr_conv.is_owned = false;
24754         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
24755 }
24756
24757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
24758         LDKChannelHandshakeLimits this_ptr_conv;
24759         this_ptr_conv.inner = untag_ptr(this_ptr);
24760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24762         this_ptr_conv.is_owned = false;
24763         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24764         return ret_conv;
24765 }
24766
24767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24768         LDKChannelHandshakeLimits this_ptr_conv;
24769         this_ptr_conv.inner = untag_ptr(this_ptr);
24770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24772         this_ptr_conv.is_owned = false;
24773         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24774 }
24775
24776 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24777         LDKChannelHandshakeLimits this_ptr_conv;
24778         this_ptr_conv.inner = untag_ptr(this_ptr);
24779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24781         this_ptr_conv.is_owned = false;
24782         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24783         return ret_conv;
24784 }
24785
24786 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) {
24787         LDKChannelHandshakeLimits this_ptr_conv;
24788         this_ptr_conv.inner = untag_ptr(this_ptr);
24789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24791         this_ptr_conv.is_owned = false;
24792         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24793 }
24794
24795 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) {
24796         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);
24797         int64_t ret_ref = 0;
24798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24800         return ret_ref;
24801 }
24802
24803 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
24804         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
24805         int64_t ret_ref = 0;
24806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24808         return ret_ref;
24809 }
24810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24811         LDKChannelHandshakeLimits arg_conv;
24812         arg_conv.inner = untag_ptr(arg);
24813         arg_conv.is_owned = ptr_is_owned(arg);
24814         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24815         arg_conv.is_owned = false;
24816         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
24817         return ret_conv;
24818 }
24819
24820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24821         LDKChannelHandshakeLimits orig_conv;
24822         orig_conv.inner = untag_ptr(orig);
24823         orig_conv.is_owned = ptr_is_owned(orig);
24824         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24825         orig_conv.is_owned = false;
24826         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
24827         int64_t ret_ref = 0;
24828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24830         return ret_ref;
24831 }
24832
24833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
24834         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
24835         int64_t ret_ref = 0;
24836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24838         return ret_ref;
24839 }
24840
24841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24842         LDKChannelConfig this_obj_conv;
24843         this_obj_conv.inner = untag_ptr(this_obj);
24844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24846         ChannelConfig_free(this_obj_conv);
24847 }
24848
24849 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24850         LDKChannelConfig this_ptr_conv;
24851         this_ptr_conv.inner = untag_ptr(this_ptr);
24852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24854         this_ptr_conv.is_owned = false;
24855         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
24856         return ret_conv;
24857 }
24858
24859 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) {
24860         LDKChannelConfig this_ptr_conv;
24861         this_ptr_conv.inner = untag_ptr(this_ptr);
24862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24864         this_ptr_conv.is_owned = false;
24865         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
24866 }
24867
24868 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24869         LDKChannelConfig this_ptr_conv;
24870         this_ptr_conv.inner = untag_ptr(this_ptr);
24871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24873         this_ptr_conv.is_owned = false;
24874         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
24875         return ret_conv;
24876 }
24877
24878 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) {
24879         LDKChannelConfig this_ptr_conv;
24880         this_ptr_conv.inner = untag_ptr(this_ptr);
24881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24883         this_ptr_conv.is_owned = false;
24884         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
24885 }
24886
24887 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24888         LDKChannelConfig this_ptr_conv;
24889         this_ptr_conv.inner = untag_ptr(this_ptr);
24890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24892         this_ptr_conv.is_owned = false;
24893         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
24894         return ret_conv;
24895 }
24896
24897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24898         LDKChannelConfig this_ptr_conv;
24899         this_ptr_conv.inner = untag_ptr(this_ptr);
24900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24902         this_ptr_conv.is_owned = false;
24903         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
24904 }
24905
24906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24907         LDKChannelConfig this_ptr_conv;
24908         this_ptr_conv.inner = untag_ptr(this_ptr);
24909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24911         this_ptr_conv.is_owned = false;
24912         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
24913         return ret_conv;
24914 }
24915
24916 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) {
24917         LDKChannelConfig this_ptr_conv;
24918         this_ptr_conv.inner = untag_ptr(this_ptr);
24919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24921         this_ptr_conv.is_owned = false;
24922         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
24923 }
24924
24925 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) {
24926         LDKChannelConfig this_ptr_conv;
24927         this_ptr_conv.inner = untag_ptr(this_ptr);
24928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24930         this_ptr_conv.is_owned = false;
24931         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
24932         return ret_conv;
24933 }
24934
24935 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) {
24936         LDKChannelConfig this_ptr_conv;
24937         this_ptr_conv.inner = untag_ptr(this_ptr);
24938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24940         this_ptr_conv.is_owned = false;
24941         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
24942 }
24943
24944 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) {
24945         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);
24946         int64_t ret_ref = 0;
24947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24949         return ret_ref;
24950 }
24951
24952 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
24953         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
24954         int64_t ret_ref = 0;
24955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24957         return ret_ref;
24958 }
24959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24960         LDKChannelConfig arg_conv;
24961         arg_conv.inner = untag_ptr(arg);
24962         arg_conv.is_owned = ptr_is_owned(arg);
24963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24964         arg_conv.is_owned = false;
24965         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
24966         return ret_conv;
24967 }
24968
24969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24970         LDKChannelConfig orig_conv;
24971         orig_conv.inner = untag_ptr(orig);
24972         orig_conv.is_owned = ptr_is_owned(orig);
24973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24974         orig_conv.is_owned = false;
24975         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24976         int64_t ret_ref = 0;
24977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24979         return ret_ref;
24980 }
24981
24982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
24983         LDKChannelConfig ret_var = ChannelConfig_default();
24984         int64_t ret_ref = 0;
24985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24987         return ret_ref;
24988 }
24989
24990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
24991         LDKChannelConfig obj_conv;
24992         obj_conv.inner = untag_ptr(obj);
24993         obj_conv.is_owned = ptr_is_owned(obj);
24994         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24995         obj_conv.is_owned = false;
24996         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24997         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24998         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24999         CVec_u8Z_free(ret_var);
25000         return ret_arr;
25001 }
25002
25003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25004         LDKu8slice ser_ref;
25005         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25006         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25007         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25008         *ret_conv = ChannelConfig_read(ser_ref);
25009         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25010         return tag_ptr(ret_conv, true);
25011 }
25012
25013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25014         LDKUserConfig this_obj_conv;
25015         this_obj_conv.inner = untag_ptr(this_obj);
25016         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25018         UserConfig_free(this_obj_conv);
25019 }
25020
25021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25022         LDKUserConfig this_ptr_conv;
25023         this_ptr_conv.inner = untag_ptr(this_ptr);
25024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25026         this_ptr_conv.is_owned = false;
25027         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
25028         int64_t ret_ref = 0;
25029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25031         return ret_ref;
25032 }
25033
25034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25035         LDKUserConfig this_ptr_conv;
25036         this_ptr_conv.inner = untag_ptr(this_ptr);
25037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25039         this_ptr_conv.is_owned = false;
25040         LDKChannelHandshakeConfig val_conv;
25041         val_conv.inner = untag_ptr(val);
25042         val_conv.is_owned = ptr_is_owned(val);
25043         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25044         val_conv = ChannelHandshakeConfig_clone(&val_conv);
25045         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
25046 }
25047
25048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
25049         LDKUserConfig this_ptr_conv;
25050         this_ptr_conv.inner = untag_ptr(this_ptr);
25051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25053         this_ptr_conv.is_owned = false;
25054         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
25055         int64_t ret_ref = 0;
25056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25058         return ret_ref;
25059 }
25060
25061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25062         LDKUserConfig this_ptr_conv;
25063         this_ptr_conv.inner = untag_ptr(this_ptr);
25064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25066         this_ptr_conv.is_owned = false;
25067         LDKChannelHandshakeLimits val_conv;
25068         val_conv.inner = untag_ptr(val);
25069         val_conv.is_owned = ptr_is_owned(val);
25070         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25071         val_conv = ChannelHandshakeLimits_clone(&val_conv);
25072         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
25073 }
25074
25075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25076         LDKUserConfig this_ptr_conv;
25077         this_ptr_conv.inner = untag_ptr(this_ptr);
25078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25080         this_ptr_conv.is_owned = false;
25081         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
25082         int64_t ret_ref = 0;
25083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25085         return ret_ref;
25086 }
25087
25088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25089         LDKUserConfig this_ptr_conv;
25090         this_ptr_conv.inner = untag_ptr(this_ptr);
25091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25093         this_ptr_conv.is_owned = false;
25094         LDKChannelConfig val_conv;
25095         val_conv.inner = untag_ptr(val);
25096         val_conv.is_owned = ptr_is_owned(val);
25097         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25098         val_conv = ChannelConfig_clone(&val_conv);
25099         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
25100 }
25101
25102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25103         LDKUserConfig this_ptr_conv;
25104         this_ptr_conv.inner = untag_ptr(this_ptr);
25105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25107         this_ptr_conv.is_owned = false;
25108         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
25109         return ret_conv;
25110 }
25111
25112 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) {
25113         LDKUserConfig this_ptr_conv;
25114         this_ptr_conv.inner = untag_ptr(this_ptr);
25115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25117         this_ptr_conv.is_owned = false;
25118         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
25119 }
25120
25121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25122         LDKUserConfig this_ptr_conv;
25123         this_ptr_conv.inner = untag_ptr(this_ptr);
25124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25126         this_ptr_conv.is_owned = false;
25127         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
25128         return ret_conv;
25129 }
25130
25131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25132         LDKUserConfig this_ptr_conv;
25133         this_ptr_conv.inner = untag_ptr(this_ptr);
25134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25136         this_ptr_conv.is_owned = false;
25137         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
25138 }
25139
25140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25141         LDKUserConfig this_ptr_conv;
25142         this_ptr_conv.inner = untag_ptr(this_ptr);
25143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25145         this_ptr_conv.is_owned = false;
25146         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
25147         return ret_conv;
25148 }
25149
25150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25151         LDKUserConfig this_ptr_conv;
25152         this_ptr_conv.inner = untag_ptr(this_ptr);
25153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25155         this_ptr_conv.is_owned = false;
25156         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
25157 }
25158
25159 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) {
25160         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
25161         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
25162         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
25163         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
25164         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
25165         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
25166         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
25167         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
25168         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
25169         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
25170         LDKChannelConfig channel_config_arg_conv;
25171         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
25172         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
25173         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
25174         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
25175         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);
25176         int64_t ret_ref = 0;
25177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25179         return ret_ref;
25180 }
25181
25182 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
25183         LDKUserConfig ret_var = UserConfig_clone(arg);
25184         int64_t ret_ref = 0;
25185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25187         return ret_ref;
25188 }
25189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25190         LDKUserConfig arg_conv;
25191         arg_conv.inner = untag_ptr(arg);
25192         arg_conv.is_owned = ptr_is_owned(arg);
25193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25194         arg_conv.is_owned = false;
25195         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
25196         return ret_conv;
25197 }
25198
25199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25200         LDKUserConfig orig_conv;
25201         orig_conv.inner = untag_ptr(orig);
25202         orig_conv.is_owned = ptr_is_owned(orig);
25203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25204         orig_conv.is_owned = false;
25205         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
25206         int64_t ret_ref = 0;
25207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25209         return ret_ref;
25210 }
25211
25212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
25213         LDKUserConfig ret_var = UserConfig_default();
25214         int64_t ret_ref = 0;
25215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25217         return ret_ref;
25218 }
25219
25220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25221         LDKBestBlock this_obj_conv;
25222         this_obj_conv.inner = untag_ptr(this_obj);
25223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25225         BestBlock_free(this_obj_conv);
25226 }
25227
25228 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
25229         LDKBestBlock ret_var = BestBlock_clone(arg);
25230         int64_t ret_ref = 0;
25231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25233         return ret_ref;
25234 }
25235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25236         LDKBestBlock arg_conv;
25237         arg_conv.inner = untag_ptr(arg);
25238         arg_conv.is_owned = ptr_is_owned(arg);
25239         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25240         arg_conv.is_owned = false;
25241         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
25242         return ret_conv;
25243 }
25244
25245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25246         LDKBestBlock orig_conv;
25247         orig_conv.inner = untag_ptr(orig);
25248         orig_conv.is_owned = ptr_is_owned(orig);
25249         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25250         orig_conv.is_owned = false;
25251         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
25252         int64_t ret_ref = 0;
25253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25255         return ret_ref;
25256 }
25257
25258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
25259         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
25260         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
25261         int64_t ret_ref = 0;
25262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25264         return ret_ref;
25265 }
25266
25267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
25268         LDKThirtyTwoBytes block_hash_ref;
25269         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
25270         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
25271         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
25272         int64_t ret_ref = 0;
25273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25275         return ret_ref;
25276 }
25277
25278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25279         LDKBestBlock this_arg_conv;
25280         this_arg_conv.inner = untag_ptr(this_arg);
25281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25283         this_arg_conv.is_owned = false;
25284         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25285         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
25286         return ret_arr;
25287 }
25288
25289 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
25290         LDKBestBlock this_arg_conv;
25291         this_arg_conv.inner = untag_ptr(this_arg);
25292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25294         this_arg_conv.is_owned = false;
25295         int32_t ret_conv = BestBlock_height(&this_arg_conv);
25296         return ret_conv;
25297 }
25298
25299 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25300         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
25301         jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
25302         return ret_conv;
25303 }
25304
25305 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
25306         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
25307         return ret_conv;
25308 }
25309
25310 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
25311         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
25312         return ret_conv;
25313 }
25314
25315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25316         if (!ptr_is_owned(this_ptr)) return;
25317         void* this_ptr_ptr = untag_ptr(this_ptr);
25318         CHECK_ACCESS(this_ptr_ptr);
25319         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
25320         FREE(untag_ptr(this_ptr));
25321         Access_free(this_ptr_conv);
25322 }
25323
25324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25325         if (!ptr_is_owned(this_ptr)) return;
25326         void* this_ptr_ptr = untag_ptr(this_ptr);
25327         CHECK_ACCESS(this_ptr_ptr);
25328         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
25329         FREE(untag_ptr(this_ptr));
25330         Listen_free(this_ptr_conv);
25331 }
25332
25333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25334         if (!ptr_is_owned(this_ptr)) return;
25335         void* this_ptr_ptr = untag_ptr(this_ptr);
25336         CHECK_ACCESS(this_ptr_ptr);
25337         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
25338         FREE(untag_ptr(this_ptr));
25339         Confirm_free(this_ptr_conv);
25340 }
25341
25342 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25343         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
25344         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
25345         return ret_conv;
25346 }
25347
25348 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
25349         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
25350         return ret_conv;
25351 }
25352
25353 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
25354         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
25355         return ret_conv;
25356 }
25357
25358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25359         if (!ptr_is_owned(this_ptr)) return;
25360         void* this_ptr_ptr = untag_ptr(this_ptr);
25361         CHECK_ACCESS(this_ptr_ptr);
25362         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
25363         FREE(untag_ptr(this_ptr));
25364         Watch_free(this_ptr_conv);
25365 }
25366
25367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25368         if (!ptr_is_owned(this_ptr)) return;
25369         void* this_ptr_ptr = untag_ptr(this_ptr);
25370         CHECK_ACCESS(this_ptr_ptr);
25371         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
25372         FREE(untag_ptr(this_ptr));
25373         Filter_free(this_ptr_conv);
25374 }
25375
25376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25377         LDKWatchedOutput this_obj_conv;
25378         this_obj_conv.inner = untag_ptr(this_obj);
25379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25381         WatchedOutput_free(this_obj_conv);
25382 }
25383
25384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25385         LDKWatchedOutput this_ptr_conv;
25386         this_ptr_conv.inner = untag_ptr(this_ptr);
25387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25389         this_ptr_conv.is_owned = false;
25390         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25391         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
25392         return ret_arr;
25393 }
25394
25395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25396         LDKWatchedOutput this_ptr_conv;
25397         this_ptr_conv.inner = untag_ptr(this_ptr);
25398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25400         this_ptr_conv.is_owned = false;
25401         LDKThirtyTwoBytes val_ref;
25402         CHECK((*env)->GetArrayLength(env, val) == 32);
25403         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25404         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
25405 }
25406
25407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25408         LDKWatchedOutput this_ptr_conv;
25409         this_ptr_conv.inner = untag_ptr(this_ptr);
25410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25412         this_ptr_conv.is_owned = false;
25413         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
25414         int64_t ret_ref = 0;
25415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25417         return ret_ref;
25418 }
25419
25420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25421         LDKWatchedOutput this_ptr_conv;
25422         this_ptr_conv.inner = untag_ptr(this_ptr);
25423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25425         this_ptr_conv.is_owned = false;
25426         LDKOutPoint val_conv;
25427         val_conv.inner = untag_ptr(val);
25428         val_conv.is_owned = ptr_is_owned(val);
25429         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25430         val_conv = OutPoint_clone(&val_conv);
25431         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
25432 }
25433
25434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25435         LDKWatchedOutput this_ptr_conv;
25436         this_ptr_conv.inner = untag_ptr(this_ptr);
25437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25439         this_ptr_conv.is_owned = false;
25440         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
25441         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25442         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25443         return ret_arr;
25444 }
25445
25446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25447         LDKWatchedOutput this_ptr_conv;
25448         this_ptr_conv.inner = untag_ptr(this_ptr);
25449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25451         this_ptr_conv.is_owned = false;
25452         LDKCVec_u8Z val_ref;
25453         val_ref.datalen = (*env)->GetArrayLength(env, val);
25454         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
25455         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25456         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
25457 }
25458
25459 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) {
25460         LDKThirtyTwoBytes block_hash_arg_ref;
25461         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
25462         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
25463         LDKOutPoint outpoint_arg_conv;
25464         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25465         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25466         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25467         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25468         LDKCVec_u8Z script_pubkey_arg_ref;
25469         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
25470         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
25471         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
25472         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
25473         int64_t ret_ref = 0;
25474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25476         return ret_ref;
25477 }
25478
25479 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
25480         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
25481         int64_t ret_ref = 0;
25482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25484         return ret_ref;
25485 }
25486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25487         LDKWatchedOutput arg_conv;
25488         arg_conv.inner = untag_ptr(arg);
25489         arg_conv.is_owned = ptr_is_owned(arg);
25490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25491         arg_conv.is_owned = false;
25492         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
25493         return ret_conv;
25494 }
25495
25496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25497         LDKWatchedOutput orig_conv;
25498         orig_conv.inner = untag_ptr(orig);
25499         orig_conv.is_owned = ptr_is_owned(orig);
25500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25501         orig_conv.is_owned = false;
25502         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
25503         int64_t ret_ref = 0;
25504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25506         return ret_ref;
25507 }
25508
25509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
25510         LDKWatchedOutput o_conv;
25511         o_conv.inner = untag_ptr(o);
25512         o_conv.is_owned = ptr_is_owned(o);
25513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25514         o_conv.is_owned = false;
25515         int64_t ret_conv = WatchedOutput_hash(&o_conv);
25516         return ret_conv;
25517 }
25518
25519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25520         if (!ptr_is_owned(this_ptr)) return;
25521         void* this_ptr_ptr = untag_ptr(this_ptr);
25522         CHECK_ACCESS(this_ptr_ptr);
25523         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
25524         FREE(untag_ptr(this_ptr));
25525         BroadcasterInterface_free(this_ptr_conv);
25526 }
25527
25528 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25529         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
25530         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
25531         return ret_conv;
25532 }
25533
25534 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
25535         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
25536         return ret_conv;
25537 }
25538
25539 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
25540         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
25541         return ret_conv;
25542 }
25543
25544 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
25545         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
25546         return ret_conv;
25547 }
25548
25549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25550         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
25551         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
25552         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
25553         return ret_conv;
25554 }
25555
25556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25557         if (!ptr_is_owned(this_ptr)) return;
25558         void* this_ptr_ptr = untag_ptr(this_ptr);
25559         CHECK_ACCESS(this_ptr_ptr);
25560         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
25561         FREE(untag_ptr(this_ptr));
25562         FeeEstimator_free(this_ptr_conv);
25563 }
25564
25565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25566         LDKMonitorUpdateId this_obj_conv;
25567         this_obj_conv.inner = untag_ptr(this_obj);
25568         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25570         MonitorUpdateId_free(this_obj_conv);
25571 }
25572
25573 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
25574         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
25575         int64_t ret_ref = 0;
25576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25578         return ret_ref;
25579 }
25580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25581         LDKMonitorUpdateId arg_conv;
25582         arg_conv.inner = untag_ptr(arg);
25583         arg_conv.is_owned = ptr_is_owned(arg);
25584         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25585         arg_conv.is_owned = false;
25586         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
25587         return ret_conv;
25588 }
25589
25590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25591         LDKMonitorUpdateId orig_conv;
25592         orig_conv.inner = untag_ptr(orig);
25593         orig_conv.is_owned = ptr_is_owned(orig);
25594         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25595         orig_conv.is_owned = false;
25596         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
25597         int64_t ret_ref = 0;
25598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25600         return ret_ref;
25601 }
25602
25603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
25604         LDKMonitorUpdateId o_conv;
25605         o_conv.inner = untag_ptr(o);
25606         o_conv.is_owned = ptr_is_owned(o);
25607         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25608         o_conv.is_owned = false;
25609         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
25610         return ret_conv;
25611 }
25612
25613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25614         LDKMonitorUpdateId a_conv;
25615         a_conv.inner = untag_ptr(a);
25616         a_conv.is_owned = ptr_is_owned(a);
25617         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25618         a_conv.is_owned = false;
25619         LDKMonitorUpdateId b_conv;
25620         b_conv.inner = untag_ptr(b);
25621         b_conv.is_owned = ptr_is_owned(b);
25622         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25623         b_conv.is_owned = false;
25624         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
25625         return ret_conv;
25626 }
25627
25628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25629         if (!ptr_is_owned(this_ptr)) return;
25630         void* this_ptr_ptr = untag_ptr(this_ptr);
25631         CHECK_ACCESS(this_ptr_ptr);
25632         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
25633         FREE(untag_ptr(this_ptr));
25634         Persist_free(this_ptr_conv);
25635 }
25636
25637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25638         LDKLockedChannelMonitor this_obj_conv;
25639         this_obj_conv.inner = untag_ptr(this_obj);
25640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25642         LockedChannelMonitor_free(this_obj_conv);
25643 }
25644
25645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25646         LDKChainMonitor this_obj_conv;
25647         this_obj_conv.inner = untag_ptr(this_obj);
25648         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25650         ChainMonitor_free(this_obj_conv);
25651 }
25652
25653 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) {
25654         void* chain_source_ptr = untag_ptr(chain_source);
25655         CHECK_ACCESS(chain_source_ptr);
25656         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
25657         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
25658         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
25659                 // Manually implement clone for Java trait instances
25660                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
25661                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25662                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
25663                 }
25664         }
25665         void* broadcaster_ptr = untag_ptr(broadcaster);
25666         CHECK_ACCESS(broadcaster_ptr);
25667         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25668         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25669                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25670                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25671         }
25672         void* logger_ptr = untag_ptr(logger);
25673         CHECK_ACCESS(logger_ptr);
25674         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25675         if (logger_conv.free == LDKLogger_JCalls_free) {
25676                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25677                 LDKLogger_JCalls_cloned(&logger_conv);
25678         }
25679         void* feeest_ptr = untag_ptr(feeest);
25680         CHECK_ACCESS(feeest_ptr);
25681         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
25682         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25683                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25684                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25685         }
25686         void* persister_ptr = untag_ptr(persister);
25687         CHECK_ACCESS(persister_ptr);
25688         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25689         if (persister_conv.free == LDKPersist_JCalls_free) {
25690                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25691                 LDKPersist_JCalls_cloned(&persister_conv);
25692         }
25693         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25694         int64_t ret_ref = 0;
25695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25697         return ret_ref;
25698 }
25699
25700 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) {
25701         LDKChainMonitor this_arg_conv;
25702         this_arg_conv.inner = untag_ptr(this_arg);
25703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25705         this_arg_conv.is_owned = false;
25706         LDKCVec_ChannelDetailsZ ignored_channels_constr;
25707         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
25708         if (ignored_channels_constr.datalen > 0)
25709                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25710         else
25711                 ignored_channels_constr.data = NULL;
25712         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
25713         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25714                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25715                 LDKChannelDetails ignored_channels_conv_16_conv;
25716                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
25717                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
25718                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25719                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25720                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25721         }
25722         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
25723         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25724         int64_tArray ret_arr = NULL;
25725         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25726         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25727         for (size_t j = 0; j < ret_var.datalen; j++) {
25728                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25729                 *ret_conv_9_copy = ret_var.data[j];
25730                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25731                 ret_arr_ptr[j] = ret_conv_9_ref;
25732         }
25733         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25734         FREE(ret_var.data);
25735         return ret_arr;
25736 }
25737
25738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
25739         LDKChainMonitor this_arg_conv;
25740         this_arg_conv.inner = untag_ptr(this_arg);
25741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25743         this_arg_conv.is_owned = false;
25744         LDKOutPoint funding_txo_conv;
25745         funding_txo_conv.inner = untag_ptr(funding_txo);
25746         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25747         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25748         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25749         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25750         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25751         return tag_ptr(ret_conv, true);
25752 }
25753
25754 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
25755         LDKChainMonitor this_arg_conv;
25756         this_arg_conv.inner = untag_ptr(this_arg);
25757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25759         this_arg_conv.is_owned = false;
25760         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25761         int64_tArray ret_arr = NULL;
25762         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25763         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25764         for (size_t k = 0; k < ret_var.datalen; k++) {
25765                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25766                 int64_t ret_conv_10_ref = 0;
25767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25768                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
25769                 ret_arr_ptr[k] = ret_conv_10_ref;
25770         }
25771         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25772         FREE(ret_var.data);
25773         return ret_arr;
25774 }
25775
25776 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) {
25777         LDKChainMonitor this_arg_conv;
25778         this_arg_conv.inner = untag_ptr(this_arg);
25779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25781         this_arg_conv.is_owned = false;
25782         LDKOutPoint funding_txo_conv;
25783         funding_txo_conv.inner = untag_ptr(funding_txo);
25784         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25785         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25786         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25787         LDKMonitorUpdateId completed_update_id_conv;
25788         completed_update_id_conv.inner = untag_ptr(completed_update_id);
25789         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
25790         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25791         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25792         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25793         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25794         return tag_ptr(ret_conv, true);
25795 }
25796
25797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
25798         LDKChainMonitor this_arg_conv;
25799         this_arg_conv.inner = untag_ptr(this_arg);
25800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25802         this_arg_conv.is_owned = false;
25803         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25804         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
25805         return tag_ptr(ret_ret, true);
25806 }
25807
25808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
25809         LDKChainMonitor this_arg_conv;
25810         this_arg_conv.inner = untag_ptr(this_arg);
25811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25813         this_arg_conv.is_owned = false;
25814         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25815         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
25816         return tag_ptr(ret_ret, true);
25817 }
25818
25819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
25820         LDKChainMonitor this_arg_conv;
25821         this_arg_conv.inner = untag_ptr(this_arg);
25822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25824         this_arg_conv.is_owned = false;
25825         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
25826         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
25827         return tag_ptr(ret_ret, true);
25828 }
25829
25830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25831         LDKChainMonitor this_arg_conv;
25832         this_arg_conv.inner = untag_ptr(this_arg);
25833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25835         this_arg_conv.is_owned = false;
25836         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25837         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
25838         return tag_ptr(ret_ret, true);
25839 }
25840
25841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25842         LDKChannelMonitorUpdate this_obj_conv;
25843         this_obj_conv.inner = untag_ptr(this_obj);
25844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25846         ChannelMonitorUpdate_free(this_obj_conv);
25847 }
25848
25849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
25850         LDKChannelMonitorUpdate this_ptr_conv;
25851         this_ptr_conv.inner = untag_ptr(this_ptr);
25852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25854         this_ptr_conv.is_owned = false;
25855         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
25856         return ret_conv;
25857 }
25858
25859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25860         LDKChannelMonitorUpdate this_ptr_conv;
25861         this_ptr_conv.inner = untag_ptr(this_ptr);
25862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25864         this_ptr_conv.is_owned = false;
25865         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
25866 }
25867
25868 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
25869         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
25870         int64_t ret_ref = 0;
25871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25873         return ret_ref;
25874 }
25875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25876         LDKChannelMonitorUpdate arg_conv;
25877         arg_conv.inner = untag_ptr(arg);
25878         arg_conv.is_owned = ptr_is_owned(arg);
25879         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25880         arg_conv.is_owned = false;
25881         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25882         return ret_conv;
25883 }
25884
25885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25886         LDKChannelMonitorUpdate orig_conv;
25887         orig_conv.inner = untag_ptr(orig);
25888         orig_conv.is_owned = ptr_is_owned(orig);
25889         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25890         orig_conv.is_owned = false;
25891         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25892         int64_t ret_ref = 0;
25893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25895         return ret_ref;
25896 }
25897
25898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25899         LDKChannelMonitorUpdate obj_conv;
25900         obj_conv.inner = untag_ptr(obj);
25901         obj_conv.is_owned = ptr_is_owned(obj);
25902         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25903         obj_conv.is_owned = false;
25904         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25905         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25906         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25907         CVec_u8Z_free(ret_var);
25908         return ret_arr;
25909 }
25910
25911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25912         LDKu8slice ser_ref;
25913         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25914         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25915         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25916         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25917         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25918         return tag_ptr(ret_conv, true);
25919 }
25920
25921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25922         if (!ptr_is_owned(this_ptr)) return;
25923         void* this_ptr_ptr = untag_ptr(this_ptr);
25924         CHECK_ACCESS(this_ptr_ptr);
25925         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25926         FREE(untag_ptr(this_ptr));
25927         MonitorEvent_free(this_ptr_conv);
25928 }
25929
25930 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25931         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25932         *ret_copy = MonitorEvent_clone(arg);
25933         int64_t ret_ref = tag_ptr(ret_copy, true);
25934         return ret_ref;
25935 }
25936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25937         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
25938         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25939         return ret_conv;
25940 }
25941
25942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25943         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
25944         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25945         *ret_copy = MonitorEvent_clone(orig_conv);
25946         int64_t ret_ref = tag_ptr(ret_copy, true);
25947         return ret_ref;
25948 }
25949
25950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
25951         LDKHTLCUpdate a_conv;
25952         a_conv.inner = untag_ptr(a);
25953         a_conv.is_owned = ptr_is_owned(a);
25954         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25955         a_conv = HTLCUpdate_clone(&a_conv);
25956         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25957         *ret_copy = MonitorEvent_htlcevent(a_conv);
25958         int64_t ret_ref = tag_ptr(ret_copy, true);
25959         return ret_ref;
25960 }
25961
25962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
25963         LDKOutPoint a_conv;
25964         a_conv.inner = untag_ptr(a);
25965         a_conv.is_owned = ptr_is_owned(a);
25966         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25967         a_conv = OutPoint_clone(&a_conv);
25968         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25969         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25970         int64_t ret_ref = tag_ptr(ret_copy, true);
25971         return ret_ref;
25972 }
25973
25974 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) {
25975         LDKOutPoint funding_txo_conv;
25976         funding_txo_conv.inner = untag_ptr(funding_txo);
25977         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25978         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25979         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25980         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25981         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
25982         int64_t ret_ref = tag_ptr(ret_copy, true);
25983         return ret_ref;
25984 }
25985
25986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
25987         LDKOutPoint a_conv;
25988         a_conv.inner = untag_ptr(a);
25989         a_conv.is_owned = ptr_is_owned(a);
25990         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25991         a_conv = OutPoint_clone(&a_conv);
25992         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25993         *ret_copy = MonitorEvent_update_failed(a_conv);
25994         int64_t ret_ref = tag_ptr(ret_copy, true);
25995         return ret_ref;
25996 }
25997
25998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
25999         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
26000         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
26001         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26002         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26003         CVec_u8Z_free(ret_var);
26004         return ret_arr;
26005 }
26006
26007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26008         LDKu8slice ser_ref;
26009         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26010         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26011         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26012         *ret_conv = MonitorEvent_read(ser_ref);
26013         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26014         return tag_ptr(ret_conv, true);
26015 }
26016
26017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26018         LDKHTLCUpdate this_obj_conv;
26019         this_obj_conv.inner = untag_ptr(this_obj);
26020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26022         HTLCUpdate_free(this_obj_conv);
26023 }
26024
26025 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
26026         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
26027         int64_t ret_ref = 0;
26028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26030         return ret_ref;
26031 }
26032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26033         LDKHTLCUpdate arg_conv;
26034         arg_conv.inner = untag_ptr(arg);
26035         arg_conv.is_owned = ptr_is_owned(arg);
26036         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26037         arg_conv.is_owned = false;
26038         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
26039         return ret_conv;
26040 }
26041
26042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26043         LDKHTLCUpdate orig_conv;
26044         orig_conv.inner = untag_ptr(orig);
26045         orig_conv.is_owned = ptr_is_owned(orig);
26046         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26047         orig_conv.is_owned = false;
26048         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
26049         int64_t ret_ref = 0;
26050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26052         return ret_ref;
26053 }
26054
26055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26056         LDKHTLCUpdate obj_conv;
26057         obj_conv.inner = untag_ptr(obj);
26058         obj_conv.is_owned = ptr_is_owned(obj);
26059         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26060         obj_conv.is_owned = false;
26061         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
26062         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26063         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26064         CVec_u8Z_free(ret_var);
26065         return ret_arr;
26066 }
26067
26068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26069         LDKu8slice ser_ref;
26070         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26071         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26072         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26073         *ret_conv = HTLCUpdate_read(ser_ref);
26074         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26075         return tag_ptr(ret_conv, true);
26076 }
26077
26078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26079         if (!ptr_is_owned(this_ptr)) return;
26080         void* this_ptr_ptr = untag_ptr(this_ptr);
26081         CHECK_ACCESS(this_ptr_ptr);
26082         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
26083         FREE(untag_ptr(this_ptr));
26084         Balance_free(this_ptr_conv);
26085 }
26086
26087 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
26088         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26089         *ret_copy = Balance_clone(arg);
26090         int64_t ret_ref = tag_ptr(ret_copy, true);
26091         return ret_ref;
26092 }
26093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26094         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
26095         int64_t ret_conv = Balance_clone_ptr(arg_conv);
26096         return ret_conv;
26097 }
26098
26099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26100         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
26101         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26102         *ret_copy = Balance_clone(orig_conv);
26103         int64_t ret_ref = tag_ptr(ret_copy, true);
26104         return ret_ref;
26105 }
26106
26107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
26108         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26109         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
26110         int64_t ret_ref = tag_ptr(ret_copy, true);
26111         return ret_ref;
26112 }
26113
26114 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) {
26115         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26116         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
26117         int64_t ret_ref = tag_ptr(ret_copy, true);
26118         return ret_ref;
26119 }
26120
26121 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) {
26122         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26123         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
26124         int64_t ret_ref = tag_ptr(ret_copy, true);
26125         return ret_ref;
26126 }
26127
26128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
26129         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26130         *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
26131         int64_t ret_ref = tag_ptr(ret_copy, true);
26132         return ret_ref;
26133 }
26134
26135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26136         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
26137         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
26138         jboolean ret_conv = Balance_eq(a_conv, b_conv);
26139         return ret_conv;
26140 }
26141
26142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26143         LDKChannelMonitor this_obj_conv;
26144         this_obj_conv.inner = untag_ptr(this_obj);
26145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26147         ChannelMonitor_free(this_obj_conv);
26148 }
26149
26150 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
26151         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
26152         int64_t ret_ref = 0;
26153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26155         return ret_ref;
26156 }
26157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26158         LDKChannelMonitor arg_conv;
26159         arg_conv.inner = untag_ptr(arg);
26160         arg_conv.is_owned = ptr_is_owned(arg);
26161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26162         arg_conv.is_owned = false;
26163         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
26164         return ret_conv;
26165 }
26166
26167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26168         LDKChannelMonitor orig_conv;
26169         orig_conv.inner = untag_ptr(orig);
26170         orig_conv.is_owned = ptr_is_owned(orig);
26171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26172         orig_conv.is_owned = false;
26173         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
26174         int64_t ret_ref = 0;
26175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26177         return ret_ref;
26178 }
26179
26180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26181         LDKChannelMonitor obj_conv;
26182         obj_conv.inner = untag_ptr(obj);
26183         obj_conv.is_owned = ptr_is_owned(obj);
26184         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26185         obj_conv.is_owned = false;
26186         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
26187         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26188         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26189         CVec_u8Z_free(ret_var);
26190         return ret_arr;
26191 }
26192
26193 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) {
26194         LDKChannelMonitor this_arg_conv;
26195         this_arg_conv.inner = untag_ptr(this_arg);
26196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26198         this_arg_conv.is_owned = false;
26199         LDKChannelMonitorUpdate updates_conv;
26200         updates_conv.inner = untag_ptr(updates);
26201         updates_conv.is_owned = ptr_is_owned(updates);
26202         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
26203         updates_conv.is_owned = false;
26204         void* broadcaster_ptr = untag_ptr(broadcaster);
26205         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
26206         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
26207         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26208         CHECK_ACCESS(fee_estimator_ptr);
26209         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26210         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26211                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26212                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26213         }
26214         void* logger_ptr = untag_ptr(logger);
26215         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
26216         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26217         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
26218         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
26219         return tag_ptr(ret_conv, true);
26220 }
26221
26222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26223         LDKChannelMonitor this_arg_conv;
26224         this_arg_conv.inner = untag_ptr(this_arg);
26225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26227         this_arg_conv.is_owned = false;
26228         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
26229         return ret_conv;
26230 }
26231
26232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
26233         LDKChannelMonitor this_arg_conv;
26234         this_arg_conv.inner = untag_ptr(this_arg);
26235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26237         this_arg_conv.is_owned = false;
26238         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
26239         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
26240         return tag_ptr(ret_conv, true);
26241 }
26242
26243 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26244         LDKChannelMonitor this_arg_conv;
26245         this_arg_conv.inner = untag_ptr(this_arg);
26246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26248         this_arg_conv.is_owned = false;
26249         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
26250         int64_tArray ret_arr = NULL;
26251         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26252         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26253         for (size_t o = 0; o < ret_var.datalen; o++) {
26254                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
26255                 *ret_conv_40_conv = ret_var.data[o];
26256                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
26257         }
26258         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26259         FREE(ret_var.data);
26260         return ret_arr;
26261 }
26262
26263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
26264         LDKChannelMonitor this_arg_conv;
26265         this_arg_conv.inner = untag_ptr(this_arg);
26266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26268         this_arg_conv.is_owned = false;
26269         void* filter_ptr = untag_ptr(filter);
26270         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
26271         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
26272         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
26273 }
26274
26275 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26276         LDKChannelMonitor this_arg_conv;
26277         this_arg_conv.inner = untag_ptr(this_arg);
26278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26280         this_arg_conv.is_owned = false;
26281         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
26282         int64_tArray ret_arr = NULL;
26283         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26284         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26285         for (size_t o = 0; o < ret_var.datalen; o++) {
26286                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26287                 *ret_conv_14_copy = ret_var.data[o];
26288                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
26289                 ret_arr_ptr[o] = ret_conv_14_ref;
26290         }
26291         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26292         FREE(ret_var.data);
26293         return ret_arr;
26294 }
26295
26296 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26297         LDKChannelMonitor this_arg_conv;
26298         this_arg_conv.inner = untag_ptr(this_arg);
26299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26301         this_arg_conv.is_owned = false;
26302         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
26303         int64_tArray ret_arr = NULL;
26304         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26305         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26306         for (size_t h = 0; h < ret_var.datalen; h++) {
26307                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26308                 *ret_conv_7_copy = ret_var.data[h];
26309                 int64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
26310                 ret_arr_ptr[h] = ret_conv_7_ref;
26311         }
26312         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26313         FREE(ret_var.data);
26314         return ret_arr;
26315 }
26316
26317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26318         LDKChannelMonitor this_arg_conv;
26319         this_arg_conv.inner = untag_ptr(this_arg);
26320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26322         this_arg_conv.is_owned = false;
26323         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26324         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
26325         return ret_arr;
26326 }
26327
26328 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) {
26329         LDKChannelMonitor this_arg_conv;
26330         this_arg_conv.inner = untag_ptr(this_arg);
26331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26333         this_arg_conv.is_owned = false;
26334         void* logger_ptr = untag_ptr(logger);
26335         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
26336         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26337         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
26338         jobjectArray ret_arr = NULL;
26339         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26340         ;
26341         for (size_t i = 0; i < ret_var.datalen; i++) {
26342                 LDKTransaction ret_conv_8_var = ret_var.data[i];
26343                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
26344                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
26345                 Transaction_free(ret_conv_8_var);
26346                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26347         }
26348         
26349         FREE(ret_var.data);
26350         return ret_arr;
26351 }
26352
26353 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) {
26354         LDKChannelMonitor this_arg_conv;
26355         this_arg_conv.inner = untag_ptr(this_arg);
26356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26358         this_arg_conv.is_owned = false;
26359         unsigned char header_arr[80];
26360         CHECK((*env)->GetArrayLength(env, header) == 80);
26361         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26362         unsigned char (*header_ref)[80] = &header_arr;
26363         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26364         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26365         if (txdata_constr.datalen > 0)
26366                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26367         else
26368                 txdata_constr.data = NULL;
26369         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26370         for (size_t c = 0; c < txdata_constr.datalen; c++) {
26371                 int64_t txdata_conv_28 = txdata_vals[c];
26372                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
26373                 CHECK_ACCESS(txdata_conv_28_ptr);
26374                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26375                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
26376                 txdata_constr.data[c] = txdata_conv_28_conv;
26377         }
26378         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26379         void* broadcaster_ptr = untag_ptr(broadcaster);
26380         CHECK_ACCESS(broadcaster_ptr);
26381         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26382         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26384                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26385         }
26386         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26387         CHECK_ACCESS(fee_estimator_ptr);
26388         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26389         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26390                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26391                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26392         }
26393         void* logger_ptr = untag_ptr(logger);
26394         CHECK_ACCESS(logger_ptr);
26395         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26396         if (logger_conv.free == LDKLogger_JCalls_free) {
26397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26398                 LDKLogger_JCalls_cloned(&logger_conv);
26399         }
26400         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);
26401         int64_tArray ret_arr = NULL;
26402         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26403         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26404         for (size_t n = 0; n < ret_var.datalen; n++) {
26405                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26406                 *ret_conv_39_conv = ret_var.data[n];
26407                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26408         }
26409         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26410         FREE(ret_var.data);
26411         return ret_arr;
26412 }
26413
26414 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) {
26415         LDKChannelMonitor this_arg_conv;
26416         this_arg_conv.inner = untag_ptr(this_arg);
26417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26419         this_arg_conv.is_owned = false;
26420         unsigned char header_arr[80];
26421         CHECK((*env)->GetArrayLength(env, header) == 80);
26422         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26423         unsigned char (*header_ref)[80] = &header_arr;
26424         void* broadcaster_ptr = untag_ptr(broadcaster);
26425         CHECK_ACCESS(broadcaster_ptr);
26426         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26427         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26428                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26429                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26430         }
26431         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26432         CHECK_ACCESS(fee_estimator_ptr);
26433         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26434         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26435                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26436                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26437         }
26438         void* logger_ptr = untag_ptr(logger);
26439         CHECK_ACCESS(logger_ptr);
26440         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26441         if (logger_conv.free == LDKLogger_JCalls_free) {
26442                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26443                 LDKLogger_JCalls_cloned(&logger_conv);
26444         }
26445         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26446 }
26447
26448 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) {
26449         LDKChannelMonitor this_arg_conv;
26450         this_arg_conv.inner = untag_ptr(this_arg);
26451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26453         this_arg_conv.is_owned = false;
26454         unsigned char header_arr[80];
26455         CHECK((*env)->GetArrayLength(env, header) == 80);
26456         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26457         unsigned char (*header_ref)[80] = &header_arr;
26458         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26459         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26460         if (txdata_constr.datalen > 0)
26461                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26462         else
26463                 txdata_constr.data = NULL;
26464         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26465         for (size_t c = 0; c < txdata_constr.datalen; c++) {
26466                 int64_t txdata_conv_28 = txdata_vals[c];
26467                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
26468                 CHECK_ACCESS(txdata_conv_28_ptr);
26469                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26470                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
26471                 txdata_constr.data[c] = txdata_conv_28_conv;
26472         }
26473         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26474         void* broadcaster_ptr = untag_ptr(broadcaster);
26475         CHECK_ACCESS(broadcaster_ptr);
26476         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26477         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26478                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26479                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26480         }
26481         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26482         CHECK_ACCESS(fee_estimator_ptr);
26483         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26484         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26485                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26486                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26487         }
26488         void* logger_ptr = untag_ptr(logger);
26489         CHECK_ACCESS(logger_ptr);
26490         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26491         if (logger_conv.free == LDKLogger_JCalls_free) {
26492                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26493                 LDKLogger_JCalls_cloned(&logger_conv);
26494         }
26495         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);
26496         int64_tArray ret_arr = NULL;
26497         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26498         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26499         for (size_t n = 0; n < ret_var.datalen; n++) {
26500                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26501                 *ret_conv_39_conv = ret_var.data[n];
26502                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26503         }
26504         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26505         FREE(ret_var.data);
26506         return ret_arr;
26507 }
26508
26509 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) {
26510         LDKChannelMonitor this_arg_conv;
26511         this_arg_conv.inner = untag_ptr(this_arg);
26512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26514         this_arg_conv.is_owned = false;
26515         unsigned char txid_arr[32];
26516         CHECK((*env)->GetArrayLength(env, txid) == 32);
26517         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
26518         unsigned char (*txid_ref)[32] = &txid_arr;
26519         void* broadcaster_ptr = untag_ptr(broadcaster);
26520         CHECK_ACCESS(broadcaster_ptr);
26521         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26522         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26523                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26524                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26525         }
26526         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26527         CHECK_ACCESS(fee_estimator_ptr);
26528         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26529         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26530                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26531                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26532         }
26533         void* logger_ptr = untag_ptr(logger);
26534         CHECK_ACCESS(logger_ptr);
26535         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26536         if (logger_conv.free == LDKLogger_JCalls_free) {
26537                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26538                 LDKLogger_JCalls_cloned(&logger_conv);
26539         }
26540         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
26541 }
26542
26543 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) {
26544         LDKChannelMonitor this_arg_conv;
26545         this_arg_conv.inner = untag_ptr(this_arg);
26546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26548         this_arg_conv.is_owned = false;
26549         unsigned char header_arr[80];
26550         CHECK((*env)->GetArrayLength(env, header) == 80);
26551         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26552         unsigned char (*header_ref)[80] = &header_arr;
26553         void* broadcaster_ptr = untag_ptr(broadcaster);
26554         CHECK_ACCESS(broadcaster_ptr);
26555         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26556         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26557                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26558                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26559         }
26560         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26561         CHECK_ACCESS(fee_estimator_ptr);
26562         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26563         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26565                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26566         }
26567         void* logger_ptr = untag_ptr(logger);
26568         CHECK_ACCESS(logger_ptr);
26569         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26570         if (logger_conv.free == LDKLogger_JCalls_free) {
26571                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26572                 LDKLogger_JCalls_cloned(&logger_conv);
26573         }
26574         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26575         int64_tArray ret_arr = NULL;
26576         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26577         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26578         for (size_t n = 0; n < ret_var.datalen; n++) {
26579                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26580                 *ret_conv_39_conv = ret_var.data[n];
26581                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26582         }
26583         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26584         FREE(ret_var.data);
26585         return ret_arr;
26586 }
26587
26588 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
26589         LDKChannelMonitor this_arg_conv;
26590         this_arg_conv.inner = untag_ptr(this_arg);
26591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26593         this_arg_conv.is_owned = false;
26594         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
26595         jobjectArray ret_arr = NULL;
26596         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26597         ;
26598         for (size_t i = 0; i < ret_var.datalen; i++) {
26599                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
26600                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
26601                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26602         }
26603         
26604         FREE(ret_var.data);
26605         return ret_arr;
26606 }
26607
26608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
26609         LDKChannelMonitor this_arg_conv;
26610         this_arg_conv.inner = untag_ptr(this_arg);
26611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26613         this_arg_conv.is_owned = false;
26614         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
26615         int64_t ret_ref = 0;
26616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26618         return ret_ref;
26619 }
26620
26621 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
26622         LDKChannelMonitor this_arg_conv;
26623         this_arg_conv.inner = untag_ptr(this_arg);
26624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26626         this_arg_conv.is_owned = false;
26627         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26628         int64_tArray ret_arr = NULL;
26629         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26630         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26631         for (size_t j = 0; j < ret_var.datalen; j++) {
26632                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26633                 *ret_conv_9_copy = ret_var.data[j];
26634                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
26635                 ret_arr_ptr[j] = ret_conv_9_ref;
26636         }
26637         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26638         FREE(ret_var.data);
26639         return ret_arr;
26640 }
26641
26642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
26643         LDKu8slice ser_ref;
26644         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26645         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26646         void* arg_ptr = untag_ptr(arg);
26647         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26648         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
26649         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26650         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
26651         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26652         return tag_ptr(ret_conv, true);
26653 }
26654
26655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26656         LDKOutPoint this_obj_conv;
26657         this_obj_conv.inner = untag_ptr(this_obj);
26658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26660         OutPoint_free(this_obj_conv);
26661 }
26662
26663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26664         LDKOutPoint this_ptr_conv;
26665         this_ptr_conv.inner = untag_ptr(this_ptr);
26666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26668         this_ptr_conv.is_owned = false;
26669         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26670         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
26671         return ret_arr;
26672 }
26673
26674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26675         LDKOutPoint this_ptr_conv;
26676         this_ptr_conv.inner = untag_ptr(this_ptr);
26677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26679         this_ptr_conv.is_owned = false;
26680         LDKThirtyTwoBytes val_ref;
26681         CHECK((*env)->GetArrayLength(env, val) == 32);
26682         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26683         OutPoint_set_txid(&this_ptr_conv, val_ref);
26684 }
26685
26686 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
26687         LDKOutPoint this_ptr_conv;
26688         this_ptr_conv.inner = untag_ptr(this_ptr);
26689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26691         this_ptr_conv.is_owned = false;
26692         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
26693         return ret_conv;
26694 }
26695
26696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26697         LDKOutPoint this_ptr_conv;
26698         this_ptr_conv.inner = untag_ptr(this_ptr);
26699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26701         this_ptr_conv.is_owned = false;
26702         OutPoint_set_index(&this_ptr_conv, val);
26703 }
26704
26705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
26706         LDKThirtyTwoBytes txid_arg_ref;
26707         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26708         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26709         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26710         int64_t ret_ref = 0;
26711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26713         return ret_ref;
26714 }
26715
26716 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26717         LDKOutPoint ret_var = OutPoint_clone(arg);
26718         int64_t ret_ref = 0;
26719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26721         return ret_ref;
26722 }
26723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26724         LDKOutPoint arg_conv;
26725         arg_conv.inner = untag_ptr(arg);
26726         arg_conv.is_owned = ptr_is_owned(arg);
26727         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26728         arg_conv.is_owned = false;
26729         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
26730         return ret_conv;
26731 }
26732
26733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26734         LDKOutPoint orig_conv;
26735         orig_conv.inner = untag_ptr(orig);
26736         orig_conv.is_owned = ptr_is_owned(orig);
26737         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26738         orig_conv.is_owned = false;
26739         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26740         int64_t ret_ref = 0;
26741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26743         return ret_ref;
26744 }
26745
26746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26747         LDKOutPoint a_conv;
26748         a_conv.inner = untag_ptr(a);
26749         a_conv.is_owned = ptr_is_owned(a);
26750         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26751         a_conv.is_owned = false;
26752         LDKOutPoint b_conv;
26753         b_conv.inner = untag_ptr(b);
26754         b_conv.is_owned = ptr_is_owned(b);
26755         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26756         b_conv.is_owned = false;
26757         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
26758         return ret_conv;
26759 }
26760
26761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26762         LDKOutPoint o_conv;
26763         o_conv.inner = untag_ptr(o);
26764         o_conv.is_owned = ptr_is_owned(o);
26765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26766         o_conv.is_owned = false;
26767         int64_t ret_conv = OutPoint_hash(&o_conv);
26768         return ret_conv;
26769 }
26770
26771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26772         LDKOutPoint this_arg_conv;
26773         this_arg_conv.inner = untag_ptr(this_arg);
26774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26776         this_arg_conv.is_owned = false;
26777         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26778         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
26779         return ret_arr;
26780 }
26781
26782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
26783         LDKOutPoint obj_conv;
26784         obj_conv.inner = untag_ptr(obj);
26785         obj_conv.is_owned = ptr_is_owned(obj);
26786         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26787         obj_conv.is_owned = false;
26788         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26789         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26790         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26791         CVec_u8Z_free(ret_var);
26792         return ret_arr;
26793 }
26794
26795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26796         LDKu8slice ser_ref;
26797         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26798         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26799         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26800         *ret_conv = OutPoint_read(ser_ref);
26801         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26802         return tag_ptr(ret_conv, true);
26803 }
26804
26805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26806         LDKDelayedPaymentOutputDescriptor this_obj_conv;
26807         this_obj_conv.inner = untag_ptr(this_obj);
26808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26810         DelayedPaymentOutputDescriptor_free(this_obj_conv);
26811 }
26812
26813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26814         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26815         this_ptr_conv.inner = untag_ptr(this_ptr);
26816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26818         this_ptr_conv.is_owned = false;
26819         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26820         int64_t ret_ref = 0;
26821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26823         return ret_ref;
26824 }
26825
26826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26827         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26828         this_ptr_conv.inner = untag_ptr(this_ptr);
26829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26831         this_ptr_conv.is_owned = false;
26832         LDKOutPoint val_conv;
26833         val_conv.inner = untag_ptr(val);
26834         val_conv.is_owned = ptr_is_owned(val);
26835         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26836         val_conv = OutPoint_clone(&val_conv);
26837         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26838 }
26839
26840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26841         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26842         this_ptr_conv.inner = untag_ptr(this_ptr);
26843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26845         this_ptr_conv.is_owned = false;
26846         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26847         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
26848         return ret_arr;
26849 }
26850
26851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26852         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26853         this_ptr_conv.inner = untag_ptr(this_ptr);
26854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26856         this_ptr_conv.is_owned = false;
26857         LDKPublicKey val_ref;
26858         CHECK((*env)->GetArrayLength(env, val) == 33);
26859         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26860         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26861 }
26862
26863 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26864         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26865         this_ptr_conv.inner = untag_ptr(this_ptr);
26866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26868         this_ptr_conv.is_owned = false;
26869         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26870         return ret_conv;
26871 }
26872
26873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26874         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26875         this_ptr_conv.inner = untag_ptr(this_ptr);
26876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26878         this_ptr_conv.is_owned = false;
26879         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26880 }
26881
26882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
26883         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26884         this_ptr_conv.inner = untag_ptr(this_ptr);
26885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26887         this_ptr_conv.is_owned = false;
26888         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26889         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
26890         return tag_ptr(ret_ref, true);
26891 }
26892
26893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26894         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26895         this_ptr_conv.inner = untag_ptr(this_ptr);
26896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26898         this_ptr_conv.is_owned = false;
26899         void* val_ptr = untag_ptr(val);
26900         CHECK_ACCESS(val_ptr);
26901         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26902         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26903         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26904 }
26905
26906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26907         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26908         this_ptr_conv.inner = untag_ptr(this_ptr);
26909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26911         this_ptr_conv.is_owned = false;
26912         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26913         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
26914         return ret_arr;
26915 }
26916
26917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26918         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26919         this_ptr_conv.inner = untag_ptr(this_ptr);
26920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26922         this_ptr_conv.is_owned = false;
26923         LDKPublicKey val_ref;
26924         CHECK((*env)->GetArrayLength(env, val) == 33);
26925         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26926         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26927 }
26928
26929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26930         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26931         this_ptr_conv.inner = untag_ptr(this_ptr);
26932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26934         this_ptr_conv.is_owned = false;
26935         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26936         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26937         return ret_arr;
26938 }
26939
26940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26941         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26942         this_ptr_conv.inner = untag_ptr(this_ptr);
26943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26945         this_ptr_conv.is_owned = false;
26946         LDKThirtyTwoBytes val_ref;
26947         CHECK((*env)->GetArrayLength(env, val) == 32);
26948         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26949         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26950 }
26951
26952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26953         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26954         this_ptr_conv.inner = untag_ptr(this_ptr);
26955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26957         this_ptr_conv.is_owned = false;
26958         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26959         return ret_conv;
26960 }
26961
26962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26963         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26964         this_ptr_conv.inner = untag_ptr(this_ptr);
26965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26967         this_ptr_conv.is_owned = false;
26968         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26969 }
26970
26971 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) {
26972         LDKOutPoint outpoint_arg_conv;
26973         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26974         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26975         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26976         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26977         LDKPublicKey per_commitment_point_arg_ref;
26978         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
26979         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
26980         void* output_arg_ptr = untag_ptr(output_arg);
26981         CHECK_ACCESS(output_arg_ptr);
26982         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26983         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26984         LDKPublicKey revocation_pubkey_arg_ref;
26985         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
26986         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
26987         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26988         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26989         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26990         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);
26991         int64_t ret_ref = 0;
26992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26994         return ret_ref;
26995 }
26996
26997 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26998         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26999         int64_t ret_ref = 0;
27000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27002         return ret_ref;
27003 }
27004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27005         LDKDelayedPaymentOutputDescriptor arg_conv;
27006         arg_conv.inner = untag_ptr(arg);
27007         arg_conv.is_owned = ptr_is_owned(arg);
27008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27009         arg_conv.is_owned = false;
27010         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
27011         return ret_conv;
27012 }
27013
27014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27015         LDKDelayedPaymentOutputDescriptor orig_conv;
27016         orig_conv.inner = untag_ptr(orig);
27017         orig_conv.is_owned = ptr_is_owned(orig);
27018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27019         orig_conv.is_owned = false;
27020         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
27021         int64_t ret_ref = 0;
27022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27024         return ret_ref;
27025 }
27026
27027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27028         LDKDelayedPaymentOutputDescriptor obj_conv;
27029         obj_conv.inner = untag_ptr(obj);
27030         obj_conv.is_owned = ptr_is_owned(obj);
27031         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27032         obj_conv.is_owned = false;
27033         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
27034         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27035         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27036         CVec_u8Z_free(ret_var);
27037         return ret_arr;
27038 }
27039
27040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27041         LDKu8slice ser_ref;
27042         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27043         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27044         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
27045         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
27046         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27047         return tag_ptr(ret_conv, true);
27048 }
27049
27050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27051         LDKStaticPaymentOutputDescriptor this_obj_conv;
27052         this_obj_conv.inner = untag_ptr(this_obj);
27053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27055         StaticPaymentOutputDescriptor_free(this_obj_conv);
27056 }
27057
27058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27059         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27060         this_ptr_conv.inner = untag_ptr(this_ptr);
27061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27063         this_ptr_conv.is_owned = false;
27064         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
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 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27072         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27073         this_ptr_conv.inner = untag_ptr(this_ptr);
27074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27076         this_ptr_conv.is_owned = false;
27077         LDKOutPoint val_conv;
27078         val_conv.inner = untag_ptr(val);
27079         val_conv.is_owned = ptr_is_owned(val);
27080         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27081         val_conv = OutPoint_clone(&val_conv);
27082         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27083 }
27084
27085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
27086         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27087         this_ptr_conv.inner = untag_ptr(this_ptr);
27088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27090         this_ptr_conv.is_owned = false;
27091         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
27092         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
27093         return tag_ptr(ret_ref, true);
27094 }
27095
27096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27097         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27098         this_ptr_conv.inner = untag_ptr(this_ptr);
27099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27101         this_ptr_conv.is_owned = false;
27102         void* val_ptr = untag_ptr(val);
27103         CHECK_ACCESS(val_ptr);
27104         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27105         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
27106         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27107 }
27108
27109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27110         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27111         this_ptr_conv.inner = untag_ptr(this_ptr);
27112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27114         this_ptr_conv.is_owned = false;
27115         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27116         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27117         return ret_arr;
27118 }
27119
27120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27121         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27122         this_ptr_conv.inner = untag_ptr(this_ptr);
27123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27125         this_ptr_conv.is_owned = false;
27126         LDKThirtyTwoBytes val_ref;
27127         CHECK((*env)->GetArrayLength(env, val) == 32);
27128         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27129         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27130 }
27131
27132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27133         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27134         this_ptr_conv.inner = untag_ptr(this_ptr);
27135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27137         this_ptr_conv.is_owned = false;
27138         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27139         return ret_conv;
27140 }
27141
27142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27143         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27144         this_ptr_conv.inner = untag_ptr(this_ptr);
27145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27147         this_ptr_conv.is_owned = false;
27148         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27149 }
27150
27151 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) {
27152         LDKOutPoint outpoint_arg_conv;
27153         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
27154         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
27155         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27156         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27157         void* output_arg_ptr = untag_ptr(output_arg);
27158         CHECK_ACCESS(output_arg_ptr);
27159         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27160         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
27161         LDKThirtyTwoBytes channel_keys_id_arg_ref;
27162         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27163         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27164         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
27165         int64_t ret_ref = 0;
27166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27168         return ret_ref;
27169 }
27170
27171 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
27172         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
27173         int64_t ret_ref = 0;
27174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27176         return ret_ref;
27177 }
27178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27179         LDKStaticPaymentOutputDescriptor arg_conv;
27180         arg_conv.inner = untag_ptr(arg);
27181         arg_conv.is_owned = ptr_is_owned(arg);
27182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27183         arg_conv.is_owned = false;
27184         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
27185         return ret_conv;
27186 }
27187
27188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27189         LDKStaticPaymentOutputDescriptor orig_conv;
27190         orig_conv.inner = untag_ptr(orig);
27191         orig_conv.is_owned = ptr_is_owned(orig);
27192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27193         orig_conv.is_owned = false;
27194         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
27195         int64_t ret_ref = 0;
27196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27198         return ret_ref;
27199 }
27200
27201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27202         LDKStaticPaymentOutputDescriptor obj_conv;
27203         obj_conv.inner = untag_ptr(obj);
27204         obj_conv.is_owned = ptr_is_owned(obj);
27205         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27206         obj_conv.is_owned = false;
27207         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
27208         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27209         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27210         CVec_u8Z_free(ret_var);
27211         return ret_arr;
27212 }
27213
27214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27215         LDKu8slice ser_ref;
27216         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27217         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27218         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
27219         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
27220         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27221         return tag_ptr(ret_conv, true);
27222 }
27223
27224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27225         if (!ptr_is_owned(this_ptr)) return;
27226         void* this_ptr_ptr = untag_ptr(this_ptr);
27227         CHECK_ACCESS(this_ptr_ptr);
27228         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
27229         FREE(untag_ptr(this_ptr));
27230         SpendableOutputDescriptor_free(this_ptr_conv);
27231 }
27232
27233 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
27234         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27235         *ret_copy = SpendableOutputDescriptor_clone(arg);
27236         int64_t ret_ref = tag_ptr(ret_copy, true);
27237         return ret_ref;
27238 }
27239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27240         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
27241         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
27242         return ret_conv;
27243 }
27244
27245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27246         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
27247         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27248         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
27249         int64_t ret_ref = tag_ptr(ret_copy, true);
27250         return ret_ref;
27251 }
27252
27253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
27254         LDKOutPoint outpoint_conv;
27255         outpoint_conv.inner = untag_ptr(outpoint);
27256         outpoint_conv.is_owned = ptr_is_owned(outpoint);
27257         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
27258         outpoint_conv = OutPoint_clone(&outpoint_conv);
27259         void* output_ptr = untag_ptr(output);
27260         CHECK_ACCESS(output_ptr);
27261         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
27262         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
27263         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27264         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
27265         int64_t ret_ref = tag_ptr(ret_copy, true);
27266         return ret_ref;
27267 }
27268
27269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27270         LDKDelayedPaymentOutputDescriptor a_conv;
27271         a_conv.inner = untag_ptr(a);
27272         a_conv.is_owned = ptr_is_owned(a);
27273         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27274         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
27275         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27276         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
27277         int64_t ret_ref = tag_ptr(ret_copy, true);
27278         return ret_ref;
27279 }
27280
27281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27282         LDKStaticPaymentOutputDescriptor a_conv;
27283         a_conv.inner = untag_ptr(a);
27284         a_conv.is_owned = ptr_is_owned(a);
27285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27286         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
27287         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27288         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
27289         int64_t ret_ref = tag_ptr(ret_copy, true);
27290         return ret_ref;
27291 }
27292
27293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27294         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
27295         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
27296         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27297         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27298         CVec_u8Z_free(ret_var);
27299         return ret_arr;
27300 }
27301
27302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27303         LDKu8slice ser_ref;
27304         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27305         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27306         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
27307         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
27308         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27309         return tag_ptr(ret_conv, true);
27310 }
27311
27312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27313         if (!ptr_is_owned(this_ptr)) return;
27314         void* this_ptr_ptr = untag_ptr(this_ptr);
27315         CHECK_ACCESS(this_ptr_ptr);
27316         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
27317         FREE(untag_ptr(this_ptr));
27318         BaseSign_free(this_ptr_conv);
27319 }
27320
27321 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
27322         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27323         *ret_ret = Sign_clone(arg);
27324         return tag_ptr(ret_ret, true);
27325 }
27326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27327         void* arg_ptr = untag_ptr(arg);
27328         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
27329         LDKSign* arg_conv = (LDKSign*)arg_ptr;
27330         int64_t ret_conv = Sign_clone_ptr(arg_conv);
27331         return ret_conv;
27332 }
27333
27334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27335         void* orig_ptr = untag_ptr(orig);
27336         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
27337         LDKSign* orig_conv = (LDKSign*)orig_ptr;
27338         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27339         *ret_ret = Sign_clone(orig_conv);
27340         return tag_ptr(ret_ret, true);
27341 }
27342
27343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27344         if (!ptr_is_owned(this_ptr)) return;
27345         void* this_ptr_ptr = untag_ptr(this_ptr);
27346         CHECK_ACCESS(this_ptr_ptr);
27347         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
27348         FREE(untag_ptr(this_ptr));
27349         Sign_free(this_ptr_conv);
27350 }
27351
27352 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27353         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
27354         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
27355         return ret_conv;
27356 }
27357
27358 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
27359         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
27360         return ret_conv;
27361 }
27362
27363 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
27364         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
27365         return ret_conv;
27366 }
27367
27368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27369         if (!ptr_is_owned(this_ptr)) return;
27370         void* this_ptr_ptr = untag_ptr(this_ptr);
27371         CHECK_ACCESS(this_ptr_ptr);
27372         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
27373         FREE(untag_ptr(this_ptr));
27374         KeysInterface_free(this_ptr_conv);
27375 }
27376
27377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27378         LDKInMemorySigner this_obj_conv;
27379         this_obj_conv.inner = untag_ptr(this_obj);
27380         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27382         InMemorySigner_free(this_obj_conv);
27383 }
27384
27385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27386         LDKInMemorySigner this_ptr_conv;
27387         this_ptr_conv.inner = untag_ptr(this_ptr);
27388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27390         this_ptr_conv.is_owned = false;
27391         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27392         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
27393         return ret_arr;
27394 }
27395
27396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27397         LDKInMemorySigner this_ptr_conv;
27398         this_ptr_conv.inner = untag_ptr(this_ptr);
27399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27401         this_ptr_conv.is_owned = false;
27402         LDKSecretKey val_ref;
27403         CHECK((*env)->GetArrayLength(env, val) == 32);
27404         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27405         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
27406 }
27407
27408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27409         LDKInMemorySigner this_ptr_conv;
27410         this_ptr_conv.inner = untag_ptr(this_ptr);
27411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27413         this_ptr_conv.is_owned = false;
27414         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27415         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
27416         return ret_arr;
27417 }
27418
27419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27420         LDKInMemorySigner this_ptr_conv;
27421         this_ptr_conv.inner = untag_ptr(this_ptr);
27422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27424         this_ptr_conv.is_owned = false;
27425         LDKSecretKey val_ref;
27426         CHECK((*env)->GetArrayLength(env, val) == 32);
27427         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27428         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
27429 }
27430
27431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27432         LDKInMemorySigner this_ptr_conv;
27433         this_ptr_conv.inner = untag_ptr(this_ptr);
27434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27436         this_ptr_conv.is_owned = false;
27437         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27438         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
27439         return ret_arr;
27440 }
27441
27442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27443         LDKInMemorySigner this_ptr_conv;
27444         this_ptr_conv.inner = untag_ptr(this_ptr);
27445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27447         this_ptr_conv.is_owned = false;
27448         LDKSecretKey val_ref;
27449         CHECK((*env)->GetArrayLength(env, val) == 32);
27450         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27451         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
27452 }
27453
27454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27455         LDKInMemorySigner this_ptr_conv;
27456         this_ptr_conv.inner = untag_ptr(this_ptr);
27457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27459         this_ptr_conv.is_owned = false;
27460         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27461         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
27462         return ret_arr;
27463 }
27464
27465 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) {
27466         LDKInMemorySigner this_ptr_conv;
27467         this_ptr_conv.inner = untag_ptr(this_ptr);
27468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27470         this_ptr_conv.is_owned = false;
27471         LDKSecretKey val_ref;
27472         CHECK((*env)->GetArrayLength(env, val) == 32);
27473         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27474         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
27475 }
27476
27477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27478         LDKInMemorySigner this_ptr_conv;
27479         this_ptr_conv.inner = untag_ptr(this_ptr);
27480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27482         this_ptr_conv.is_owned = false;
27483         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27484         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
27485         return ret_arr;
27486 }
27487
27488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27489         LDKInMemorySigner this_ptr_conv;
27490         this_ptr_conv.inner = untag_ptr(this_ptr);
27491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27493         this_ptr_conv.is_owned = false;
27494         LDKSecretKey val_ref;
27495         CHECK((*env)->GetArrayLength(env, val) == 32);
27496         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27497         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
27498 }
27499
27500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
27501         LDKInMemorySigner this_ptr_conv;
27502         this_ptr_conv.inner = untag_ptr(this_ptr);
27503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27505         this_ptr_conv.is_owned = false;
27506         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27507         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
27508         return ret_arr;
27509 }
27510
27511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27512         LDKInMemorySigner this_ptr_conv;
27513         this_ptr_conv.inner = untag_ptr(this_ptr);
27514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27516         this_ptr_conv.is_owned = false;
27517         LDKThirtyTwoBytes val_ref;
27518         CHECK((*env)->GetArrayLength(env, val) == 32);
27519         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27520         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
27521 }
27522
27523 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
27524         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
27525         int64_t ret_ref = 0;
27526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27528         return ret_ref;
27529 }
27530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27531         LDKInMemorySigner arg_conv;
27532         arg_conv.inner = untag_ptr(arg);
27533         arg_conv.is_owned = ptr_is_owned(arg);
27534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27535         arg_conv.is_owned = false;
27536         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
27537         return ret_conv;
27538 }
27539
27540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27541         LDKInMemorySigner orig_conv;
27542         orig_conv.inner = untag_ptr(orig);
27543         orig_conv.is_owned = ptr_is_owned(orig);
27544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27545         orig_conv.is_owned = false;
27546         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
27547         int64_t ret_ref = 0;
27548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27550         return ret_ref;
27551 }
27552
27553 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) {
27554         LDKSecretKey node_secret_ref;
27555         CHECK((*env)->GetArrayLength(env, node_secret) == 32);
27556         (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
27557         LDKSecretKey funding_key_ref;
27558         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
27559         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
27560         LDKSecretKey revocation_base_key_ref;
27561         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
27562         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
27563         LDKSecretKey payment_key_ref;
27564         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
27565         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
27566         LDKSecretKey delayed_payment_base_key_ref;
27567         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
27568         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
27569         LDKSecretKey htlc_base_key_ref;
27570         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
27571         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
27572         LDKThirtyTwoBytes commitment_seed_ref;
27573         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
27574         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
27575         LDKThirtyTwoBytes channel_keys_id_ref;
27576         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
27577         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
27578         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);
27579         int64_t ret_ref = 0;
27580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27582         return ret_ref;
27583 }
27584
27585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
27586         LDKInMemorySigner this_arg_conv;
27587         this_arg_conv.inner = untag_ptr(this_arg);
27588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27590         this_arg_conv.is_owned = false;
27591         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
27592         int64_t ret_ref = 0;
27593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27595         return ret_ref;
27596 }
27597
27598 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27599         LDKInMemorySigner this_arg_conv;
27600         this_arg_conv.inner = untag_ptr(this_arg);
27601         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27603         this_arg_conv.is_owned = false;
27604         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27605         return ret_conv;
27606 }
27607
27608 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27609         LDKInMemorySigner this_arg_conv;
27610         this_arg_conv.inner = untag_ptr(this_arg);
27611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27613         this_arg_conv.is_owned = false;
27614         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27615         return ret_conv;
27616 }
27617
27618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
27619         LDKInMemorySigner this_arg_conv;
27620         this_arg_conv.inner = untag_ptr(this_arg);
27621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27623         this_arg_conv.is_owned = false;
27624         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
27625         return ret_conv;
27626 }
27627
27628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
27629         LDKInMemorySigner this_arg_conv;
27630         this_arg_conv.inner = untag_ptr(this_arg);
27631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27633         this_arg_conv.is_owned = false;
27634         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27635         int64_t ret_ref = 0;
27636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27638         return ret_ref;
27639 }
27640
27641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
27642         LDKInMemorySigner this_arg_conv;
27643         this_arg_conv.inner = untag_ptr(this_arg);
27644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27646         this_arg_conv.is_owned = false;
27647         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27648         int64_t ret_ref = 0;
27649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27651         return ret_ref;
27652 }
27653
27654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
27655         LDKInMemorySigner this_arg_conv;
27656         this_arg_conv.inner = untag_ptr(this_arg);
27657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27659         this_arg_conv.is_owned = false;
27660         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
27661         return ret_conv;
27662 }
27663
27664 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) {
27665         LDKInMemorySigner this_arg_conv;
27666         this_arg_conv.inner = untag_ptr(this_arg);
27667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27669         this_arg_conv.is_owned = false;
27670         LDKTransaction spend_tx_ref;
27671         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27672         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27673         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27674         spend_tx_ref.data_is_owned = true;
27675         LDKStaticPaymentOutputDescriptor descriptor_conv;
27676         descriptor_conv.inner = untag_ptr(descriptor);
27677         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27678         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27679         descriptor_conv.is_owned = false;
27680         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27681         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27682         return tag_ptr(ret_conv, true);
27683 }
27684
27685 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) {
27686         LDKInMemorySigner this_arg_conv;
27687         this_arg_conv.inner = untag_ptr(this_arg);
27688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27690         this_arg_conv.is_owned = false;
27691         LDKTransaction spend_tx_ref;
27692         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27693         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27694         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27695         spend_tx_ref.data_is_owned = true;
27696         LDKDelayedPaymentOutputDescriptor descriptor_conv;
27697         descriptor_conv.inner = untag_ptr(descriptor);
27698         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27699         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27700         descriptor_conv.is_owned = false;
27701         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27702         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27703         return tag_ptr(ret_conv, true);
27704 }
27705
27706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
27707         LDKInMemorySigner this_arg_conv;
27708         this_arg_conv.inner = untag_ptr(this_arg);
27709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27711         this_arg_conv.is_owned = false;
27712         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
27713         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
27714         return tag_ptr(ret_ret, true);
27715 }
27716
27717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
27718         LDKInMemorySigner this_arg_conv;
27719         this_arg_conv.inner = untag_ptr(this_arg);
27720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27722         this_arg_conv.is_owned = false;
27723         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27724         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
27725         return tag_ptr(ret_ret, true);
27726 }
27727
27728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
27729         LDKInMemorySigner obj_conv;
27730         obj_conv.inner = untag_ptr(obj);
27731         obj_conv.is_owned = ptr_is_owned(obj);
27732         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27733         obj_conv.is_owned = false;
27734         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27735         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27736         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27737         CVec_u8Z_free(ret_var);
27738         return ret_arr;
27739 }
27740
27741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
27742         LDKu8slice ser_ref;
27743         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27744         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27745         LDKSecretKey arg_ref;
27746         CHECK((*env)->GetArrayLength(env, arg) == 32);
27747         (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
27748         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27749         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
27750         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27751         return tag_ptr(ret_conv, true);
27752 }
27753
27754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27755         LDKKeysManager this_obj_conv;
27756         this_obj_conv.inner = untag_ptr(this_obj);
27757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27759         KeysManager_free(this_obj_conv);
27760 }
27761
27762 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) {
27763         unsigned char seed_arr[32];
27764         CHECK((*env)->GetArrayLength(env, seed) == 32);
27765         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27766         unsigned char (*seed_ref)[32] = &seed_arr;
27767         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27768         int64_t ret_ref = 0;
27769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27771         return ret_ref;
27772 }
27773
27774 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) {
27775         LDKKeysManager this_arg_conv;
27776         this_arg_conv.inner = untag_ptr(this_arg);
27777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27779         this_arg_conv.is_owned = false;
27780         unsigned char params_arr[32];
27781         CHECK((*env)->GetArrayLength(env, params) == 32);
27782         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27783         unsigned char (*params_ref)[32] = &params_arr;
27784         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27785         int64_t ret_ref = 0;
27786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27788         return ret_ref;
27789 }
27790
27791 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) {
27792         LDKKeysManager this_arg_conv;
27793         this_arg_conv.inner = untag_ptr(this_arg);
27794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27796         this_arg_conv.is_owned = false;
27797         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27798         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27799         if (descriptors_constr.datalen > 0)
27800                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27801         else
27802                 descriptors_constr.data = NULL;
27803         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27804         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27805                 int64_t descriptors_conv_27 = descriptors_vals[b];
27806                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27807                 CHECK_ACCESS(descriptors_conv_27_ptr);
27808                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27809                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27810                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27811         }
27812         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27813         LDKCVec_TxOutZ outputs_constr;
27814         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27815         if (outputs_constr.datalen > 0)
27816                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27817         else
27818                 outputs_constr.data = NULL;
27819         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27820         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27821                 int64_t outputs_conv_7 = outputs_vals[h];
27822                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27823                 CHECK_ACCESS(outputs_conv_7_ptr);
27824                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27825                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27826                 outputs_constr.data[h] = outputs_conv_7_conv;
27827         }
27828         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27829         LDKCVec_u8Z change_destination_script_ref;
27830         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27831         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27832         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27833         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27834         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27835         return tag_ptr(ret_conv, true);
27836 }
27837
27838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27839         LDKKeysManager this_arg_conv;
27840         this_arg_conv.inner = untag_ptr(this_arg);
27841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27843         this_arg_conv.is_owned = false;
27844         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27845         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
27846         return tag_ptr(ret_ret, true);
27847 }
27848
27849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27850         LDKPhantomKeysManager this_obj_conv;
27851         this_obj_conv.inner = untag_ptr(this_obj);
27852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27854         PhantomKeysManager_free(this_obj_conv);
27855 }
27856
27857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27858         LDKPhantomKeysManager this_arg_conv;
27859         this_arg_conv.inner = untag_ptr(this_arg);
27860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27862         this_arg_conv.is_owned = false;
27863         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27864         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
27865         return tag_ptr(ret_ret, true);
27866 }
27867
27868 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) {
27869         unsigned char seed_arr[32];
27870         CHECK((*env)->GetArrayLength(env, seed) == 32);
27871         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27872         unsigned char (*seed_ref)[32] = &seed_arr;
27873         unsigned char cross_node_seed_arr[32];
27874         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
27875         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
27876         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27877         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27878         int64_t ret_ref = 0;
27879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27881         return ret_ref;
27882 }
27883
27884 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) {
27885         LDKPhantomKeysManager this_arg_conv;
27886         this_arg_conv.inner = untag_ptr(this_arg);
27887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27889         this_arg_conv.is_owned = false;
27890         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27891         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27892         if (descriptors_constr.datalen > 0)
27893                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27894         else
27895                 descriptors_constr.data = NULL;
27896         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27897         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27898                 int64_t descriptors_conv_27 = descriptors_vals[b];
27899                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
27900                 CHECK_ACCESS(descriptors_conv_27_ptr);
27901                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27902                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
27903                 descriptors_constr.data[b] = descriptors_conv_27_conv;
27904         }
27905         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27906         LDKCVec_TxOutZ outputs_constr;
27907         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27908         if (outputs_constr.datalen > 0)
27909                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27910         else
27911                 outputs_constr.data = NULL;
27912         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27913         for (size_t h = 0; h < outputs_constr.datalen; h++) {
27914                 int64_t outputs_conv_7 = outputs_vals[h];
27915                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
27916                 CHECK_ACCESS(outputs_conv_7_ptr);
27917                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27918                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
27919                 outputs_constr.data[h] = outputs_conv_7_conv;
27920         }
27921         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27922         LDKCVec_u8Z change_destination_script_ref;
27923         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27924         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27925         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27926         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27927         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27928         return tag_ptr(ret_conv, true);
27929 }
27930
27931 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) {
27932         LDKPhantomKeysManager this_arg_conv;
27933         this_arg_conv.inner = untag_ptr(this_arg);
27934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27936         this_arg_conv.is_owned = false;
27937         unsigned char params_arr[32];
27938         CHECK((*env)->GetArrayLength(env, params) == 32);
27939         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27940         unsigned char (*params_ref)[32] = &params_arr;
27941         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27942         int64_t ret_ref = 0;
27943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27945         return ret_ref;
27946 }
27947
27948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27949         LDKChannelManager this_obj_conv;
27950         this_obj_conv.inner = untag_ptr(this_obj);
27951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27953         ChannelManager_free(this_obj_conv);
27954 }
27955
27956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27957         LDKChainParameters this_obj_conv;
27958         this_obj_conv.inner = untag_ptr(this_obj);
27959         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27961         ChainParameters_free(this_obj_conv);
27962 }
27963
27964 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
27965         LDKChainParameters this_ptr_conv;
27966         this_ptr_conv.inner = untag_ptr(this_ptr);
27967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27969         this_ptr_conv.is_owned = false;
27970         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
27971         return ret_conv;
27972 }
27973
27974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
27975         LDKChainParameters this_ptr_conv;
27976         this_ptr_conv.inner = untag_ptr(this_ptr);
27977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27979         this_ptr_conv.is_owned = false;
27980         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
27981         ChainParameters_set_network(&this_ptr_conv, val_conv);
27982 }
27983
27984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
27985         LDKChainParameters this_ptr_conv;
27986         this_ptr_conv.inner = untag_ptr(this_ptr);
27987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27989         this_ptr_conv.is_owned = false;
27990         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27991         int64_t ret_ref = 0;
27992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27994         return ret_ref;
27995 }
27996
27997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27998         LDKChainParameters this_ptr_conv;
27999         this_ptr_conv.inner = untag_ptr(this_ptr);
28000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28002         this_ptr_conv.is_owned = false;
28003         LDKBestBlock val_conv;
28004         val_conv.inner = untag_ptr(val);
28005         val_conv.is_owned = ptr_is_owned(val);
28006         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28007         val_conv = BestBlock_clone(&val_conv);
28008         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
28009 }
28010
28011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
28012         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
28013         LDKBestBlock best_block_arg_conv;
28014         best_block_arg_conv.inner = untag_ptr(best_block_arg);
28015         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
28016         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
28017         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
28018         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
28019         int64_t ret_ref = 0;
28020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28022         return ret_ref;
28023 }
28024
28025 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
28026         LDKChainParameters ret_var = ChainParameters_clone(arg);
28027         int64_t ret_ref = 0;
28028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28030         return ret_ref;
28031 }
28032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28033         LDKChainParameters arg_conv;
28034         arg_conv.inner = untag_ptr(arg);
28035         arg_conv.is_owned = ptr_is_owned(arg);
28036         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28037         arg_conv.is_owned = false;
28038         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
28039         return ret_conv;
28040 }
28041
28042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28043         LDKChainParameters orig_conv;
28044         orig_conv.inner = untag_ptr(orig);
28045         orig_conv.is_owned = ptr_is_owned(orig);
28046         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28047         orig_conv.is_owned = false;
28048         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
28049         int64_t ret_ref = 0;
28050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28052         return ret_ref;
28053 }
28054
28055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28056         LDKCounterpartyForwardingInfo this_obj_conv;
28057         this_obj_conv.inner = untag_ptr(this_obj);
28058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28060         CounterpartyForwardingInfo_free(this_obj_conv);
28061 }
28062
28063 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28064         LDKCounterpartyForwardingInfo this_ptr_conv;
28065         this_ptr_conv.inner = untag_ptr(this_ptr);
28066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28068         this_ptr_conv.is_owned = false;
28069         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
28070         return ret_conv;
28071 }
28072
28073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28074         LDKCounterpartyForwardingInfo this_ptr_conv;
28075         this_ptr_conv.inner = untag_ptr(this_ptr);
28076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28078         this_ptr_conv.is_owned = false;
28079         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
28080 }
28081
28082 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28083         LDKCounterpartyForwardingInfo this_ptr_conv;
28084         this_ptr_conv.inner = untag_ptr(this_ptr);
28085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28087         this_ptr_conv.is_owned = false;
28088         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
28089         return ret_conv;
28090 }
28091
28092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28093         LDKCounterpartyForwardingInfo this_ptr_conv;
28094         this_ptr_conv.inner = untag_ptr(this_ptr);
28095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28097         this_ptr_conv.is_owned = false;
28098         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
28099 }
28100
28101 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28102         LDKCounterpartyForwardingInfo this_ptr_conv;
28103         this_ptr_conv.inner = untag_ptr(this_ptr);
28104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28106         this_ptr_conv.is_owned = false;
28107         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
28108         return ret_conv;
28109 }
28110
28111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28112         LDKCounterpartyForwardingInfo this_ptr_conv;
28113         this_ptr_conv.inner = untag_ptr(this_ptr);
28114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28116         this_ptr_conv.is_owned = false;
28117         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
28118 }
28119
28120 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) {
28121         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
28122         int64_t ret_ref = 0;
28123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28125         return ret_ref;
28126 }
28127
28128 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
28129         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
28130         int64_t ret_ref = 0;
28131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28133         return ret_ref;
28134 }
28135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28136         LDKCounterpartyForwardingInfo arg_conv;
28137         arg_conv.inner = untag_ptr(arg);
28138         arg_conv.is_owned = ptr_is_owned(arg);
28139         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28140         arg_conv.is_owned = false;
28141         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
28142         return ret_conv;
28143 }
28144
28145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28146         LDKCounterpartyForwardingInfo orig_conv;
28147         orig_conv.inner = untag_ptr(orig);
28148         orig_conv.is_owned = ptr_is_owned(orig);
28149         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28150         orig_conv.is_owned = false;
28151         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
28152         int64_t ret_ref = 0;
28153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28155         return ret_ref;
28156 }
28157
28158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28159         LDKChannelCounterparty this_obj_conv;
28160         this_obj_conv.inner = untag_ptr(this_obj);
28161         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28163         ChannelCounterparty_free(this_obj_conv);
28164 }
28165
28166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28167         LDKChannelCounterparty this_ptr_conv;
28168         this_ptr_conv.inner = untag_ptr(this_ptr);
28169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28171         this_ptr_conv.is_owned = false;
28172         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28173         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
28174         return ret_arr;
28175 }
28176
28177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28178         LDKChannelCounterparty this_ptr_conv;
28179         this_ptr_conv.inner = untag_ptr(this_ptr);
28180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28182         this_ptr_conv.is_owned = false;
28183         LDKPublicKey val_ref;
28184         CHECK((*env)->GetArrayLength(env, val) == 33);
28185         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28186         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
28187 }
28188
28189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28190         LDKChannelCounterparty this_ptr_conv;
28191         this_ptr_conv.inner = untag_ptr(this_ptr);
28192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28194         this_ptr_conv.is_owned = false;
28195         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
28196         int64_t ret_ref = 0;
28197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28199         return ret_ref;
28200 }
28201
28202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28203         LDKChannelCounterparty this_ptr_conv;
28204         this_ptr_conv.inner = untag_ptr(this_ptr);
28205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28207         this_ptr_conv.is_owned = false;
28208         LDKInitFeatures val_conv;
28209         val_conv.inner = untag_ptr(val);
28210         val_conv.is_owned = ptr_is_owned(val);
28211         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28212         val_conv = InitFeatures_clone(&val_conv);
28213         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
28214 }
28215
28216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28217         LDKChannelCounterparty this_ptr_conv;
28218         this_ptr_conv.inner = untag_ptr(this_ptr);
28219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28221         this_ptr_conv.is_owned = false;
28222         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
28223         return ret_conv;
28224 }
28225
28226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28227         LDKChannelCounterparty this_ptr_conv;
28228         this_ptr_conv.inner = untag_ptr(this_ptr);
28229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28231         this_ptr_conv.is_owned = false;
28232         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
28233 }
28234
28235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28236         LDKChannelCounterparty this_ptr_conv;
28237         this_ptr_conv.inner = untag_ptr(this_ptr);
28238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28240         this_ptr_conv.is_owned = false;
28241         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
28242         int64_t ret_ref = 0;
28243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28245         return ret_ref;
28246 }
28247
28248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28249         LDKChannelCounterparty this_ptr_conv;
28250         this_ptr_conv.inner = untag_ptr(this_ptr);
28251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28253         this_ptr_conv.is_owned = false;
28254         LDKCounterpartyForwardingInfo val_conv;
28255         val_conv.inner = untag_ptr(val);
28256         val_conv.is_owned = ptr_is_owned(val);
28257         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28258         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
28259         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
28260 }
28261
28262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28263         LDKChannelCounterparty this_ptr_conv;
28264         this_ptr_conv.inner = untag_ptr(this_ptr);
28265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28267         this_ptr_conv.is_owned = false;
28268         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28269         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
28270         int64_t ret_ref = tag_ptr(ret_copy, true);
28271         return ret_ref;
28272 }
28273
28274 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) {
28275         LDKChannelCounterparty this_ptr_conv;
28276         this_ptr_conv.inner = untag_ptr(this_ptr);
28277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28279         this_ptr_conv.is_owned = false;
28280         void* val_ptr = untag_ptr(val);
28281         CHECK_ACCESS(val_ptr);
28282         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28283         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28284         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28285 }
28286
28287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28288         LDKChannelCounterparty this_ptr_conv;
28289         this_ptr_conv.inner = untag_ptr(this_ptr);
28290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28292         this_ptr_conv.is_owned = false;
28293         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28294         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
28295         int64_t ret_ref = tag_ptr(ret_copy, true);
28296         return ret_ref;
28297 }
28298
28299 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) {
28300         LDKChannelCounterparty this_ptr_conv;
28301         this_ptr_conv.inner = untag_ptr(this_ptr);
28302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28304         this_ptr_conv.is_owned = false;
28305         void* val_ptr = untag_ptr(val);
28306         CHECK_ACCESS(val_ptr);
28307         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28308         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28309         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28310 }
28311
28312 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) {
28313         LDKPublicKey node_id_arg_ref;
28314         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
28315         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
28316         LDKInitFeatures features_arg_conv;
28317         features_arg_conv.inner = untag_ptr(features_arg);
28318         features_arg_conv.is_owned = ptr_is_owned(features_arg);
28319         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28320         features_arg_conv = InitFeatures_clone(&features_arg_conv);
28321         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
28322         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
28323         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
28324         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
28325         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
28326         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
28327         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
28328         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
28329         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
28330         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
28331         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
28332         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
28333         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
28334         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);
28335         int64_t ret_ref = 0;
28336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28338         return ret_ref;
28339 }
28340
28341 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
28342         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
28343         int64_t ret_ref = 0;
28344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28346         return ret_ref;
28347 }
28348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28349         LDKChannelCounterparty arg_conv;
28350         arg_conv.inner = untag_ptr(arg);
28351         arg_conv.is_owned = ptr_is_owned(arg);
28352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28353         arg_conv.is_owned = false;
28354         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
28355         return ret_conv;
28356 }
28357
28358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28359         LDKChannelCounterparty orig_conv;
28360         orig_conv.inner = untag_ptr(orig);
28361         orig_conv.is_owned = ptr_is_owned(orig);
28362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28363         orig_conv.is_owned = false;
28364         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
28365         int64_t ret_ref = 0;
28366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28368         return ret_ref;
28369 }
28370
28371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28372         LDKChannelDetails this_obj_conv;
28373         this_obj_conv.inner = untag_ptr(this_obj);
28374         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28376         ChannelDetails_free(this_obj_conv);
28377 }
28378
28379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28380         LDKChannelDetails this_ptr_conv;
28381         this_ptr_conv.inner = untag_ptr(this_ptr);
28382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28384         this_ptr_conv.is_owned = false;
28385         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28386         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
28387         return ret_arr;
28388 }
28389
28390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28391         LDKChannelDetails this_ptr_conv;
28392         this_ptr_conv.inner = untag_ptr(this_ptr);
28393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28395         this_ptr_conv.is_owned = false;
28396         LDKThirtyTwoBytes val_ref;
28397         CHECK((*env)->GetArrayLength(env, val) == 32);
28398         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28399         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
28400 }
28401
28402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
28403         LDKChannelDetails this_ptr_conv;
28404         this_ptr_conv.inner = untag_ptr(this_ptr);
28405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28407         this_ptr_conv.is_owned = false;
28408         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
28409         int64_t ret_ref = 0;
28410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28412         return ret_ref;
28413 }
28414
28415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28416         LDKChannelDetails this_ptr_conv;
28417         this_ptr_conv.inner = untag_ptr(this_ptr);
28418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28420         this_ptr_conv.is_owned = false;
28421         LDKChannelCounterparty val_conv;
28422         val_conv.inner = untag_ptr(val);
28423         val_conv.is_owned = ptr_is_owned(val);
28424         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28425         val_conv = ChannelCounterparty_clone(&val_conv);
28426         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
28427 }
28428
28429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
28430         LDKChannelDetails this_ptr_conv;
28431         this_ptr_conv.inner = untag_ptr(this_ptr);
28432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28434         this_ptr_conv.is_owned = false;
28435         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
28436         int64_t ret_ref = 0;
28437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28439         return ret_ref;
28440 }
28441
28442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28443         LDKChannelDetails this_ptr_conv;
28444         this_ptr_conv.inner = untag_ptr(this_ptr);
28445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28447         this_ptr_conv.is_owned = false;
28448         LDKOutPoint val_conv;
28449         val_conv.inner = untag_ptr(val);
28450         val_conv.is_owned = ptr_is_owned(val);
28451         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28452         val_conv = OutPoint_clone(&val_conv);
28453         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
28454 }
28455
28456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
28457         LDKChannelDetails this_ptr_conv;
28458         this_ptr_conv.inner = untag_ptr(this_ptr);
28459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28461         this_ptr_conv.is_owned = false;
28462         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28463         int64_t ret_ref = 0;
28464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28466         return ret_ref;
28467 }
28468
28469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28470         LDKChannelDetails this_ptr_conv;
28471         this_ptr_conv.inner = untag_ptr(this_ptr);
28472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28474         this_ptr_conv.is_owned = false;
28475         LDKChannelTypeFeatures val_conv;
28476         val_conv.inner = untag_ptr(val);
28477         val_conv.is_owned = ptr_is_owned(val);
28478         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28479         val_conv = ChannelTypeFeatures_clone(&val_conv);
28480         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28481 }
28482
28483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28484         LDKChannelDetails this_ptr_conv;
28485         this_ptr_conv.inner = untag_ptr(this_ptr);
28486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28488         this_ptr_conv.is_owned = false;
28489         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28490         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28491         int64_t ret_ref = tag_ptr(ret_copy, true);
28492         return ret_ref;
28493 }
28494
28495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28496         LDKChannelDetails this_ptr_conv;
28497         this_ptr_conv.inner = untag_ptr(this_ptr);
28498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28500         this_ptr_conv.is_owned = false;
28501         void* val_ptr = untag_ptr(val);
28502         CHECK_ACCESS(val_ptr);
28503         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28504         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28505         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28506 }
28507
28508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28509         LDKChannelDetails this_ptr_conv;
28510         this_ptr_conv.inner = untag_ptr(this_ptr);
28511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28513         this_ptr_conv.is_owned = false;
28514         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28515         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
28516         int64_t ret_ref = tag_ptr(ret_copy, true);
28517         return ret_ref;
28518 }
28519
28520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28521         LDKChannelDetails this_ptr_conv;
28522         this_ptr_conv.inner = untag_ptr(this_ptr);
28523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28525         this_ptr_conv.is_owned = false;
28526         void* val_ptr = untag_ptr(val);
28527         CHECK_ACCESS(val_ptr);
28528         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28529         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28530         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
28531 }
28532
28533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28534         LDKChannelDetails this_ptr_conv;
28535         this_ptr_conv.inner = untag_ptr(this_ptr);
28536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28538         this_ptr_conv.is_owned = false;
28539         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28540         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
28541         int64_t ret_ref = tag_ptr(ret_copy, true);
28542         return ret_ref;
28543 }
28544
28545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28546         LDKChannelDetails this_ptr_conv;
28547         this_ptr_conv.inner = untag_ptr(this_ptr);
28548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28550         this_ptr_conv.is_owned = false;
28551         void* val_ptr = untag_ptr(val);
28552         CHECK_ACCESS(val_ptr);
28553         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28554         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28555         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
28556 }
28557
28558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28559         LDKChannelDetails this_ptr_conv;
28560         this_ptr_conv.inner = untag_ptr(this_ptr);
28561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28563         this_ptr_conv.is_owned = false;
28564         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
28565         return ret_conv;
28566 }
28567
28568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28569         LDKChannelDetails this_ptr_conv;
28570         this_ptr_conv.inner = untag_ptr(this_ptr);
28571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28573         this_ptr_conv.is_owned = false;
28574         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
28575 }
28576
28577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28578         LDKChannelDetails 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28584         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
28585         int64_t ret_ref = tag_ptr(ret_copy, true);
28586         return ret_ref;
28587 }
28588
28589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28590         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
28596         CHECK_ACCESS(val_ptr);
28597         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28598         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28599         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28600 }
28601
28602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28603         LDKChannelDetails this_ptr_conv;
28604         this_ptr_conv.inner = untag_ptr(this_ptr);
28605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28607         this_ptr_conv.is_owned = false;
28608         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
28609         return ret_conv;
28610 }
28611
28612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28613         LDKChannelDetails this_ptr_conv;
28614         this_ptr_conv.inner = untag_ptr(this_ptr);
28615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28617         this_ptr_conv.is_owned = false;
28618         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
28619 }
28620
28621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28622         LDKChannelDetails this_ptr_conv;
28623         this_ptr_conv.inner = untag_ptr(this_ptr);
28624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28626         this_ptr_conv.is_owned = false;
28627         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28628         return ret_conv;
28629 }
28630
28631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28632         LDKChannelDetails this_ptr_conv;
28633         this_ptr_conv.inner = untag_ptr(this_ptr);
28634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28636         this_ptr_conv.is_owned = false;
28637         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28638 }
28639
28640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28641         LDKChannelDetails this_ptr_conv;
28642         this_ptr_conv.inner = untag_ptr(this_ptr);
28643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28645         this_ptr_conv.is_owned = false;
28646         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28647         return ret_conv;
28648 }
28649
28650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28651         LDKChannelDetails this_ptr_conv;
28652         this_ptr_conv.inner = untag_ptr(this_ptr);
28653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28655         this_ptr_conv.is_owned = false;
28656         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28657 }
28658
28659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28660         LDKChannelDetails this_ptr_conv;
28661         this_ptr_conv.inner = untag_ptr(this_ptr);
28662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28664         this_ptr_conv.is_owned = false;
28665         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28666         return ret_conv;
28667 }
28668
28669 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) {
28670         LDKChannelDetails this_ptr_conv;
28671         this_ptr_conv.inner = untag_ptr(this_ptr);
28672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28674         this_ptr_conv.is_owned = false;
28675         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28676 }
28677
28678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28679         LDKChannelDetails this_ptr_conv;
28680         this_ptr_conv.inner = untag_ptr(this_ptr);
28681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28683         this_ptr_conv.is_owned = false;
28684         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28685         return ret_conv;
28686 }
28687
28688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28689         LDKChannelDetails this_ptr_conv;
28690         this_ptr_conv.inner = untag_ptr(this_ptr);
28691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28693         this_ptr_conv.is_owned = false;
28694         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28695 }
28696
28697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
28698         LDKChannelDetails this_ptr_conv;
28699         this_ptr_conv.inner = untag_ptr(this_ptr);
28700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28702         this_ptr_conv.is_owned = false;
28703         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28704         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28705         int64_t ret_ref = tag_ptr(ret_copy, true);
28706         return ret_ref;
28707 }
28708
28709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28710         LDKChannelDetails this_ptr_conv;
28711         this_ptr_conv.inner = untag_ptr(this_ptr);
28712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28714         this_ptr_conv.is_owned = false;
28715         void* val_ptr = untag_ptr(val);
28716         CHECK_ACCESS(val_ptr);
28717         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28718         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28719         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28720 }
28721
28722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28723         LDKChannelDetails this_ptr_conv;
28724         this_ptr_conv.inner = untag_ptr(this_ptr);
28725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28727         this_ptr_conv.is_owned = false;
28728         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28729         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28730         int64_t ret_ref = tag_ptr(ret_copy, true);
28731         return ret_ref;
28732 }
28733
28734 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) {
28735         LDKChannelDetails this_ptr_conv;
28736         this_ptr_conv.inner = untag_ptr(this_ptr);
28737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28739         this_ptr_conv.is_owned = false;
28740         void* val_ptr = untag_ptr(val);
28741         CHECK_ACCESS(val_ptr);
28742         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28743         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28744         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28745 }
28746
28747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
28748         LDKChannelDetails this_ptr_conv;
28749         this_ptr_conv.inner = untag_ptr(this_ptr);
28750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28752         this_ptr_conv.is_owned = false;
28753         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28754         return ret_conv;
28755 }
28756
28757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28758         LDKChannelDetails this_ptr_conv;
28759         this_ptr_conv.inner = untag_ptr(this_ptr);
28760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28762         this_ptr_conv.is_owned = false;
28763         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28764 }
28765
28766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
28767         LDKChannelDetails 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         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28773         return ret_conv;
28774 }
28775
28776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28777         LDKChannelDetails 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         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28783 }
28784
28785 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
28786         LDKChannelDetails 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         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28792         return ret_conv;
28793 }
28794
28795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28796         LDKChannelDetails this_ptr_conv;
28797         this_ptr_conv.inner = untag_ptr(this_ptr);
28798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28800         this_ptr_conv.is_owned = false;
28801         ChannelDetails_set_is_usable(&this_ptr_conv, val);
28802 }
28803
28804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
28805         LDKChannelDetails this_ptr_conv;
28806         this_ptr_conv.inner = untag_ptr(this_ptr);
28807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28809         this_ptr_conv.is_owned = false;
28810         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28811         return ret_conv;
28812 }
28813
28814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28815         LDKChannelDetails this_ptr_conv;
28816         this_ptr_conv.inner = untag_ptr(this_ptr);
28817         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28819         this_ptr_conv.is_owned = false;
28820         ChannelDetails_set_is_public(&this_ptr_conv, val);
28821 }
28822
28823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28824         LDKChannelDetails this_ptr_conv;
28825         this_ptr_conv.inner = untag_ptr(this_ptr);
28826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28828         this_ptr_conv.is_owned = false;
28829         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28830         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
28831         int64_t ret_ref = tag_ptr(ret_copy, true);
28832         return ret_ref;
28833 }
28834
28835 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) {
28836         LDKChannelDetails this_ptr_conv;
28837         this_ptr_conv.inner = untag_ptr(this_ptr);
28838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28840         this_ptr_conv.is_owned = false;
28841         void* val_ptr = untag_ptr(val);
28842         CHECK_ACCESS(val_ptr);
28843         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28844         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28845         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28846 }
28847
28848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28849         LDKChannelDetails this_ptr_conv;
28850         this_ptr_conv.inner = untag_ptr(this_ptr);
28851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28853         this_ptr_conv.is_owned = false;
28854         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28855         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
28856         int64_t ret_ref = tag_ptr(ret_copy, true);
28857         return ret_ref;
28858 }
28859
28860 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) {
28861         LDKChannelDetails this_ptr_conv;
28862         this_ptr_conv.inner = untag_ptr(this_ptr);
28863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28865         this_ptr_conv.is_owned = false;
28866         void* val_ptr = untag_ptr(val);
28867         CHECK_ACCESS(val_ptr);
28868         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28869         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28870         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28871 }
28872
28873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
28874         LDKChannelDetails this_ptr_conv;
28875         this_ptr_conv.inner = untag_ptr(this_ptr);
28876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28878         this_ptr_conv.is_owned = false;
28879         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
28880         int64_t ret_ref = 0;
28881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28883         return ret_ref;
28884 }
28885
28886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28887         LDKChannelDetails this_ptr_conv;
28888         this_ptr_conv.inner = untag_ptr(this_ptr);
28889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28891         this_ptr_conv.is_owned = false;
28892         LDKChannelConfig val_conv;
28893         val_conv.inner = untag_ptr(val);
28894         val_conv.is_owned = ptr_is_owned(val);
28895         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28896         val_conv = ChannelConfig_clone(&val_conv);
28897         ChannelDetails_set_config(&this_ptr_conv, val_conv);
28898 }
28899
28900 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) {
28901         LDKThirtyTwoBytes channel_id_arg_ref;
28902         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28903         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28904         LDKChannelCounterparty counterparty_arg_conv;
28905         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
28906         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
28907         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28908         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28909         LDKOutPoint funding_txo_arg_conv;
28910         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
28911         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
28912         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28913         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28914         LDKChannelTypeFeatures channel_type_arg_conv;
28915         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
28916         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
28917         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28918         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28919         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
28920         CHECK_ACCESS(short_channel_id_arg_ptr);
28921         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28922         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
28923         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
28924         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
28925         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
28926         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
28927         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
28928         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28929         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28930         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
28931         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
28932         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28933         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28934         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
28935         CHECK_ACCESS(confirmations_required_arg_ptr);
28936         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28937         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
28938         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
28939         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28940         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28941         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
28942         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
28943         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
28944         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
28945         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
28946         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
28947         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
28948         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
28949         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
28950         LDKChannelConfig config_arg_conv;
28951         config_arg_conv.inner = untag_ptr(config_arg);
28952         config_arg_conv.is_owned = ptr_is_owned(config_arg);
28953         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
28954         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
28955         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);
28956         int64_t ret_ref = 0;
28957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28959         return ret_ref;
28960 }
28961
28962 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28963         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28964         int64_t ret_ref = 0;
28965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28967         return ret_ref;
28968 }
28969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28970         LDKChannelDetails arg_conv;
28971         arg_conv.inner = untag_ptr(arg);
28972         arg_conv.is_owned = ptr_is_owned(arg);
28973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28974         arg_conv.is_owned = false;
28975         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28976         return ret_conv;
28977 }
28978
28979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28980         LDKChannelDetails orig_conv;
28981         orig_conv.inner = untag_ptr(orig);
28982         orig_conv.is_owned = ptr_is_owned(orig);
28983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28984         orig_conv.is_owned = false;
28985         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28986         int64_t ret_ref = 0;
28987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28989         return ret_ref;
28990 }
28991
28992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
28993         LDKChannelDetails this_arg_conv;
28994         this_arg_conv.inner = untag_ptr(this_arg);
28995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28997         this_arg_conv.is_owned = false;
28998         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28999         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
29000         int64_t ret_ref = tag_ptr(ret_copy, true);
29001         return ret_ref;
29002 }
29003
29004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29005         LDKChannelDetails this_arg_conv;
29006         this_arg_conv.inner = untag_ptr(this_arg);
29007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29009         this_arg_conv.is_owned = false;
29010         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29011         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
29012         int64_t ret_ref = tag_ptr(ret_copy, true);
29013         return ret_ref;
29014 }
29015
29016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29017         if (!ptr_is_owned(this_ptr)) return;
29018         void* this_ptr_ptr = untag_ptr(this_ptr);
29019         CHECK_ACCESS(this_ptr_ptr);
29020         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
29021         FREE(untag_ptr(this_ptr));
29022         PaymentSendFailure_free(this_ptr_conv);
29023 }
29024
29025 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
29026         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29027         *ret_copy = PaymentSendFailure_clone(arg);
29028         int64_t ret_ref = tag_ptr(ret_copy, true);
29029         return ret_ref;
29030 }
29031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29032         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
29033         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
29034         return ret_conv;
29035 }
29036
29037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29038         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
29039         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29040         *ret_copy = PaymentSendFailure_clone(orig_conv);
29041         int64_t ret_ref = tag_ptr(ret_copy, true);
29042         return ret_ref;
29043 }
29044
29045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
29046         void* a_ptr = untag_ptr(a);
29047         CHECK_ACCESS(a_ptr);
29048         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
29049         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
29050         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29051         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
29052         int64_t ret_ref = tag_ptr(ret_copy, true);
29053         return ret_ref;
29054 }
29055
29056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
29057         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
29058         a_constr.datalen = (*env)->GetArrayLength(env, a);
29059         if (a_constr.datalen > 0)
29060                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29061         else
29062                 a_constr.data = NULL;
29063         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29064         for (size_t w = 0; w < a_constr.datalen; w++) {
29065                 int64_t a_conv_22 = a_vals[w];
29066                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
29067                 CHECK_ACCESS(a_conv_22_ptr);
29068                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
29069                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
29070                 a_constr.data[w] = a_conv_22_conv;
29071         }
29072         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29073         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29074         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
29075         int64_t ret_ref = tag_ptr(ret_copy, true);
29076         return ret_ref;
29077 }
29078
29079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
29080         LDKCVec_APIErrorZ a_constr;
29081         a_constr.datalen = (*env)->GetArrayLength(env, a);
29082         if (a_constr.datalen > 0)
29083                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
29084         else
29085                 a_constr.data = NULL;
29086         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29087         for (size_t k = 0; k < a_constr.datalen; k++) {
29088                 int64_t a_conv_10 = a_vals[k];
29089                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
29090                 CHECK_ACCESS(a_conv_10_ptr);
29091                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
29092                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
29093                 a_constr.data[k] = a_conv_10_conv;
29094         }
29095         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29096         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29097         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
29098         int64_t ret_ref = tag_ptr(ret_copy, true);
29099         return ret_ref;
29100 }
29101
29102 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) {
29103         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
29104         results_constr.datalen = (*env)->GetArrayLength(env, results);
29105         if (results_constr.datalen > 0)
29106                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29107         else
29108                 results_constr.data = NULL;
29109         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
29110         for (size_t w = 0; w < results_constr.datalen; w++) {
29111                 int64_t results_conv_22 = results_vals[w];
29112                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
29113                 CHECK_ACCESS(results_conv_22_ptr);
29114                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
29115                 results_constr.data[w] = results_conv_22_conv;
29116         }
29117         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
29118         LDKRouteParameters failed_paths_retry_conv;
29119         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
29120         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
29121         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
29122         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
29123         LDKThirtyTwoBytes payment_id_ref;
29124         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29125         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29126         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29127         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
29128         int64_t ret_ref = tag_ptr(ret_copy, true);
29129         return ret_ref;
29130 }
29131
29132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29133         LDKPhantomRouteHints this_obj_conv;
29134         this_obj_conv.inner = untag_ptr(this_obj);
29135         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29137         PhantomRouteHints_free(this_obj_conv);
29138 }
29139
29140 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
29141         LDKPhantomRouteHints this_ptr_conv;
29142         this_ptr_conv.inner = untag_ptr(this_ptr);
29143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29145         this_ptr_conv.is_owned = false;
29146         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
29147         int64_tArray ret_arr = NULL;
29148         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29149         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29150         for (size_t q = 0; q < ret_var.datalen; q++) {
29151                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29152                 int64_t ret_conv_16_ref = 0;
29153                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29154                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29155                 ret_arr_ptr[q] = ret_conv_16_ref;
29156         }
29157         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29158         FREE(ret_var.data);
29159         return ret_arr;
29160 }
29161
29162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
29163         LDKPhantomRouteHints this_ptr_conv;
29164         this_ptr_conv.inner = untag_ptr(this_ptr);
29165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29167         this_ptr_conv.is_owned = false;
29168         LDKCVec_ChannelDetailsZ val_constr;
29169         val_constr.datalen = (*env)->GetArrayLength(env, val);
29170         if (val_constr.datalen > 0)
29171                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29172         else
29173                 val_constr.data = NULL;
29174         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
29175         for (size_t q = 0; q < val_constr.datalen; q++) {
29176                 int64_t val_conv_16 = val_vals[q];
29177                 LDKChannelDetails val_conv_16_conv;
29178                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
29179                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
29180                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
29181                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
29182                 val_constr.data[q] = val_conv_16_conv;
29183         }
29184         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
29185         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
29186 }
29187
29188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
29189         LDKPhantomRouteHints this_ptr_conv;
29190         this_ptr_conv.inner = untag_ptr(this_ptr);
29191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29193         this_ptr_conv.is_owned = false;
29194         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
29195         return ret_conv;
29196 }
29197
29198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29199         LDKPhantomRouteHints this_ptr_conv;
29200         this_ptr_conv.inner = untag_ptr(this_ptr);
29201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29203         this_ptr_conv.is_owned = false;
29204         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
29205 }
29206
29207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29208         LDKPhantomRouteHints this_ptr_conv;
29209         this_ptr_conv.inner = untag_ptr(this_ptr);
29210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29212         this_ptr_conv.is_owned = false;
29213         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29214         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
29215         return ret_arr;
29216 }
29217
29218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29219         LDKPhantomRouteHints this_ptr_conv;
29220         this_ptr_conv.inner = untag_ptr(this_ptr);
29221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29223         this_ptr_conv.is_owned = false;
29224         LDKPublicKey val_ref;
29225         CHECK((*env)->GetArrayLength(env, val) == 33);
29226         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29227         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
29228 }
29229
29230 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) {
29231         LDKCVec_ChannelDetailsZ channels_arg_constr;
29232         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
29233         if (channels_arg_constr.datalen > 0)
29234                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29235         else
29236                 channels_arg_constr.data = NULL;
29237         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
29238         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
29239                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
29240                 LDKChannelDetails channels_arg_conv_16_conv;
29241                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
29242                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
29243                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
29244                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
29245                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
29246         }
29247         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
29248         LDKPublicKey real_node_pubkey_arg_ref;
29249         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
29250         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
29251         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
29252         int64_t ret_ref = 0;
29253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29255         return ret_ref;
29256 }
29257
29258 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
29259         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
29260         int64_t ret_ref = 0;
29261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29263         return ret_ref;
29264 }
29265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29266         LDKPhantomRouteHints arg_conv;
29267         arg_conv.inner = untag_ptr(arg);
29268         arg_conv.is_owned = ptr_is_owned(arg);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29270         arg_conv.is_owned = false;
29271         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
29272         return ret_conv;
29273 }
29274
29275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29276         LDKPhantomRouteHints orig_conv;
29277         orig_conv.inner = untag_ptr(orig);
29278         orig_conv.is_owned = ptr_is_owned(orig);
29279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29280         orig_conv.is_owned = false;
29281         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
29282         int64_t ret_ref = 0;
29283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29285         return ret_ref;
29286 }
29287
29288 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) {
29289         void* fee_est_ptr = untag_ptr(fee_est);
29290         CHECK_ACCESS(fee_est_ptr);
29291         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
29292         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
29293                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29294                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
29295         }
29296         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29297         CHECK_ACCESS(chain_monitor_ptr);
29298         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29299         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29300                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29301                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29302         }
29303         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
29304         CHECK_ACCESS(tx_broadcaster_ptr);
29305         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29306         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29307                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29308                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29309         }
29310         void* logger_ptr = untag_ptr(logger);
29311         CHECK_ACCESS(logger_ptr);
29312         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29313         if (logger_conv.free == LDKLogger_JCalls_free) {
29314                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29315                 LDKLogger_JCalls_cloned(&logger_conv);
29316         }
29317         void* keys_manager_ptr = untag_ptr(keys_manager);
29318         CHECK_ACCESS(keys_manager_ptr);
29319         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29320         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29321                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29322                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29323         }
29324         LDKUserConfig config_conv;
29325         config_conv.inner = untag_ptr(config);
29326         config_conv.is_owned = ptr_is_owned(config);
29327         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29328         config_conv = UserConfig_clone(&config_conv);
29329         LDKChainParameters params_conv;
29330         params_conv.inner = untag_ptr(params);
29331         params_conv.is_owned = ptr_is_owned(params);
29332         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
29333         params_conv = ChainParameters_clone(&params_conv);
29334         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
29335         int64_t ret_ref = 0;
29336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29338         return ret_ref;
29339 }
29340
29341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
29342         LDKChannelManager this_arg_conv;
29343         this_arg_conv.inner = untag_ptr(this_arg);
29344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29346         this_arg_conv.is_owned = false;
29347         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
29348         int64_t ret_ref = 0;
29349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29351         return ret_ref;
29352 }
29353
29354 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) {
29355         LDKChannelManager this_arg_conv;
29356         this_arg_conv.inner = untag_ptr(this_arg);
29357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29359         this_arg_conv.is_owned = false;
29360         LDKPublicKey their_network_key_ref;
29361         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
29362         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
29363         LDKUserConfig override_config_conv;
29364         override_config_conv.inner = untag_ptr(override_config);
29365         override_config_conv.is_owned = ptr_is_owned(override_config);
29366         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
29367         override_config_conv = UserConfig_clone(&override_config_conv);
29368         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
29369         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
29370         return tag_ptr(ret_conv, true);
29371 }
29372
29373 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29374         LDKChannelManager this_arg_conv;
29375         this_arg_conv.inner = untag_ptr(this_arg);
29376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29378         this_arg_conv.is_owned = false;
29379         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
29380         int64_tArray ret_arr = NULL;
29381         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29382         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29383         for (size_t q = 0; q < ret_var.datalen; q++) {
29384                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29385                 int64_t ret_conv_16_ref = 0;
29386                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29387                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29388                 ret_arr_ptr[q] = ret_conv_16_ref;
29389         }
29390         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29391         FREE(ret_var.data);
29392         return ret_arr;
29393 }
29394
29395 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29396         LDKChannelManager this_arg_conv;
29397         this_arg_conv.inner = untag_ptr(this_arg);
29398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29400         this_arg_conv.is_owned = false;
29401         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
29402         int64_tArray ret_arr = NULL;
29403         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29404         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29405         for (size_t q = 0; q < ret_var.datalen; q++) {
29406                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29407                 int64_t ret_conv_16_ref = 0;
29408                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29409                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29410                 ret_arr_ptr[q] = ret_conv_16_ref;
29411         }
29412         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29413         FREE(ret_var.data);
29414         return ret_arr;
29415 }
29416
29417 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) {
29418         LDKChannelManager this_arg_conv;
29419         this_arg_conv.inner = untag_ptr(this_arg);
29420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29422         this_arg_conv.is_owned = false;
29423         unsigned char channel_id_arr[32];
29424         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29425         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29426         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29427         LDKPublicKey counterparty_node_id_ref;
29428         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29429         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29430         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29431         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29432         return tag_ptr(ret_conv, true);
29433 }
29434
29435 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) {
29436         LDKChannelManager this_arg_conv;
29437         this_arg_conv.inner = untag_ptr(this_arg);
29438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29440         this_arg_conv.is_owned = false;
29441         unsigned char channel_id_arr[32];
29442         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29443         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29444         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29445         LDKPublicKey counterparty_node_id_ref;
29446         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29447         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29448         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29449         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
29450         return tag_ptr(ret_conv, true);
29451 }
29452
29453 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) {
29454         LDKChannelManager this_arg_conv;
29455         this_arg_conv.inner = untag_ptr(this_arg);
29456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29458         this_arg_conv.is_owned = false;
29459         unsigned char channel_id_arr[32];
29460         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29461         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29462         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29463         LDKPublicKey counterparty_node_id_ref;
29464         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29465         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29466         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29467         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29468         return tag_ptr(ret_conv, true);
29469 }
29470
29471 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) {
29472         LDKChannelManager this_arg_conv;
29473         this_arg_conv.inner = untag_ptr(this_arg);
29474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29476         this_arg_conv.is_owned = false;
29477         unsigned char channel_id_arr[32];
29478         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29479         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29480         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29481         LDKPublicKey counterparty_node_id_ref;
29482         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29483         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29484         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29485         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29486         return tag_ptr(ret_conv, true);
29487 }
29488
29489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
29490         LDKChannelManager this_arg_conv;
29491         this_arg_conv.inner = untag_ptr(this_arg);
29492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29494         this_arg_conv.is_owned = false;
29495         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
29496 }
29497
29498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
29499         LDKChannelManager this_arg_conv;
29500         this_arg_conv.inner = untag_ptr(this_arg);
29501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29503         this_arg_conv.is_owned = false;
29504         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
29505 }
29506
29507 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) {
29508         LDKChannelManager this_arg_conv;
29509         this_arg_conv.inner = untag_ptr(this_arg);
29510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29512         this_arg_conv.is_owned = false;
29513         LDKRoute route_conv;
29514         route_conv.inner = untag_ptr(route);
29515         route_conv.is_owned = ptr_is_owned(route);
29516         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29517         route_conv.is_owned = false;
29518         LDKThirtyTwoBytes payment_hash_ref;
29519         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29520         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29521         LDKThirtyTwoBytes payment_secret_ref;
29522         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29523         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29524         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
29525         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
29526         return tag_ptr(ret_conv, true);
29527 }
29528
29529 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) {
29530         LDKChannelManager this_arg_conv;
29531         this_arg_conv.inner = untag_ptr(this_arg);
29532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29534         this_arg_conv.is_owned = false;
29535         LDKRoute route_conv;
29536         route_conv.inner = untag_ptr(route);
29537         route_conv.is_owned = ptr_is_owned(route);
29538         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29539         route_conv.is_owned = false;
29540         LDKThirtyTwoBytes payment_id_ref;
29541         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29542         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29543         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29544         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
29545         return tag_ptr(ret_conv, true);
29546 }
29547
29548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
29549         LDKChannelManager this_arg_conv;
29550         this_arg_conv.inner = untag_ptr(this_arg);
29551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29553         this_arg_conv.is_owned = false;
29554         LDKThirtyTwoBytes payment_id_ref;
29555         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29556         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29557         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29558 }
29559
29560 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) {
29561         LDKChannelManager this_arg_conv;
29562         this_arg_conv.inner = untag_ptr(this_arg);
29563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29565         this_arg_conv.is_owned = false;
29566         LDKRoute route_conv;
29567         route_conv.inner = untag_ptr(route);
29568         route_conv.is_owned = ptr_is_owned(route);
29569         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29570         route_conv.is_owned = false;
29571         LDKThirtyTwoBytes payment_preimage_ref;
29572         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29573         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29574         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29575         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
29576         return tag_ptr(ret_conv, true);
29577 }
29578
29579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) {
29580         LDKChannelManager this_arg_conv;
29581         this_arg_conv.inner = untag_ptr(this_arg);
29582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29584         this_arg_conv.is_owned = false;
29585         LDKCVec_RouteHopZ hops_constr;
29586         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
29587         if (hops_constr.datalen > 0)
29588                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
29589         else
29590                 hops_constr.data = NULL;
29591         int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
29592         for (size_t k = 0; k < hops_constr.datalen; k++) {
29593                 int64_t hops_conv_10 = hops_vals[k];
29594                 LDKRouteHop hops_conv_10_conv;
29595                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
29596                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
29597                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
29598                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
29599                 hops_constr.data[k] = hops_conv_10_conv;
29600         }
29601         (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
29602         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29603         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
29604         return tag_ptr(ret_conv, true);
29605 }
29606
29607 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) {
29608         LDKChannelManager this_arg_conv;
29609         this_arg_conv.inner = untag_ptr(this_arg);
29610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29612         this_arg_conv.is_owned = false;
29613         unsigned char temporary_channel_id_arr[32];
29614         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29615         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29616         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29617         LDKPublicKey counterparty_node_id_ref;
29618         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29619         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29620         LDKTransaction funding_transaction_ref;
29621         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
29622         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29623         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
29624         funding_transaction_ref.data_is_owned = true;
29625         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29626         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29627         return tag_ptr(ret_conv, true);
29628 }
29629
29630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
29631         LDKChannelManager this_arg_conv;
29632         this_arg_conv.inner = untag_ptr(this_arg);
29633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29635         this_arg_conv.is_owned = false;
29636         LDKThreeBytes rgb_ref;
29637         CHECK((*env)->GetArrayLength(env, rgb) == 3);
29638         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
29639         LDKThirtyTwoBytes alias_ref;
29640         CHECK((*env)->GetArrayLength(env, alias) == 32);
29641         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
29642         LDKCVec_NetAddressZ addresses_constr;
29643         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
29644         if (addresses_constr.datalen > 0)
29645                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
29646         else
29647                 addresses_constr.data = NULL;
29648         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
29649         for (size_t m = 0; m < addresses_constr.datalen; m++) {
29650                 int64_t addresses_conv_12 = addresses_vals[m];
29651                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
29652                 CHECK_ACCESS(addresses_conv_12_ptr);
29653                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
29654                 addresses_constr.data[m] = addresses_conv_12_conv;
29655         }
29656         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
29657         ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
29658 }
29659
29660 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) {
29661         LDKChannelManager this_arg_conv;
29662         this_arg_conv.inner = untag_ptr(this_arg);
29663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29665         this_arg_conv.is_owned = false;
29666         LDKPublicKey counterparty_node_id_ref;
29667         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29668         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29669         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29670         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
29671         if (channel_ids_constr.datalen > 0)
29672                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29673         else
29674                 channel_ids_constr.data = NULL;
29675         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
29676                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
29677                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
29678                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
29679                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
29680                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
29681         }
29682         LDKChannelConfig config_conv;
29683         config_conv.inner = untag_ptr(config);
29684         config_conv.is_owned = ptr_is_owned(config);
29685         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29686         config_conv.is_owned = false;
29687         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29688         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29689         return tag_ptr(ret_conv, true);
29690 }
29691
29692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
29693         LDKChannelManager this_arg_conv;
29694         this_arg_conv.inner = untag_ptr(this_arg);
29695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29697         this_arg_conv.is_owned = false;
29698         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29699 }
29700
29701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
29702         LDKChannelManager this_arg_conv;
29703         this_arg_conv.inner = untag_ptr(this_arg);
29704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29706         this_arg_conv.is_owned = false;
29707         ChannelManager_timer_tick_occurred(&this_arg_conv);
29708 }
29709
29710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
29711         LDKChannelManager this_arg_conv;
29712         this_arg_conv.inner = untag_ptr(this_arg);
29713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29715         this_arg_conv.is_owned = false;
29716         unsigned char payment_hash_arr[32];
29717         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29718         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
29719         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
29720         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29721 }
29722
29723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
29724         LDKChannelManager this_arg_conv;
29725         this_arg_conv.inner = untag_ptr(this_arg);
29726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29728         this_arg_conv.is_owned = false;
29729         LDKThirtyTwoBytes payment_preimage_ref;
29730         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29731         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29732         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29733 }
29734
29735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
29736         LDKChannelManager this_arg_conv;
29737         this_arg_conv.inner = untag_ptr(this_arg);
29738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29740         this_arg_conv.is_owned = false;
29741         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29742         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
29743         return ret_arr;
29744 }
29745
29746 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) {
29747         LDKChannelManager this_arg_conv;
29748         this_arg_conv.inner = untag_ptr(this_arg);
29749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29751         this_arg_conv.is_owned = false;
29752         unsigned char temporary_channel_id_arr[32];
29753         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29754         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29755         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29756         LDKPublicKey counterparty_node_id_ref;
29757         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29758         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29759         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29760         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
29761         return tag_ptr(ret_conv, true);
29762 }
29763
29764 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) {
29765         LDKChannelManager this_arg_conv;
29766         this_arg_conv.inner = untag_ptr(this_arg);
29767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29769         this_arg_conv.is_owned = false;
29770         unsigned char temporary_channel_id_arr[32];
29771         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29772         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29773         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29774         LDKPublicKey counterparty_node_id_ref;
29775         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29776         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29777         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29778         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
29779         return tag_ptr(ret_conv, true);
29780 }
29781
29782 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) {
29783         LDKChannelManager this_arg_conv;
29784         this_arg_conv.inner = untag_ptr(this_arg);
29785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29787         this_arg_conv.is_owned = false;
29788         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29789         CHECK_ACCESS(min_value_msat_ptr);
29790         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29791         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29792         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29793         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29794         return tag_ptr(ret_conv, true);
29795 }
29796
29797 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) {
29798         LDKChannelManager this_arg_conv;
29799         this_arg_conv.inner = untag_ptr(this_arg);
29800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29802         this_arg_conv.is_owned = false;
29803         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29804         CHECK_ACCESS(min_value_msat_ptr);
29805         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29806         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29807         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29808         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29809         return tag_ptr(ret_conv, true);
29810 }
29811
29812 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) {
29813         LDKChannelManager this_arg_conv;
29814         this_arg_conv.inner = untag_ptr(this_arg);
29815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29817         this_arg_conv.is_owned = false;
29818         LDKThirtyTwoBytes payment_hash_ref;
29819         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29820         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29821         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29822         CHECK_ACCESS(min_value_msat_ptr);
29823         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29824         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29825         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29826         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29827         return tag_ptr(ret_conv, true);
29828 }
29829
29830 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) {
29831         LDKChannelManager this_arg_conv;
29832         this_arg_conv.inner = untag_ptr(this_arg);
29833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29835         this_arg_conv.is_owned = false;
29836         LDKThirtyTwoBytes payment_hash_ref;
29837         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29838         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29839         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29840         CHECK_ACCESS(min_value_msat_ptr);
29841         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29842         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29843         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29844         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29845         return tag_ptr(ret_conv, true);
29846 }
29847
29848 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) {
29849         LDKChannelManager this_arg_conv;
29850         this_arg_conv.inner = untag_ptr(this_arg);
29851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29853         this_arg_conv.is_owned = false;
29854         LDKThirtyTwoBytes payment_hash_ref;
29855         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29856         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29857         LDKThirtyTwoBytes payment_secret_ref;
29858         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29859         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29860         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29861         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29862         return tag_ptr(ret_conv, true);
29863 }
29864
29865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29866         LDKChannelManager this_arg_conv;
29867         this_arg_conv.inner = untag_ptr(this_arg);
29868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29870         this_arg_conv.is_owned = false;
29871         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29872         return ret_conv;
29873 }
29874
29875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
29876         LDKChannelManager this_arg_conv;
29877         this_arg_conv.inner = untag_ptr(this_arg);
29878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29880         this_arg_conv.is_owned = false;
29881         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29882         int64_t ret_ref = 0;
29883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29885         return ret_ref;
29886 }
29887
29888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29889         LDKChannelManager this_arg_conv;
29890         this_arg_conv.inner = untag_ptr(this_arg);
29891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29893         this_arg_conv.is_owned = false;
29894         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29895         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29896         return tag_ptr(ret_ret, true);
29897 }
29898
29899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29900         LDKChannelManager this_arg_conv;
29901         this_arg_conv.inner = untag_ptr(this_arg);
29902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29904         this_arg_conv.is_owned = false;
29905         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29906         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29907         return tag_ptr(ret_ret, true);
29908 }
29909
29910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
29911         LDKChannelManager this_arg_conv;
29912         this_arg_conv.inner = untag_ptr(this_arg);
29913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29915         this_arg_conv.is_owned = false;
29916         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29917         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29918         return tag_ptr(ret_ret, true);
29919 }
29920
29921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
29922         LDKChannelManager this_arg_conv;
29923         this_arg_conv.inner = untag_ptr(this_arg);
29924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29926         this_arg_conv.is_owned = false;
29927         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29928         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29929         return tag_ptr(ret_ret, true);
29930 }
29931
29932 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) {
29933         LDKChannelManager this_arg_conv;
29934         this_arg_conv.inner = untag_ptr(this_arg);
29935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29937         this_arg_conv.is_owned = false;
29938         jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
29939         return ret_conv;
29940 }
29941
29942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
29943         LDKChannelManager this_arg_conv;
29944         this_arg_conv.inner = untag_ptr(this_arg);
29945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29947         this_arg_conv.is_owned = false;
29948         ChannelManager_await_persistable_update(&this_arg_conv);
29949 }
29950
29951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
29952         LDKChannelManager this_arg_conv;
29953         this_arg_conv.inner = untag_ptr(this_arg);
29954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29956         this_arg_conv.is_owned = false;
29957         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29958         int64_t ret_ref = 0;
29959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29961         return ret_ref;
29962 }
29963
29964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
29965         LDKChannelManager this_arg_conv;
29966         this_arg_conv.inner = untag_ptr(this_arg);
29967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29969         this_arg_conv.is_owned = false;
29970         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29971         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29972         return tag_ptr(ret_ret, true);
29973 }
29974
29975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
29976         LDKCounterpartyForwardingInfo obj_conv;
29977         obj_conv.inner = untag_ptr(obj);
29978         obj_conv.is_owned = ptr_is_owned(obj);
29979         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29980         obj_conv.is_owned = false;
29981         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29982         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29983         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29984         CVec_u8Z_free(ret_var);
29985         return ret_arr;
29986 }
29987
29988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29989         LDKu8slice ser_ref;
29990         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29991         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29992         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29993         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29994         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29995         return tag_ptr(ret_conv, true);
29996 }
29997
29998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
29999         LDKChannelCounterparty obj_conv;
30000         obj_conv.inner = untag_ptr(obj);
30001         obj_conv.is_owned = ptr_is_owned(obj);
30002         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30003         obj_conv.is_owned = false;
30004         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
30005         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30006         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30007         CVec_u8Z_free(ret_var);
30008         return ret_arr;
30009 }
30010
30011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30012         LDKu8slice ser_ref;
30013         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30014         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30015         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30016         *ret_conv = ChannelCounterparty_read(ser_ref);
30017         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30018         return tag_ptr(ret_conv, true);
30019 }
30020
30021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
30022         LDKChannelDetails obj_conv;
30023         obj_conv.inner = untag_ptr(obj);
30024         obj_conv.is_owned = ptr_is_owned(obj);
30025         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30026         obj_conv.is_owned = false;
30027         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
30028         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30029         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30030         CVec_u8Z_free(ret_var);
30031         return ret_arr;
30032 }
30033
30034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30035         LDKu8slice ser_ref;
30036         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30037         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30038         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30039         *ret_conv = ChannelDetails_read(ser_ref);
30040         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30041         return tag_ptr(ret_conv, true);
30042 }
30043
30044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
30045         LDKPhantomRouteHints obj_conv;
30046         obj_conv.inner = untag_ptr(obj);
30047         obj_conv.is_owned = ptr_is_owned(obj);
30048         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30049         obj_conv.is_owned = false;
30050         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
30051         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30052         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30053         CVec_u8Z_free(ret_var);
30054         return ret_arr;
30055 }
30056
30057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30058         LDKu8slice ser_ref;
30059         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30060         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30061         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30062         *ret_conv = PhantomRouteHints_read(ser_ref);
30063         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30064         return tag_ptr(ret_conv, true);
30065 }
30066
30067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
30068         LDKChannelManager obj_conv;
30069         obj_conv.inner = untag_ptr(obj);
30070         obj_conv.is_owned = ptr_is_owned(obj);
30071         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30072         obj_conv.is_owned = false;
30073         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
30074         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30075         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30076         CVec_u8Z_free(ret_var);
30077         return ret_arr;
30078 }
30079
30080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30081         LDKChannelManagerReadArgs this_obj_conv;
30082         this_obj_conv.inner = untag_ptr(this_obj);
30083         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30085         ChannelManagerReadArgs_free(this_obj_conv);
30086 }
30087
30088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
30089         LDKChannelManagerReadArgs this_ptr_conv;
30090         this_ptr_conv.inner = untag_ptr(this_ptr);
30091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30093         this_ptr_conv.is_owned = false;
30094         // WARNING: This object doesn't live past this scope, needs clone!
30095         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
30096         return ret_ret;
30097 }
30098
30099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30100         LDKChannelManagerReadArgs this_ptr_conv;
30101         this_ptr_conv.inner = untag_ptr(this_ptr);
30102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30104         this_ptr_conv.is_owned = false;
30105         void* val_ptr = untag_ptr(val);
30106         CHECK_ACCESS(val_ptr);
30107         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
30108         if (val_conv.free == LDKKeysInterface_JCalls_free) {
30109                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30110                 LDKKeysInterface_JCalls_cloned(&val_conv);
30111         }
30112         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
30113 }
30114
30115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
30116         LDKChannelManagerReadArgs this_ptr_conv;
30117         this_ptr_conv.inner = untag_ptr(this_ptr);
30118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30120         this_ptr_conv.is_owned = false;
30121         // WARNING: This object doesn't live past this scope, needs clone!
30122         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
30123         return ret_ret;
30124 }
30125
30126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30127         LDKChannelManagerReadArgs this_ptr_conv;
30128         this_ptr_conv.inner = untag_ptr(this_ptr);
30129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30131         this_ptr_conv.is_owned = false;
30132         void* val_ptr = untag_ptr(val);
30133         CHECK_ACCESS(val_ptr);
30134         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
30135         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
30136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30137                 LDKFeeEstimator_JCalls_cloned(&val_conv);
30138         }
30139         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
30140 }
30141
30142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
30143         LDKChannelManagerReadArgs this_ptr_conv;
30144         this_ptr_conv.inner = untag_ptr(this_ptr);
30145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30147         this_ptr_conv.is_owned = false;
30148         // WARNING: This object doesn't live past this scope, needs clone!
30149         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
30150         return ret_ret;
30151 }
30152
30153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30154         LDKChannelManagerReadArgs this_ptr_conv;
30155         this_ptr_conv.inner = untag_ptr(this_ptr);
30156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30158         this_ptr_conv.is_owned = false;
30159         void* val_ptr = untag_ptr(val);
30160         CHECK_ACCESS(val_ptr);
30161         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
30162         if (val_conv.free == LDKWatch_JCalls_free) {
30163                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30164                 LDKWatch_JCalls_cloned(&val_conv);
30165         }
30166         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
30167 }
30168
30169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
30170         LDKChannelManagerReadArgs this_ptr_conv;
30171         this_ptr_conv.inner = untag_ptr(this_ptr);
30172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30174         this_ptr_conv.is_owned = false;
30175         // WARNING: This object doesn't live past this scope, needs clone!
30176         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
30177         return ret_ret;
30178 }
30179
30180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30181         LDKChannelManagerReadArgs this_ptr_conv;
30182         this_ptr_conv.inner = untag_ptr(this_ptr);
30183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30185         this_ptr_conv.is_owned = false;
30186         void* val_ptr = untag_ptr(val);
30187         CHECK_ACCESS(val_ptr);
30188         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
30189         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
30190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30191                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
30192         }
30193         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
30194 }
30195
30196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
30197         LDKChannelManagerReadArgs this_ptr_conv;
30198         this_ptr_conv.inner = untag_ptr(this_ptr);
30199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30201         this_ptr_conv.is_owned = false;
30202         // WARNING: This object doesn't live past this scope, needs clone!
30203         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
30204         return ret_ret;
30205 }
30206
30207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30208         LDKChannelManagerReadArgs this_ptr_conv;
30209         this_ptr_conv.inner = untag_ptr(this_ptr);
30210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30212         this_ptr_conv.is_owned = false;
30213         void* val_ptr = untag_ptr(val);
30214         CHECK_ACCESS(val_ptr);
30215         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
30216         if (val_conv.free == LDKLogger_JCalls_free) {
30217                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30218                 LDKLogger_JCalls_cloned(&val_conv);
30219         }
30220         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
30221 }
30222
30223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30224         LDKChannelManagerReadArgs this_ptr_conv;
30225         this_ptr_conv.inner = untag_ptr(this_ptr);
30226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30228         this_ptr_conv.is_owned = false;
30229         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
30230         int64_t ret_ref = 0;
30231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30233         return ret_ref;
30234 }
30235
30236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30237         LDKChannelManagerReadArgs this_ptr_conv;
30238         this_ptr_conv.inner = untag_ptr(this_ptr);
30239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30241         this_ptr_conv.is_owned = false;
30242         LDKUserConfig val_conv;
30243         val_conv.inner = untag_ptr(val);
30244         val_conv.is_owned = ptr_is_owned(val);
30245         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30246         val_conv = UserConfig_clone(&val_conv);
30247         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
30248 }
30249
30250 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) {
30251         void* keys_manager_ptr = untag_ptr(keys_manager);
30252         CHECK_ACCESS(keys_manager_ptr);
30253         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30254         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30255                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30256                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30257         }
30258         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30259         CHECK_ACCESS(fee_estimator_ptr);
30260         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30261         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30262                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30263                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30264         }
30265         void* chain_monitor_ptr = untag_ptr(chain_monitor);
30266         CHECK_ACCESS(chain_monitor_ptr);
30267         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30268         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30270                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30271         }
30272         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
30273         CHECK_ACCESS(tx_broadcaster_ptr);
30274         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30275         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30276                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30277                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30278         }
30279         void* logger_ptr = untag_ptr(logger);
30280         CHECK_ACCESS(logger_ptr);
30281         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30282         if (logger_conv.free == LDKLogger_JCalls_free) {
30283                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30284                 LDKLogger_JCalls_cloned(&logger_conv);
30285         }
30286         LDKUserConfig default_config_conv;
30287         default_config_conv.inner = untag_ptr(default_config);
30288         default_config_conv.is_owned = ptr_is_owned(default_config);
30289         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30290         default_config_conv = UserConfig_clone(&default_config_conv);
30291         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30292         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
30293         if (channel_monitors_constr.datalen > 0)
30294                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30295         else
30296                 channel_monitors_constr.data = NULL;
30297         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
30298         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30299                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30300                 LDKChannelMonitor channel_monitors_conv_16_conv;
30301                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30302                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30303                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30304                 channel_monitors_conv_16_conv.is_owned = false;
30305                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30306         }
30307         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
30308         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);
30309         int64_t ret_ref = 0;
30310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30312         return ret_ref;
30313 }
30314
30315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
30316         LDKu8slice ser_ref;
30317         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30318         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30319         LDKChannelManagerReadArgs arg_conv;
30320         arg_conv.inner = untag_ptr(arg);
30321         arg_conv.is_owned = ptr_is_owned(arg);
30322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30323         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30324         
30325         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30326         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30327         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30328         return tag_ptr(ret_conv, true);
30329 }
30330
30331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30332         LDKExpandedKey this_obj_conv;
30333         this_obj_conv.inner = untag_ptr(this_obj);
30334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30336         ExpandedKey_free(this_obj_conv);
30337 }
30338
30339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
30340         unsigned char key_material_arr[32];
30341         CHECK((*env)->GetArrayLength(env, key_material) == 32);
30342         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
30343         unsigned char (*key_material_ref)[32] = &key_material_arr;
30344         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30345         int64_t ret_ref = 0;
30346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30348         return ret_ref;
30349 }
30350
30351 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) {
30352         LDKExpandedKey keys_conv;
30353         keys_conv.inner = untag_ptr(keys);
30354         keys_conv.is_owned = ptr_is_owned(keys);
30355         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30356         keys_conv.is_owned = false;
30357         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30358         CHECK_ACCESS(min_value_msat_ptr);
30359         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30360         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30361         void* keys_manager_ptr = untag_ptr(keys_manager);
30362         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
30363         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
30364         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30365         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
30366         return tag_ptr(ret_conv, true);
30367 }
30368
30369 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) {
30370         LDKExpandedKey keys_conv;
30371         keys_conv.inner = untag_ptr(keys);
30372         keys_conv.is_owned = ptr_is_owned(keys);
30373         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30374         keys_conv.is_owned = false;
30375         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30376         CHECK_ACCESS(min_value_msat_ptr);
30377         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30378         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30379         LDKThirtyTwoBytes payment_hash_ref;
30380         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30381         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30382         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30383         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
30384         return tag_ptr(ret_conv, true);
30385 }
30386
30387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30388         LDKDecodeError this_obj_conv;
30389         this_obj_conv.inner = untag_ptr(this_obj);
30390         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30392         DecodeError_free(this_obj_conv);
30393 }
30394
30395 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30396         LDKDecodeError ret_var = DecodeError_clone(arg);
30397         int64_t ret_ref = 0;
30398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30400         return ret_ref;
30401 }
30402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30403         LDKDecodeError arg_conv;
30404         arg_conv.inner = untag_ptr(arg);
30405         arg_conv.is_owned = ptr_is_owned(arg);
30406         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30407         arg_conv.is_owned = false;
30408         int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
30409         return ret_conv;
30410 }
30411
30412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30413         LDKDecodeError orig_conv;
30414         orig_conv.inner = untag_ptr(orig);
30415         orig_conv.is_owned = ptr_is_owned(orig);
30416         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30417         orig_conv.is_owned = false;
30418         LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
30419         int64_t ret_ref = 0;
30420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30422         return ret_ref;
30423 }
30424
30425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30426         LDKInit this_obj_conv;
30427         this_obj_conv.inner = untag_ptr(this_obj);
30428         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30430         Init_free(this_obj_conv);
30431 }
30432
30433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30434         LDKInit this_ptr_conv;
30435         this_ptr_conv.inner = untag_ptr(this_ptr);
30436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30438         this_ptr_conv.is_owned = false;
30439         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30440         int64_t ret_ref = 0;
30441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30443         return ret_ref;
30444 }
30445
30446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30447         LDKInit this_ptr_conv;
30448         this_ptr_conv.inner = untag_ptr(this_ptr);
30449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30451         this_ptr_conv.is_owned = false;
30452         LDKInitFeatures val_conv;
30453         val_conv.inner = untag_ptr(val);
30454         val_conv.is_owned = ptr_is_owned(val);
30455         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30456         val_conv = InitFeatures_clone(&val_conv);
30457         Init_set_features(&this_ptr_conv, val_conv);
30458 }
30459
30460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
30461         LDKInit this_ptr_conv;
30462         this_ptr_conv.inner = untag_ptr(this_ptr);
30463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30465         this_ptr_conv.is_owned = false;
30466         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30467         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30468         int64_t ret_ref = tag_ptr(ret_copy, true);
30469         return ret_ref;
30470 }
30471
30472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30473         LDKInit this_ptr_conv;
30474         this_ptr_conv.inner = untag_ptr(this_ptr);
30475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30477         this_ptr_conv.is_owned = false;
30478         void* val_ptr = untag_ptr(val);
30479         CHECK_ACCESS(val_ptr);
30480         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30481         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30482         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30483 }
30484
30485 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) {
30486         LDKInitFeatures features_arg_conv;
30487         features_arg_conv.inner = untag_ptr(features_arg);
30488         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30489         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30490         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30491         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30492         CHECK_ACCESS(remote_network_address_arg_ptr);
30493         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30494         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30495         int64_t ret_ref = 0;
30496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30498         return ret_ref;
30499 }
30500
30501 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30502         LDKInit ret_var = Init_clone(arg);
30503         int64_t ret_ref = 0;
30504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30506         return ret_ref;
30507 }
30508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30509         LDKInit arg_conv;
30510         arg_conv.inner = untag_ptr(arg);
30511         arg_conv.is_owned = ptr_is_owned(arg);
30512         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30513         arg_conv.is_owned = false;
30514         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30515         return ret_conv;
30516 }
30517
30518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30519         LDKInit orig_conv;
30520         orig_conv.inner = untag_ptr(orig);
30521         orig_conv.is_owned = ptr_is_owned(orig);
30522         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30523         orig_conv.is_owned = false;
30524         LDKInit ret_var = Init_clone(&orig_conv);
30525         int64_t ret_ref = 0;
30526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30528         return ret_ref;
30529 }
30530
30531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30532         LDKErrorMessage this_obj_conv;
30533         this_obj_conv.inner = untag_ptr(this_obj);
30534         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30536         ErrorMessage_free(this_obj_conv);
30537 }
30538
30539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30540         LDKErrorMessage this_ptr_conv;
30541         this_ptr_conv.inner = untag_ptr(this_ptr);
30542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30544         this_ptr_conv.is_owned = false;
30545         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30546         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
30547         return ret_arr;
30548 }
30549
30550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30551         LDKErrorMessage this_ptr_conv;
30552         this_ptr_conv.inner = untag_ptr(this_ptr);
30553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30555         this_ptr_conv.is_owned = false;
30556         LDKThirtyTwoBytes val_ref;
30557         CHECK((*env)->GetArrayLength(env, val) == 32);
30558         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30559         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30560 }
30561
30562 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30563         LDKErrorMessage 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         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30569         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30570         Str_free(ret_str);
30571         return ret_conv;
30572 }
30573
30574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30575         LDKErrorMessage this_ptr_conv;
30576         this_ptr_conv.inner = untag_ptr(this_ptr);
30577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30579         this_ptr_conv.is_owned = false;
30580         LDKStr val_conv = java_to_owned_str(env, val);
30581         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30582 }
30583
30584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30585         LDKThirtyTwoBytes channel_id_arg_ref;
30586         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30587         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30588         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30589         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30590         int64_t ret_ref = 0;
30591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30593         return ret_ref;
30594 }
30595
30596 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30597         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30598         int64_t ret_ref = 0;
30599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30601         return ret_ref;
30602 }
30603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30604         LDKErrorMessage arg_conv;
30605         arg_conv.inner = untag_ptr(arg);
30606         arg_conv.is_owned = ptr_is_owned(arg);
30607         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30608         arg_conv.is_owned = false;
30609         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30610         return ret_conv;
30611 }
30612
30613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30614         LDKErrorMessage orig_conv;
30615         orig_conv.inner = untag_ptr(orig);
30616         orig_conv.is_owned = ptr_is_owned(orig);
30617         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30618         orig_conv.is_owned = false;
30619         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30620         int64_t ret_ref = 0;
30621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30623         return ret_ref;
30624 }
30625
30626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30627         LDKWarningMessage this_obj_conv;
30628         this_obj_conv.inner = untag_ptr(this_obj);
30629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30631         WarningMessage_free(this_obj_conv);
30632 }
30633
30634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30635         LDKWarningMessage this_ptr_conv;
30636         this_ptr_conv.inner = untag_ptr(this_ptr);
30637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30639         this_ptr_conv.is_owned = false;
30640         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30641         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
30642         return ret_arr;
30643 }
30644
30645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30646         LDKWarningMessage this_ptr_conv;
30647         this_ptr_conv.inner = untag_ptr(this_ptr);
30648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30650         this_ptr_conv.is_owned = false;
30651         LDKThirtyTwoBytes val_ref;
30652         CHECK((*env)->GetArrayLength(env, val) == 32);
30653         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30654         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30655 }
30656
30657 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30658         LDKWarningMessage this_ptr_conv;
30659         this_ptr_conv.inner = untag_ptr(this_ptr);
30660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30662         this_ptr_conv.is_owned = false;
30663         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30664         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30665         Str_free(ret_str);
30666         return ret_conv;
30667 }
30668
30669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30670         LDKWarningMessage 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         LDKStr val_conv = java_to_owned_str(env, val);
30676         WarningMessage_set_data(&this_ptr_conv, val_conv);
30677 }
30678
30679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30680         LDKThirtyTwoBytes channel_id_arg_ref;
30681         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30682         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30683         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30684         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30685         int64_t ret_ref = 0;
30686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30688         return ret_ref;
30689 }
30690
30691 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30692         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30693         int64_t ret_ref = 0;
30694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30696         return ret_ref;
30697 }
30698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30699         LDKWarningMessage arg_conv;
30700         arg_conv.inner = untag_ptr(arg);
30701         arg_conv.is_owned = ptr_is_owned(arg);
30702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30703         arg_conv.is_owned = false;
30704         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30705         return ret_conv;
30706 }
30707
30708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30709         LDKWarningMessage orig_conv;
30710         orig_conv.inner = untag_ptr(orig);
30711         orig_conv.is_owned = ptr_is_owned(orig);
30712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30713         orig_conv.is_owned = false;
30714         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30715         int64_t ret_ref = 0;
30716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30718         return ret_ref;
30719 }
30720
30721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30722         LDKPing this_obj_conv;
30723         this_obj_conv.inner = untag_ptr(this_obj);
30724         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30726         Ping_free(this_obj_conv);
30727 }
30728
30729 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30730         LDKPing this_ptr_conv;
30731         this_ptr_conv.inner = untag_ptr(this_ptr);
30732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30734         this_ptr_conv.is_owned = false;
30735         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30736         return ret_conv;
30737 }
30738
30739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30740         LDKPing this_ptr_conv;
30741         this_ptr_conv.inner = untag_ptr(this_ptr);
30742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30744         this_ptr_conv.is_owned = false;
30745         Ping_set_ponglen(&this_ptr_conv, val);
30746 }
30747
30748 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30749         LDKPing this_ptr_conv;
30750         this_ptr_conv.inner = untag_ptr(this_ptr);
30751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30753         this_ptr_conv.is_owned = false;
30754         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30755         return ret_conv;
30756 }
30757
30758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30759         LDKPing this_ptr_conv;
30760         this_ptr_conv.inner = untag_ptr(this_ptr);
30761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30763         this_ptr_conv.is_owned = false;
30764         Ping_set_byteslen(&this_ptr_conv, val);
30765 }
30766
30767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
30768         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30769         int64_t ret_ref = 0;
30770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30772         return ret_ref;
30773 }
30774
30775 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30776         LDKPing ret_var = Ping_clone(arg);
30777         int64_t ret_ref = 0;
30778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30780         return ret_ref;
30781 }
30782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30783         LDKPing arg_conv;
30784         arg_conv.inner = untag_ptr(arg);
30785         arg_conv.is_owned = ptr_is_owned(arg);
30786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30787         arg_conv.is_owned = false;
30788         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30789         return ret_conv;
30790 }
30791
30792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30793         LDKPing orig_conv;
30794         orig_conv.inner = untag_ptr(orig);
30795         orig_conv.is_owned = ptr_is_owned(orig);
30796         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30797         orig_conv.is_owned = false;
30798         LDKPing ret_var = Ping_clone(&orig_conv);
30799         int64_t ret_ref = 0;
30800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30802         return ret_ref;
30803 }
30804
30805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30806         LDKPong this_obj_conv;
30807         this_obj_conv.inner = untag_ptr(this_obj);
30808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30810         Pong_free(this_obj_conv);
30811 }
30812
30813 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30814         LDKPong this_ptr_conv;
30815         this_ptr_conv.inner = untag_ptr(this_ptr);
30816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30818         this_ptr_conv.is_owned = false;
30819         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30820         return ret_conv;
30821 }
30822
30823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30824         LDKPong this_ptr_conv;
30825         this_ptr_conv.inner = untag_ptr(this_ptr);
30826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30828         this_ptr_conv.is_owned = false;
30829         Pong_set_byteslen(&this_ptr_conv, val);
30830 }
30831
30832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
30833         LDKPong ret_var = Pong_new(byteslen_arg);
30834         int64_t ret_ref = 0;
30835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30837         return ret_ref;
30838 }
30839
30840 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30841         LDKPong ret_var = Pong_clone(arg);
30842         int64_t ret_ref = 0;
30843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30845         return ret_ref;
30846 }
30847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30848         LDKPong arg_conv;
30849         arg_conv.inner = untag_ptr(arg);
30850         arg_conv.is_owned = ptr_is_owned(arg);
30851         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30852         arg_conv.is_owned = false;
30853         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30854         return ret_conv;
30855 }
30856
30857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30858         LDKPong orig_conv;
30859         orig_conv.inner = untag_ptr(orig);
30860         orig_conv.is_owned = ptr_is_owned(orig);
30861         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30862         orig_conv.is_owned = false;
30863         LDKPong ret_var = Pong_clone(&orig_conv);
30864         int64_t ret_ref = 0;
30865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30867         return ret_ref;
30868 }
30869
30870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30871         LDKOpenChannel this_obj_conv;
30872         this_obj_conv.inner = untag_ptr(this_obj);
30873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30875         OpenChannel_free(this_obj_conv);
30876 }
30877
30878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30879         LDKOpenChannel this_ptr_conv;
30880         this_ptr_conv.inner = untag_ptr(this_ptr);
30881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30883         this_ptr_conv.is_owned = false;
30884         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30885         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
30886         return ret_arr;
30887 }
30888
30889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30890         LDKOpenChannel this_ptr_conv;
30891         this_ptr_conv.inner = untag_ptr(this_ptr);
30892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30894         this_ptr_conv.is_owned = false;
30895         LDKThirtyTwoBytes val_ref;
30896         CHECK((*env)->GetArrayLength(env, val) == 32);
30897         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30898         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30899 }
30900
30901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30902         LDKOpenChannel this_ptr_conv;
30903         this_ptr_conv.inner = untag_ptr(this_ptr);
30904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30906         this_ptr_conv.is_owned = false;
30907         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30908         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
30909         return ret_arr;
30910 }
30911
30912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30913         LDKOpenChannel this_ptr_conv;
30914         this_ptr_conv.inner = untag_ptr(this_ptr);
30915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30917         this_ptr_conv.is_owned = false;
30918         LDKThirtyTwoBytes val_ref;
30919         CHECK((*env)->GetArrayLength(env, val) == 32);
30920         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30921         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30922 }
30923
30924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30925         LDKOpenChannel this_ptr_conv;
30926         this_ptr_conv.inner = untag_ptr(this_ptr);
30927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30929         this_ptr_conv.is_owned = false;
30930         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30931         return ret_conv;
30932 }
30933
30934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30935         LDKOpenChannel this_ptr_conv;
30936         this_ptr_conv.inner = untag_ptr(this_ptr);
30937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30939         this_ptr_conv.is_owned = false;
30940         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30941 }
30942
30943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30944         LDKOpenChannel this_ptr_conv;
30945         this_ptr_conv.inner = untag_ptr(this_ptr);
30946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30948         this_ptr_conv.is_owned = false;
30949         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30950         return ret_conv;
30951 }
30952
30953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30954         LDKOpenChannel this_ptr_conv;
30955         this_ptr_conv.inner = untag_ptr(this_ptr);
30956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30958         this_ptr_conv.is_owned = false;
30959         OpenChannel_set_push_msat(&this_ptr_conv, val);
30960 }
30961
30962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30963         LDKOpenChannel this_ptr_conv;
30964         this_ptr_conv.inner = untag_ptr(this_ptr);
30965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30967         this_ptr_conv.is_owned = false;
30968         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30969         return ret_conv;
30970 }
30971
30972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30973         LDKOpenChannel this_ptr_conv;
30974         this_ptr_conv.inner = untag_ptr(this_ptr);
30975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30977         this_ptr_conv.is_owned = false;
30978         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30979 }
30980
30981 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) {
30982         LDKOpenChannel this_ptr_conv;
30983         this_ptr_conv.inner = untag_ptr(this_ptr);
30984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30986         this_ptr_conv.is_owned = false;
30987         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30988         return ret_conv;
30989 }
30990
30991 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) {
30992         LDKOpenChannel this_ptr_conv;
30993         this_ptr_conv.inner = untag_ptr(this_ptr);
30994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30996         this_ptr_conv.is_owned = false;
30997         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30998 }
30999
31000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31001         LDKOpenChannel this_ptr_conv;
31002         this_ptr_conv.inner = untag_ptr(this_ptr);
31003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31005         this_ptr_conv.is_owned = false;
31006         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31007         return ret_conv;
31008 }
31009
31010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31011         LDKOpenChannel this_ptr_conv;
31012         this_ptr_conv.inner = untag_ptr(this_ptr);
31013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31015         this_ptr_conv.is_owned = false;
31016         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31017 }
31018
31019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31020         LDKOpenChannel this_ptr_conv;
31021         this_ptr_conv.inner = untag_ptr(this_ptr);
31022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31024         this_ptr_conv.is_owned = false;
31025         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
31026         return ret_conv;
31027 }
31028
31029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31030         LDKOpenChannel this_ptr_conv;
31031         this_ptr_conv.inner = untag_ptr(this_ptr);
31032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31034         this_ptr_conv.is_owned = false;
31035         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31036 }
31037
31038 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
31039         LDKOpenChannel this_ptr_conv;
31040         this_ptr_conv.inner = untag_ptr(this_ptr);
31041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31043         this_ptr_conv.is_owned = false;
31044         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
31045         return ret_conv;
31046 }
31047
31048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31049         LDKOpenChannel this_ptr_conv;
31050         this_ptr_conv.inner = untag_ptr(this_ptr);
31051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31053         this_ptr_conv.is_owned = false;
31054         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
31055 }
31056
31057 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31058         LDKOpenChannel this_ptr_conv;
31059         this_ptr_conv.inner = untag_ptr(this_ptr);
31060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31062         this_ptr_conv.is_owned = false;
31063         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
31064         return ret_conv;
31065 }
31066
31067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31068         LDKOpenChannel this_ptr_conv;
31069         this_ptr_conv.inner = untag_ptr(this_ptr);
31070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31072         this_ptr_conv.is_owned = false;
31073         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
31074 }
31075
31076 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31077         LDKOpenChannel this_ptr_conv;
31078         this_ptr_conv.inner = untag_ptr(this_ptr);
31079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31081         this_ptr_conv.is_owned = false;
31082         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
31083         return ret_conv;
31084 }
31085
31086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31087         LDKOpenChannel this_ptr_conv;
31088         this_ptr_conv.inner = untag_ptr(this_ptr);
31089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31091         this_ptr_conv.is_owned = false;
31092         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31093 }
31094
31095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31096         LDKOpenChannel this_ptr_conv;
31097         this_ptr_conv.inner = untag_ptr(this_ptr);
31098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31100         this_ptr_conv.is_owned = false;
31101         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31103         return ret_arr;
31104 }
31105
31106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31107         LDKOpenChannel this_ptr_conv;
31108         this_ptr_conv.inner = untag_ptr(this_ptr);
31109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31111         this_ptr_conv.is_owned = false;
31112         LDKPublicKey val_ref;
31113         CHECK((*env)->GetArrayLength(env, val) == 33);
31114         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31115         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31116 }
31117
31118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31119         LDKOpenChannel this_ptr_conv;
31120         this_ptr_conv.inner = untag_ptr(this_ptr);
31121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31123         this_ptr_conv.is_owned = false;
31124         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31125         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31126         return ret_arr;
31127 }
31128
31129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31130         LDKOpenChannel this_ptr_conv;
31131         this_ptr_conv.inner = untag_ptr(this_ptr);
31132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31134         this_ptr_conv.is_owned = false;
31135         LDKPublicKey val_ref;
31136         CHECK((*env)->GetArrayLength(env, val) == 33);
31137         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31138         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31139 }
31140
31141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31142         LDKOpenChannel this_ptr_conv;
31143         this_ptr_conv.inner = untag_ptr(this_ptr);
31144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31146         this_ptr_conv.is_owned = false;
31147         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31148         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
31149         return ret_arr;
31150 }
31151
31152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31153         LDKOpenChannel this_ptr_conv;
31154         this_ptr_conv.inner = untag_ptr(this_ptr);
31155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31157         this_ptr_conv.is_owned = false;
31158         LDKPublicKey val_ref;
31159         CHECK((*env)->GetArrayLength(env, val) == 33);
31160         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31161         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31162 }
31163
31164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31165         LDKOpenChannel this_ptr_conv;
31166         this_ptr_conv.inner = untag_ptr(this_ptr);
31167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31169         this_ptr_conv.is_owned = false;
31170         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31172         return ret_arr;
31173 }
31174
31175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31176         LDKOpenChannel this_ptr_conv;
31177         this_ptr_conv.inner = untag_ptr(this_ptr);
31178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31180         this_ptr_conv.is_owned = false;
31181         LDKPublicKey val_ref;
31182         CHECK((*env)->GetArrayLength(env, val) == 33);
31183         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31184         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31185 }
31186
31187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31188         LDKOpenChannel this_ptr_conv;
31189         this_ptr_conv.inner = untag_ptr(this_ptr);
31190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31192         this_ptr_conv.is_owned = false;
31193         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31194         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31195         return ret_arr;
31196 }
31197
31198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31199         LDKOpenChannel this_ptr_conv;
31200         this_ptr_conv.inner = untag_ptr(this_ptr);
31201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31203         this_ptr_conv.is_owned = false;
31204         LDKPublicKey val_ref;
31205         CHECK((*env)->GetArrayLength(env, val) == 33);
31206         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31207         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31208 }
31209
31210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31211         LDKOpenChannel this_ptr_conv;
31212         this_ptr_conv.inner = untag_ptr(this_ptr);
31213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31215         this_ptr_conv.is_owned = false;
31216         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31217         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31218         return ret_arr;
31219 }
31220
31221 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) {
31222         LDKOpenChannel this_ptr_conv;
31223         this_ptr_conv.inner = untag_ptr(this_ptr);
31224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31226         this_ptr_conv.is_owned = false;
31227         LDKPublicKey val_ref;
31228         CHECK((*env)->GetArrayLength(env, val) == 33);
31229         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31230         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31231 }
31232
31233 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
31234         LDKOpenChannel this_ptr_conv;
31235         this_ptr_conv.inner = untag_ptr(this_ptr);
31236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31238         this_ptr_conv.is_owned = false;
31239         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31240         return ret_conv;
31241 }
31242
31243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
31244         LDKOpenChannel this_ptr_conv;
31245         this_ptr_conv.inner = untag_ptr(this_ptr);
31246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31248         this_ptr_conv.is_owned = false;
31249         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31250 }
31251
31252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31253         LDKOpenChannel this_ptr_conv;
31254         this_ptr_conv.inner = untag_ptr(this_ptr);
31255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31257         this_ptr_conv.is_owned = false;
31258         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31259         int64_t ret_ref = 0;
31260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31262         return ret_ref;
31263 }
31264
31265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31266         LDKOpenChannel this_ptr_conv;
31267         this_ptr_conv.inner = untag_ptr(this_ptr);
31268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31270         this_ptr_conv.is_owned = false;
31271         LDKChannelTypeFeatures val_conv;
31272         val_conv.inner = untag_ptr(val);
31273         val_conv.is_owned = ptr_is_owned(val);
31274         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31275         val_conv = ChannelTypeFeatures_clone(&val_conv);
31276         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31277 }
31278
31279 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31280         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31281         int64_t ret_ref = 0;
31282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31284         return ret_ref;
31285 }
31286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31287         LDKOpenChannel arg_conv;
31288         arg_conv.inner = untag_ptr(arg);
31289         arg_conv.is_owned = ptr_is_owned(arg);
31290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31291         arg_conv.is_owned = false;
31292         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31293         return ret_conv;
31294 }
31295
31296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31297         LDKOpenChannel orig_conv;
31298         orig_conv.inner = untag_ptr(orig);
31299         orig_conv.is_owned = ptr_is_owned(orig);
31300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31301         orig_conv.is_owned = false;
31302         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31303         int64_t ret_ref = 0;
31304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31306         return ret_ref;
31307 }
31308
31309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31310         LDKAcceptChannel this_obj_conv;
31311         this_obj_conv.inner = untag_ptr(this_obj);
31312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31314         AcceptChannel_free(this_obj_conv);
31315 }
31316
31317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31318         LDKAcceptChannel this_ptr_conv;
31319         this_ptr_conv.inner = untag_ptr(this_ptr);
31320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31322         this_ptr_conv.is_owned = false;
31323         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31324         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
31325         return ret_arr;
31326 }
31327
31328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31329         LDKAcceptChannel this_ptr_conv;
31330         this_ptr_conv.inner = untag_ptr(this_ptr);
31331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31333         this_ptr_conv.is_owned = false;
31334         LDKThirtyTwoBytes val_ref;
31335         CHECK((*env)->GetArrayLength(env, val) == 32);
31336         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31337         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31338 }
31339
31340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31341         LDKAcceptChannel this_ptr_conv;
31342         this_ptr_conv.inner = untag_ptr(this_ptr);
31343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31345         this_ptr_conv.is_owned = false;
31346         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31347         return ret_conv;
31348 }
31349
31350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31351         LDKAcceptChannel this_ptr_conv;
31352         this_ptr_conv.inner = untag_ptr(this_ptr);
31353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31355         this_ptr_conv.is_owned = false;
31356         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31357 }
31358
31359 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) {
31360         LDKAcceptChannel this_ptr_conv;
31361         this_ptr_conv.inner = untag_ptr(this_ptr);
31362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31364         this_ptr_conv.is_owned = false;
31365         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31366         return ret_conv;
31367 }
31368
31369 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) {
31370         LDKAcceptChannel this_ptr_conv;
31371         this_ptr_conv.inner = untag_ptr(this_ptr);
31372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31374         this_ptr_conv.is_owned = false;
31375         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31376 }
31377
31378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31379         LDKAcceptChannel this_ptr_conv;
31380         this_ptr_conv.inner = untag_ptr(this_ptr);
31381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31383         this_ptr_conv.is_owned = false;
31384         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31385         return ret_conv;
31386 }
31387
31388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31389         LDKAcceptChannel this_ptr_conv;
31390         this_ptr_conv.inner = untag_ptr(this_ptr);
31391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31393         this_ptr_conv.is_owned = false;
31394         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31395 }
31396
31397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31398         LDKAcceptChannel this_ptr_conv;
31399         this_ptr_conv.inner = untag_ptr(this_ptr);
31400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31402         this_ptr_conv.is_owned = false;
31403         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31404         return ret_conv;
31405 }
31406
31407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31408         LDKAcceptChannel this_ptr_conv;
31409         this_ptr_conv.inner = untag_ptr(this_ptr);
31410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31412         this_ptr_conv.is_owned = false;
31413         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31414 }
31415
31416 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
31417         LDKAcceptChannel this_ptr_conv;
31418         this_ptr_conv.inner = untag_ptr(this_ptr);
31419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31421         this_ptr_conv.is_owned = false;
31422         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31423         return ret_conv;
31424 }
31425
31426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31427         LDKAcceptChannel this_ptr_conv;
31428         this_ptr_conv.inner = untag_ptr(this_ptr);
31429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31431         this_ptr_conv.is_owned = false;
31432         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31433 }
31434
31435 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31436         LDKAcceptChannel this_ptr_conv;
31437         this_ptr_conv.inner = untag_ptr(this_ptr);
31438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31440         this_ptr_conv.is_owned = false;
31441         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31442         return ret_conv;
31443 }
31444
31445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31446         LDKAcceptChannel this_ptr_conv;
31447         this_ptr_conv.inner = untag_ptr(this_ptr);
31448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31450         this_ptr_conv.is_owned = false;
31451         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31452 }
31453
31454 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31455         LDKAcceptChannel this_ptr_conv;
31456         this_ptr_conv.inner = untag_ptr(this_ptr);
31457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31459         this_ptr_conv.is_owned = false;
31460         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31461         return ret_conv;
31462 }
31463
31464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31465         LDKAcceptChannel this_ptr_conv;
31466         this_ptr_conv.inner = untag_ptr(this_ptr);
31467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31469         this_ptr_conv.is_owned = false;
31470         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31471 }
31472
31473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31474         LDKAcceptChannel this_ptr_conv;
31475         this_ptr_conv.inner = untag_ptr(this_ptr);
31476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31478         this_ptr_conv.is_owned = false;
31479         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31480         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31481         return ret_arr;
31482 }
31483
31484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31485         LDKAcceptChannel this_ptr_conv;
31486         this_ptr_conv.inner = untag_ptr(this_ptr);
31487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31489         this_ptr_conv.is_owned = false;
31490         LDKPublicKey val_ref;
31491         CHECK((*env)->GetArrayLength(env, val) == 33);
31492         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31493         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31494 }
31495
31496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31497         LDKAcceptChannel this_ptr_conv;
31498         this_ptr_conv.inner = untag_ptr(this_ptr);
31499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31501         this_ptr_conv.is_owned = false;
31502         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31503         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31504         return ret_arr;
31505 }
31506
31507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31508         LDKAcceptChannel this_ptr_conv;
31509         this_ptr_conv.inner = untag_ptr(this_ptr);
31510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31512         this_ptr_conv.is_owned = false;
31513         LDKPublicKey val_ref;
31514         CHECK((*env)->GetArrayLength(env, val) == 33);
31515         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31516         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31517 }
31518
31519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31520         LDKAcceptChannel this_ptr_conv;
31521         this_ptr_conv.inner = untag_ptr(this_ptr);
31522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31524         this_ptr_conv.is_owned = false;
31525         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31526         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
31527         return ret_arr;
31528 }
31529
31530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31531         LDKAcceptChannel this_ptr_conv;
31532         this_ptr_conv.inner = untag_ptr(this_ptr);
31533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31535         this_ptr_conv.is_owned = false;
31536         LDKPublicKey val_ref;
31537         CHECK((*env)->GetArrayLength(env, val) == 33);
31538         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31539         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31540 }
31541
31542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31543         LDKAcceptChannel this_ptr_conv;
31544         this_ptr_conv.inner = untag_ptr(this_ptr);
31545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31547         this_ptr_conv.is_owned = false;
31548         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31549         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31550         return ret_arr;
31551 }
31552
31553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31554         LDKAcceptChannel this_ptr_conv;
31555         this_ptr_conv.inner = untag_ptr(this_ptr);
31556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31558         this_ptr_conv.is_owned = false;
31559         LDKPublicKey val_ref;
31560         CHECK((*env)->GetArrayLength(env, val) == 33);
31561         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31562         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31563 }
31564
31565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31566         LDKAcceptChannel this_ptr_conv;
31567         this_ptr_conv.inner = untag_ptr(this_ptr);
31568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31570         this_ptr_conv.is_owned = false;
31571         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31572         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31573         return ret_arr;
31574 }
31575
31576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31577         LDKAcceptChannel this_ptr_conv;
31578         this_ptr_conv.inner = untag_ptr(this_ptr);
31579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31581         this_ptr_conv.is_owned = false;
31582         LDKPublicKey val_ref;
31583         CHECK((*env)->GetArrayLength(env, val) == 33);
31584         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31585         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31586 }
31587
31588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31589         LDKAcceptChannel this_ptr_conv;
31590         this_ptr_conv.inner = untag_ptr(this_ptr);
31591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31593         this_ptr_conv.is_owned = false;
31594         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31595         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31596         return ret_arr;
31597 }
31598
31599 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) {
31600         LDKAcceptChannel this_ptr_conv;
31601         this_ptr_conv.inner = untag_ptr(this_ptr);
31602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31604         this_ptr_conv.is_owned = false;
31605         LDKPublicKey val_ref;
31606         CHECK((*env)->GetArrayLength(env, val) == 33);
31607         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31608         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31609 }
31610
31611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31612         LDKAcceptChannel this_ptr_conv;
31613         this_ptr_conv.inner = untag_ptr(this_ptr);
31614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31616         this_ptr_conv.is_owned = false;
31617         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31618         int64_t ret_ref = 0;
31619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31621         return ret_ref;
31622 }
31623
31624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31625         LDKAcceptChannel this_ptr_conv;
31626         this_ptr_conv.inner = untag_ptr(this_ptr);
31627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31629         this_ptr_conv.is_owned = false;
31630         LDKChannelTypeFeatures val_conv;
31631         val_conv.inner = untag_ptr(val);
31632         val_conv.is_owned = ptr_is_owned(val);
31633         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31634         val_conv = ChannelTypeFeatures_clone(&val_conv);
31635         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31636 }
31637
31638 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31639         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31640         int64_t ret_ref = 0;
31641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31643         return ret_ref;
31644 }
31645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31646         LDKAcceptChannel arg_conv;
31647         arg_conv.inner = untag_ptr(arg);
31648         arg_conv.is_owned = ptr_is_owned(arg);
31649         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31650         arg_conv.is_owned = false;
31651         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31652         return ret_conv;
31653 }
31654
31655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31656         LDKAcceptChannel orig_conv;
31657         orig_conv.inner = untag_ptr(orig);
31658         orig_conv.is_owned = ptr_is_owned(orig);
31659         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31660         orig_conv.is_owned = false;
31661         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31662         int64_t ret_ref = 0;
31663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31665         return ret_ref;
31666 }
31667
31668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31669         LDKFundingCreated this_obj_conv;
31670         this_obj_conv.inner = untag_ptr(this_obj);
31671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31673         FundingCreated_free(this_obj_conv);
31674 }
31675
31676 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31677         LDKFundingCreated this_ptr_conv;
31678         this_ptr_conv.inner = untag_ptr(this_ptr);
31679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31681         this_ptr_conv.is_owned = false;
31682         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31683         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
31684         return ret_arr;
31685 }
31686
31687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31688         LDKFundingCreated this_ptr_conv;
31689         this_ptr_conv.inner = untag_ptr(this_ptr);
31690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31692         this_ptr_conv.is_owned = false;
31693         LDKThirtyTwoBytes val_ref;
31694         CHECK((*env)->GetArrayLength(env, val) == 32);
31695         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31696         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31697 }
31698
31699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
31700         LDKFundingCreated this_ptr_conv;
31701         this_ptr_conv.inner = untag_ptr(this_ptr);
31702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31704         this_ptr_conv.is_owned = false;
31705         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31706         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
31707         return ret_arr;
31708 }
31709
31710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31711         LDKFundingCreated this_ptr_conv;
31712         this_ptr_conv.inner = untag_ptr(this_ptr);
31713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31715         this_ptr_conv.is_owned = false;
31716         LDKThirtyTwoBytes val_ref;
31717         CHECK((*env)->GetArrayLength(env, val) == 32);
31718         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31719         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31720 }
31721
31722 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
31723         LDKFundingCreated this_ptr_conv;
31724         this_ptr_conv.inner = untag_ptr(this_ptr);
31725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31727         this_ptr_conv.is_owned = false;
31728         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31729         return ret_conv;
31730 }
31731
31732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31733         LDKFundingCreated this_ptr_conv;
31734         this_ptr_conv.inner = untag_ptr(this_ptr);
31735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31737         this_ptr_conv.is_owned = false;
31738         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31739 }
31740
31741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31742         LDKFundingCreated this_ptr_conv;
31743         this_ptr_conv.inner = untag_ptr(this_ptr);
31744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31746         this_ptr_conv.is_owned = false;
31747         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31748         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
31749         return ret_arr;
31750 }
31751
31752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31753         LDKFundingCreated this_ptr_conv;
31754         this_ptr_conv.inner = untag_ptr(this_ptr);
31755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31757         this_ptr_conv.is_owned = false;
31758         LDKSignature val_ref;
31759         CHECK((*env)->GetArrayLength(env, val) == 64);
31760         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31761         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31762 }
31763
31764 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) {
31765         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31766         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
31767         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
31768         LDKThirtyTwoBytes funding_txid_arg_ref;
31769         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
31770         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
31771         LDKSignature signature_arg_ref;
31772         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31773         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31774         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31775         int64_t ret_ref = 0;
31776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31778         return ret_ref;
31779 }
31780
31781 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31782         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31783         int64_t ret_ref = 0;
31784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31786         return ret_ref;
31787 }
31788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31789         LDKFundingCreated arg_conv;
31790         arg_conv.inner = untag_ptr(arg);
31791         arg_conv.is_owned = ptr_is_owned(arg);
31792         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31793         arg_conv.is_owned = false;
31794         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31795         return ret_conv;
31796 }
31797
31798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31799         LDKFundingCreated orig_conv;
31800         orig_conv.inner = untag_ptr(orig);
31801         orig_conv.is_owned = ptr_is_owned(orig);
31802         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31803         orig_conv.is_owned = false;
31804         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31805         int64_t ret_ref = 0;
31806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31808         return ret_ref;
31809 }
31810
31811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31812         LDKFundingSigned this_obj_conv;
31813         this_obj_conv.inner = untag_ptr(this_obj);
31814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31816         FundingSigned_free(this_obj_conv);
31817 }
31818
31819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31820         LDKFundingSigned this_ptr_conv;
31821         this_ptr_conv.inner = untag_ptr(this_ptr);
31822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31824         this_ptr_conv.is_owned = false;
31825         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31826         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
31827         return ret_arr;
31828 }
31829
31830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31831         LDKFundingSigned this_ptr_conv;
31832         this_ptr_conv.inner = untag_ptr(this_ptr);
31833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31835         this_ptr_conv.is_owned = false;
31836         LDKThirtyTwoBytes val_ref;
31837         CHECK((*env)->GetArrayLength(env, val) == 32);
31838         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31839         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31840 }
31841
31842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31843         LDKFundingSigned this_ptr_conv;
31844         this_ptr_conv.inner = untag_ptr(this_ptr);
31845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31847         this_ptr_conv.is_owned = false;
31848         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31849         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
31850         return ret_arr;
31851 }
31852
31853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31854         LDKFundingSigned this_ptr_conv;
31855         this_ptr_conv.inner = untag_ptr(this_ptr);
31856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31858         this_ptr_conv.is_owned = false;
31859         LDKSignature val_ref;
31860         CHECK((*env)->GetArrayLength(env, val) == 64);
31861         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31862         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31863 }
31864
31865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
31866         LDKThirtyTwoBytes channel_id_arg_ref;
31867         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31868         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31869         LDKSignature signature_arg_ref;
31870         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31871         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31872         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31873         int64_t ret_ref = 0;
31874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31876         return ret_ref;
31877 }
31878
31879 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31880         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31881         int64_t ret_ref = 0;
31882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31884         return ret_ref;
31885 }
31886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31887         LDKFundingSigned arg_conv;
31888         arg_conv.inner = untag_ptr(arg);
31889         arg_conv.is_owned = ptr_is_owned(arg);
31890         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31891         arg_conv.is_owned = false;
31892         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31893         return ret_conv;
31894 }
31895
31896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31897         LDKFundingSigned orig_conv;
31898         orig_conv.inner = untag_ptr(orig);
31899         orig_conv.is_owned = ptr_is_owned(orig);
31900         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31901         orig_conv.is_owned = false;
31902         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31903         int64_t ret_ref = 0;
31904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31906         return ret_ref;
31907 }
31908
31909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31910         LDKChannelReady this_obj_conv;
31911         this_obj_conv.inner = untag_ptr(this_obj);
31912         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31914         ChannelReady_free(this_obj_conv);
31915 }
31916
31917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31918         LDKChannelReady this_ptr_conv;
31919         this_ptr_conv.inner = untag_ptr(this_ptr);
31920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31922         this_ptr_conv.is_owned = false;
31923         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31924         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
31925         return ret_arr;
31926 }
31927
31928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31929         LDKChannelReady this_ptr_conv;
31930         this_ptr_conv.inner = untag_ptr(this_ptr);
31931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31933         this_ptr_conv.is_owned = false;
31934         LDKThirtyTwoBytes val_ref;
31935         CHECK((*env)->GetArrayLength(env, val) == 32);
31936         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31937         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31938 }
31939
31940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31941         LDKChannelReady this_ptr_conv;
31942         this_ptr_conv.inner = untag_ptr(this_ptr);
31943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31945         this_ptr_conv.is_owned = false;
31946         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31947         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
31948         return ret_arr;
31949 }
31950
31951 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) {
31952         LDKChannelReady this_ptr_conv;
31953         this_ptr_conv.inner = untag_ptr(this_ptr);
31954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31956         this_ptr_conv.is_owned = false;
31957         LDKPublicKey val_ref;
31958         CHECK((*env)->GetArrayLength(env, val) == 33);
31959         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31960         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31961 }
31962
31963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
31964         LDKChannelReady this_ptr_conv;
31965         this_ptr_conv.inner = untag_ptr(this_ptr);
31966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31968         this_ptr_conv.is_owned = false;
31969         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31970         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31971         int64_t ret_ref = tag_ptr(ret_copy, true);
31972         return ret_ref;
31973 }
31974
31975 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) {
31976         LDKChannelReady this_ptr_conv;
31977         this_ptr_conv.inner = untag_ptr(this_ptr);
31978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31980         this_ptr_conv.is_owned = false;
31981         void* val_ptr = untag_ptr(val);
31982         CHECK_ACCESS(val_ptr);
31983         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31984         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31985         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31986 }
31987
31988 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) {
31989         LDKThirtyTwoBytes channel_id_arg_ref;
31990         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31991         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31992         LDKPublicKey next_per_commitment_point_arg_ref;
31993         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
31994         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
31995         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
31996         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31997         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31998         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
31999         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
32000         int64_t ret_ref = 0;
32001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32003         return ret_ref;
32004 }
32005
32006 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
32007         LDKChannelReady ret_var = ChannelReady_clone(arg);
32008         int64_t ret_ref = 0;
32009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32011         return ret_ref;
32012 }
32013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32014         LDKChannelReady arg_conv;
32015         arg_conv.inner = untag_ptr(arg);
32016         arg_conv.is_owned = ptr_is_owned(arg);
32017         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32018         arg_conv.is_owned = false;
32019         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
32020         return ret_conv;
32021 }
32022
32023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32024         LDKChannelReady orig_conv;
32025         orig_conv.inner = untag_ptr(orig);
32026         orig_conv.is_owned = ptr_is_owned(orig);
32027         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32028         orig_conv.is_owned = false;
32029         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
32030         int64_t ret_ref = 0;
32031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32033         return ret_ref;
32034 }
32035
32036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32037         LDKShutdown this_obj_conv;
32038         this_obj_conv.inner = untag_ptr(this_obj);
32039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32041         Shutdown_free(this_obj_conv);
32042 }
32043
32044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32045         LDKShutdown this_ptr_conv;
32046         this_ptr_conv.inner = untag_ptr(this_ptr);
32047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32049         this_ptr_conv.is_owned = false;
32050         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32051         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
32052         return ret_arr;
32053 }
32054
32055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32056         LDKShutdown 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         LDKThirtyTwoBytes val_ref;
32062         CHECK((*env)->GetArrayLength(env, val) == 32);
32063         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32064         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32065 }
32066
32067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32068         LDKShutdown this_ptr_conv;
32069         this_ptr_conv.inner = untag_ptr(this_ptr);
32070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32072         this_ptr_conv.is_owned = false;
32073         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32074         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32075         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32076         return ret_arr;
32077 }
32078
32079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32080         LDKShutdown this_ptr_conv;
32081         this_ptr_conv.inner = untag_ptr(this_ptr);
32082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32084         this_ptr_conv.is_owned = false;
32085         LDKCVec_u8Z val_ref;
32086         val_ref.datalen = (*env)->GetArrayLength(env, val);
32087         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32088         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
32089         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32090 }
32091
32092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32093         LDKThirtyTwoBytes channel_id_arg_ref;
32094         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32095         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32096         LDKCVec_u8Z scriptpubkey_arg_ref;
32097         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
32098         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32099         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
32100         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32101         int64_t ret_ref = 0;
32102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32104         return ret_ref;
32105 }
32106
32107 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32108         LDKShutdown ret_var = Shutdown_clone(arg);
32109         int64_t ret_ref = 0;
32110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32112         return ret_ref;
32113 }
32114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32115         LDKShutdown arg_conv;
32116         arg_conv.inner = untag_ptr(arg);
32117         arg_conv.is_owned = ptr_is_owned(arg);
32118         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32119         arg_conv.is_owned = false;
32120         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32121         return ret_conv;
32122 }
32123
32124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32125         LDKShutdown orig_conv;
32126         orig_conv.inner = untag_ptr(orig);
32127         orig_conv.is_owned = ptr_is_owned(orig);
32128         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32129         orig_conv.is_owned = false;
32130         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32131         int64_t ret_ref = 0;
32132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32134         return ret_ref;
32135 }
32136
32137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32138         LDKClosingSignedFeeRange this_obj_conv;
32139         this_obj_conv.inner = untag_ptr(this_obj);
32140         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32142         ClosingSignedFeeRange_free(this_obj_conv);
32143 }
32144
32145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32146         LDKClosingSignedFeeRange this_ptr_conv;
32147         this_ptr_conv.inner = untag_ptr(this_ptr);
32148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32150         this_ptr_conv.is_owned = false;
32151         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32152         return ret_conv;
32153 }
32154
32155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32156         LDKClosingSignedFeeRange this_ptr_conv;
32157         this_ptr_conv.inner = untag_ptr(this_ptr);
32158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32160         this_ptr_conv.is_owned = false;
32161         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32162 }
32163
32164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32165         LDKClosingSignedFeeRange this_ptr_conv;
32166         this_ptr_conv.inner = untag_ptr(this_ptr);
32167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32169         this_ptr_conv.is_owned = false;
32170         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32171         return ret_conv;
32172 }
32173
32174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32175         LDKClosingSignedFeeRange this_ptr_conv;
32176         this_ptr_conv.inner = untag_ptr(this_ptr);
32177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32179         this_ptr_conv.is_owned = false;
32180         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32181 }
32182
32183 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) {
32184         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32185         int64_t ret_ref = 0;
32186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32188         return ret_ref;
32189 }
32190
32191 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32192         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32193         int64_t ret_ref = 0;
32194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32196         return ret_ref;
32197 }
32198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32199         LDKClosingSignedFeeRange arg_conv;
32200         arg_conv.inner = untag_ptr(arg);
32201         arg_conv.is_owned = ptr_is_owned(arg);
32202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32203         arg_conv.is_owned = false;
32204         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32205         return ret_conv;
32206 }
32207
32208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32209         LDKClosingSignedFeeRange orig_conv;
32210         orig_conv.inner = untag_ptr(orig);
32211         orig_conv.is_owned = ptr_is_owned(orig);
32212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32213         orig_conv.is_owned = false;
32214         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32215         int64_t ret_ref = 0;
32216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32218         return ret_ref;
32219 }
32220
32221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32222         LDKClosingSigned this_obj_conv;
32223         this_obj_conv.inner = untag_ptr(this_obj);
32224         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32226         ClosingSigned_free(this_obj_conv);
32227 }
32228
32229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32230         LDKClosingSigned this_ptr_conv;
32231         this_ptr_conv.inner = untag_ptr(this_ptr);
32232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32234         this_ptr_conv.is_owned = false;
32235         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32236         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
32237         return ret_arr;
32238 }
32239
32240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32241         LDKClosingSigned this_ptr_conv;
32242         this_ptr_conv.inner = untag_ptr(this_ptr);
32243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32245         this_ptr_conv.is_owned = false;
32246         LDKThirtyTwoBytes val_ref;
32247         CHECK((*env)->GetArrayLength(env, val) == 32);
32248         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32249         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32250 }
32251
32252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32253         LDKClosingSigned this_ptr_conv;
32254         this_ptr_conv.inner = untag_ptr(this_ptr);
32255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32257         this_ptr_conv.is_owned = false;
32258         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32259         return ret_conv;
32260 }
32261
32262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32263         LDKClosingSigned this_ptr_conv;
32264         this_ptr_conv.inner = untag_ptr(this_ptr);
32265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32267         this_ptr_conv.is_owned = false;
32268         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32269 }
32270
32271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32272         LDKClosingSigned this_ptr_conv;
32273         this_ptr_conv.inner = untag_ptr(this_ptr);
32274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32276         this_ptr_conv.is_owned = false;
32277         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32278         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
32279         return ret_arr;
32280 }
32281
32282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32283         LDKClosingSigned this_ptr_conv;
32284         this_ptr_conv.inner = untag_ptr(this_ptr);
32285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32287         this_ptr_conv.is_owned = false;
32288         LDKSignature val_ref;
32289         CHECK((*env)->GetArrayLength(env, val) == 64);
32290         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32291         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32292 }
32293
32294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
32295         LDKClosingSigned this_ptr_conv;
32296         this_ptr_conv.inner = untag_ptr(this_ptr);
32297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32299         this_ptr_conv.is_owned = false;
32300         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32301         int64_t ret_ref = 0;
32302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32304         return ret_ref;
32305 }
32306
32307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32308         LDKClosingSigned this_ptr_conv;
32309         this_ptr_conv.inner = untag_ptr(this_ptr);
32310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32312         this_ptr_conv.is_owned = false;
32313         LDKClosingSignedFeeRange val_conv;
32314         val_conv.inner = untag_ptr(val);
32315         val_conv.is_owned = ptr_is_owned(val);
32316         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32317         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32318         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32319 }
32320
32321 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) {
32322         LDKThirtyTwoBytes channel_id_arg_ref;
32323         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32324         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32325         LDKSignature signature_arg_ref;
32326         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32327         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32328         LDKClosingSignedFeeRange fee_range_arg_conv;
32329         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32330         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32331         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32332         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32333         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32334         int64_t ret_ref = 0;
32335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32337         return ret_ref;
32338 }
32339
32340 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32341         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32342         int64_t ret_ref = 0;
32343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32345         return ret_ref;
32346 }
32347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32348         LDKClosingSigned arg_conv;
32349         arg_conv.inner = untag_ptr(arg);
32350         arg_conv.is_owned = ptr_is_owned(arg);
32351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32352         arg_conv.is_owned = false;
32353         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32354         return ret_conv;
32355 }
32356
32357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32358         LDKClosingSigned orig_conv;
32359         orig_conv.inner = untag_ptr(orig);
32360         orig_conv.is_owned = ptr_is_owned(orig);
32361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32362         orig_conv.is_owned = false;
32363         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32364         int64_t ret_ref = 0;
32365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32367         return ret_ref;
32368 }
32369
32370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32371         LDKUpdateAddHTLC this_obj_conv;
32372         this_obj_conv.inner = untag_ptr(this_obj);
32373         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32375         UpdateAddHTLC_free(this_obj_conv);
32376 }
32377
32378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32379         LDKUpdateAddHTLC this_ptr_conv;
32380         this_ptr_conv.inner = untag_ptr(this_ptr);
32381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32383         this_ptr_conv.is_owned = false;
32384         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32385         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
32386         return ret_arr;
32387 }
32388
32389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32390         LDKUpdateAddHTLC this_ptr_conv;
32391         this_ptr_conv.inner = untag_ptr(this_ptr);
32392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32394         this_ptr_conv.is_owned = false;
32395         LDKThirtyTwoBytes val_ref;
32396         CHECK((*env)->GetArrayLength(env, val) == 32);
32397         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32398         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32399 }
32400
32401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32402         LDKUpdateAddHTLC this_ptr_conv;
32403         this_ptr_conv.inner = untag_ptr(this_ptr);
32404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32406         this_ptr_conv.is_owned = false;
32407         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32408         return ret_conv;
32409 }
32410
32411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32412         LDKUpdateAddHTLC this_ptr_conv;
32413         this_ptr_conv.inner = untag_ptr(this_ptr);
32414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32416         this_ptr_conv.is_owned = false;
32417         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32418 }
32419
32420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32421         LDKUpdateAddHTLC this_ptr_conv;
32422         this_ptr_conv.inner = untag_ptr(this_ptr);
32423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32425         this_ptr_conv.is_owned = false;
32426         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32427         return ret_conv;
32428 }
32429
32430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32431         LDKUpdateAddHTLC this_ptr_conv;
32432         this_ptr_conv.inner = untag_ptr(this_ptr);
32433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32435         this_ptr_conv.is_owned = false;
32436         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32437 }
32438
32439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32440         LDKUpdateAddHTLC this_ptr_conv;
32441         this_ptr_conv.inner = untag_ptr(this_ptr);
32442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32444         this_ptr_conv.is_owned = false;
32445         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32446         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
32447         return ret_arr;
32448 }
32449
32450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32451         LDKUpdateAddHTLC this_ptr_conv;
32452         this_ptr_conv.inner = untag_ptr(this_ptr);
32453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32455         this_ptr_conv.is_owned = false;
32456         LDKThirtyTwoBytes val_ref;
32457         CHECK((*env)->GetArrayLength(env, val) == 32);
32458         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32459         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32460 }
32461
32462 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
32463         LDKUpdateAddHTLC this_ptr_conv;
32464         this_ptr_conv.inner = untag_ptr(this_ptr);
32465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32467         this_ptr_conv.is_owned = false;
32468         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32469         return ret_conv;
32470 }
32471
32472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32473         LDKUpdateAddHTLC this_ptr_conv;
32474         this_ptr_conv.inner = untag_ptr(this_ptr);
32475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32477         this_ptr_conv.is_owned = false;
32478         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32479 }
32480
32481 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32482         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32483         int64_t ret_ref = 0;
32484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32486         return ret_ref;
32487 }
32488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32489         LDKUpdateAddHTLC arg_conv;
32490         arg_conv.inner = untag_ptr(arg);
32491         arg_conv.is_owned = ptr_is_owned(arg);
32492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32493         arg_conv.is_owned = false;
32494         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32495         return ret_conv;
32496 }
32497
32498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32499         LDKUpdateAddHTLC orig_conv;
32500         orig_conv.inner = untag_ptr(orig);
32501         orig_conv.is_owned = ptr_is_owned(orig);
32502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32503         orig_conv.is_owned = false;
32504         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32505         int64_t ret_ref = 0;
32506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32508         return ret_ref;
32509 }
32510
32511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32512         LDKUpdateFulfillHTLC this_obj_conv;
32513         this_obj_conv.inner = untag_ptr(this_obj);
32514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32516         UpdateFulfillHTLC_free(this_obj_conv);
32517 }
32518
32519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32520         LDKUpdateFulfillHTLC this_ptr_conv;
32521         this_ptr_conv.inner = untag_ptr(this_ptr);
32522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32524         this_ptr_conv.is_owned = false;
32525         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32526         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
32527         return ret_arr;
32528 }
32529
32530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32531         LDKUpdateFulfillHTLC this_ptr_conv;
32532         this_ptr_conv.inner = untag_ptr(this_ptr);
32533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32535         this_ptr_conv.is_owned = false;
32536         LDKThirtyTwoBytes val_ref;
32537         CHECK((*env)->GetArrayLength(env, val) == 32);
32538         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32539         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32540 }
32541
32542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32543         LDKUpdateFulfillHTLC this_ptr_conv;
32544         this_ptr_conv.inner = untag_ptr(this_ptr);
32545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32547         this_ptr_conv.is_owned = false;
32548         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32549         return ret_conv;
32550 }
32551
32552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32553         LDKUpdateFulfillHTLC this_ptr_conv;
32554         this_ptr_conv.inner = untag_ptr(this_ptr);
32555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32557         this_ptr_conv.is_owned = false;
32558         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32559 }
32560
32561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
32562         LDKUpdateFulfillHTLC this_ptr_conv;
32563         this_ptr_conv.inner = untag_ptr(this_ptr);
32564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32566         this_ptr_conv.is_owned = false;
32567         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32568         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
32569         return ret_arr;
32570 }
32571
32572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32573         LDKUpdateFulfillHTLC this_ptr_conv;
32574         this_ptr_conv.inner = untag_ptr(this_ptr);
32575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32577         this_ptr_conv.is_owned = false;
32578         LDKThirtyTwoBytes val_ref;
32579         CHECK((*env)->GetArrayLength(env, val) == 32);
32580         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32581         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32582 }
32583
32584 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) {
32585         LDKThirtyTwoBytes channel_id_arg_ref;
32586         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32587         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32588         LDKThirtyTwoBytes payment_preimage_arg_ref;
32589         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
32590         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
32591         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32592         int64_t ret_ref = 0;
32593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32595         return ret_ref;
32596 }
32597
32598 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32599         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32600         int64_t ret_ref = 0;
32601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32603         return ret_ref;
32604 }
32605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32606         LDKUpdateFulfillHTLC arg_conv;
32607         arg_conv.inner = untag_ptr(arg);
32608         arg_conv.is_owned = ptr_is_owned(arg);
32609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32610         arg_conv.is_owned = false;
32611         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32612         return ret_conv;
32613 }
32614
32615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32616         LDKUpdateFulfillHTLC orig_conv;
32617         orig_conv.inner = untag_ptr(orig);
32618         orig_conv.is_owned = ptr_is_owned(orig);
32619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32620         orig_conv.is_owned = false;
32621         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32622         int64_t ret_ref = 0;
32623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32625         return ret_ref;
32626 }
32627
32628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32629         LDKUpdateFailHTLC this_obj_conv;
32630         this_obj_conv.inner = untag_ptr(this_obj);
32631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32633         UpdateFailHTLC_free(this_obj_conv);
32634 }
32635
32636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32637         LDKUpdateFailHTLC this_ptr_conv;
32638         this_ptr_conv.inner = untag_ptr(this_ptr);
32639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32641         this_ptr_conv.is_owned = false;
32642         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32643         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
32644         return ret_arr;
32645 }
32646
32647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32648         LDKUpdateFailHTLC this_ptr_conv;
32649         this_ptr_conv.inner = untag_ptr(this_ptr);
32650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32652         this_ptr_conv.is_owned = false;
32653         LDKThirtyTwoBytes val_ref;
32654         CHECK((*env)->GetArrayLength(env, val) == 32);
32655         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32656         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32657 }
32658
32659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32660         LDKUpdateFailHTLC this_ptr_conv;
32661         this_ptr_conv.inner = untag_ptr(this_ptr);
32662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32664         this_ptr_conv.is_owned = false;
32665         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32666         return ret_conv;
32667 }
32668
32669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32670         LDKUpdateFailHTLC this_ptr_conv;
32671         this_ptr_conv.inner = untag_ptr(this_ptr);
32672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32674         this_ptr_conv.is_owned = false;
32675         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32676 }
32677
32678 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32679         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32680         int64_t ret_ref = 0;
32681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32683         return ret_ref;
32684 }
32685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32686         LDKUpdateFailHTLC arg_conv;
32687         arg_conv.inner = untag_ptr(arg);
32688         arg_conv.is_owned = ptr_is_owned(arg);
32689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32690         arg_conv.is_owned = false;
32691         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32692         return ret_conv;
32693 }
32694
32695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32696         LDKUpdateFailHTLC orig_conv;
32697         orig_conv.inner = untag_ptr(orig);
32698         orig_conv.is_owned = ptr_is_owned(orig);
32699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32700         orig_conv.is_owned = false;
32701         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32702         int64_t ret_ref = 0;
32703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32705         return ret_ref;
32706 }
32707
32708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32709         LDKUpdateFailMalformedHTLC this_obj_conv;
32710         this_obj_conv.inner = untag_ptr(this_obj);
32711         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32713         UpdateFailMalformedHTLC_free(this_obj_conv);
32714 }
32715
32716 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32717         LDKUpdateFailMalformedHTLC this_ptr_conv;
32718         this_ptr_conv.inner = untag_ptr(this_ptr);
32719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32721         this_ptr_conv.is_owned = false;
32722         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32723         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
32724         return ret_arr;
32725 }
32726
32727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32728         LDKUpdateFailMalformedHTLC this_ptr_conv;
32729         this_ptr_conv.inner = untag_ptr(this_ptr);
32730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32732         this_ptr_conv.is_owned = false;
32733         LDKThirtyTwoBytes val_ref;
32734         CHECK((*env)->GetArrayLength(env, val) == 32);
32735         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32736         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32737 }
32738
32739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32740         LDKUpdateFailMalformedHTLC this_ptr_conv;
32741         this_ptr_conv.inner = untag_ptr(this_ptr);
32742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32744         this_ptr_conv.is_owned = false;
32745         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32746         return ret_conv;
32747 }
32748
32749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32750         LDKUpdateFailMalformedHTLC this_ptr_conv;
32751         this_ptr_conv.inner = untag_ptr(this_ptr);
32752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32754         this_ptr_conv.is_owned = false;
32755         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32756 }
32757
32758 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
32759         LDKUpdateFailMalformedHTLC this_ptr_conv;
32760         this_ptr_conv.inner = untag_ptr(this_ptr);
32761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32763         this_ptr_conv.is_owned = false;
32764         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32765         return ret_conv;
32766 }
32767
32768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32769         LDKUpdateFailMalformedHTLC this_ptr_conv;
32770         this_ptr_conv.inner = untag_ptr(this_ptr);
32771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32773         this_ptr_conv.is_owned = false;
32774         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32775 }
32776
32777 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32778         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32779         int64_t ret_ref = 0;
32780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32782         return ret_ref;
32783 }
32784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32785         LDKUpdateFailMalformedHTLC arg_conv;
32786         arg_conv.inner = untag_ptr(arg);
32787         arg_conv.is_owned = ptr_is_owned(arg);
32788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32789         arg_conv.is_owned = false;
32790         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32791         return ret_conv;
32792 }
32793
32794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32795         LDKUpdateFailMalformedHTLC orig_conv;
32796         orig_conv.inner = untag_ptr(orig);
32797         orig_conv.is_owned = ptr_is_owned(orig);
32798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32799         orig_conv.is_owned = false;
32800         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32801         int64_t ret_ref = 0;
32802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32804         return ret_ref;
32805 }
32806
32807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32808         LDKCommitmentSigned this_obj_conv;
32809         this_obj_conv.inner = untag_ptr(this_obj);
32810         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32812         CommitmentSigned_free(this_obj_conv);
32813 }
32814
32815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32816         LDKCommitmentSigned this_ptr_conv;
32817         this_ptr_conv.inner = untag_ptr(this_ptr);
32818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32820         this_ptr_conv.is_owned = false;
32821         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32822         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
32823         return ret_arr;
32824 }
32825
32826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32827         LDKCommitmentSigned this_ptr_conv;
32828         this_ptr_conv.inner = untag_ptr(this_ptr);
32829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32831         this_ptr_conv.is_owned = false;
32832         LDKThirtyTwoBytes val_ref;
32833         CHECK((*env)->GetArrayLength(env, val) == 32);
32834         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32835         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32836 }
32837
32838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32839         LDKCommitmentSigned this_ptr_conv;
32840         this_ptr_conv.inner = untag_ptr(this_ptr);
32841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32843         this_ptr_conv.is_owned = false;
32844         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32845         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
32846         return ret_arr;
32847 }
32848
32849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32850         LDKCommitmentSigned this_ptr_conv;
32851         this_ptr_conv.inner = untag_ptr(this_ptr);
32852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32854         this_ptr_conv.is_owned = false;
32855         LDKSignature val_ref;
32856         CHECK((*env)->GetArrayLength(env, val) == 64);
32857         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32858         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32859 }
32860
32861 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
32862         LDKCommitmentSigned this_ptr_conv;
32863         this_ptr_conv.inner = untag_ptr(this_ptr);
32864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32866         this_ptr_conv.is_owned = false;
32867         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
32868         jobjectArray ret_arr = NULL;
32869         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
32870         ;
32871         for (size_t i = 0; i < ret_var.datalen; i++) {
32872                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
32873                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
32874                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
32875         }
32876         
32877         FREE(ret_var.data);
32878         return ret_arr;
32879 }
32880
32881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
32882         LDKCommitmentSigned this_ptr_conv;
32883         this_ptr_conv.inner = untag_ptr(this_ptr);
32884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32886         this_ptr_conv.is_owned = false;
32887         LDKCVec_SignatureZ val_constr;
32888         val_constr.datalen = (*env)->GetArrayLength(env, val);
32889         if (val_constr.datalen > 0)
32890                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32891         else
32892                 val_constr.data = NULL;
32893         for (size_t i = 0; i < val_constr.datalen; i++) {
32894                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
32895                 LDKSignature val_conv_8_ref;
32896                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
32897                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
32898                 val_constr.data[i] = val_conv_8_ref;
32899         }
32900         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
32901 }
32902
32903 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) {
32904         LDKThirtyTwoBytes channel_id_arg_ref;
32905         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32906         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32907         LDKSignature signature_arg_ref;
32908         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32909         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32910         LDKCVec_SignatureZ htlc_signatures_arg_constr;
32911         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
32912         if (htlc_signatures_arg_constr.datalen > 0)
32913                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32914         else
32915                 htlc_signatures_arg_constr.data = NULL;
32916         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
32917                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
32918                 LDKSignature htlc_signatures_arg_conv_8_ref;
32919                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
32920                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
32921                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
32922         }
32923         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
32924         int64_t ret_ref = 0;
32925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32927         return ret_ref;
32928 }
32929
32930 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
32931         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
32932         int64_t ret_ref = 0;
32933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32935         return ret_ref;
32936 }
32937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32938         LDKCommitmentSigned arg_conv;
32939         arg_conv.inner = untag_ptr(arg);
32940         arg_conv.is_owned = ptr_is_owned(arg);
32941         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32942         arg_conv.is_owned = false;
32943         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
32944         return ret_conv;
32945 }
32946
32947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32948         LDKCommitmentSigned orig_conv;
32949         orig_conv.inner = untag_ptr(orig);
32950         orig_conv.is_owned = ptr_is_owned(orig);
32951         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32952         orig_conv.is_owned = false;
32953         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
32954         int64_t ret_ref = 0;
32955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32957         return ret_ref;
32958 }
32959
32960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32961         LDKRevokeAndACK this_obj_conv;
32962         this_obj_conv.inner = untag_ptr(this_obj);
32963         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32965         RevokeAndACK_free(this_obj_conv);
32966 }
32967
32968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32969         LDKRevokeAndACK this_ptr_conv;
32970         this_ptr_conv.inner = untag_ptr(this_ptr);
32971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32973         this_ptr_conv.is_owned = false;
32974         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32975         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
32976         return ret_arr;
32977 }
32978
32979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32980         LDKRevokeAndACK this_ptr_conv;
32981         this_ptr_conv.inner = untag_ptr(this_ptr);
32982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32984         this_ptr_conv.is_owned = false;
32985         LDKThirtyTwoBytes val_ref;
32986         CHECK((*env)->GetArrayLength(env, val) == 32);
32987         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32988         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
32989 }
32990
32991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
32992         LDKRevokeAndACK this_ptr_conv;
32993         this_ptr_conv.inner = untag_ptr(this_ptr);
32994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32996         this_ptr_conv.is_owned = false;
32997         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32998         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
32999         return ret_arr;
33000 }
33001
33002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33003         LDKRevokeAndACK this_ptr_conv;
33004         this_ptr_conv.inner = untag_ptr(this_ptr);
33005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33007         this_ptr_conv.is_owned = false;
33008         LDKThirtyTwoBytes val_ref;
33009         CHECK((*env)->GetArrayLength(env, val) == 32);
33010         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33011         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33012 }
33013
33014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33015         LDKRevokeAndACK this_ptr_conv;
33016         this_ptr_conv.inner = untag_ptr(this_ptr);
33017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33019         this_ptr_conv.is_owned = false;
33020         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33021         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33022         return ret_arr;
33023 }
33024
33025 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) {
33026         LDKRevokeAndACK this_ptr_conv;
33027         this_ptr_conv.inner = untag_ptr(this_ptr);
33028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33030         this_ptr_conv.is_owned = false;
33031         LDKPublicKey val_ref;
33032         CHECK((*env)->GetArrayLength(env, val) == 33);
33033         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33034         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33035 }
33036
33037 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) {
33038         LDKThirtyTwoBytes channel_id_arg_ref;
33039         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33040         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33041         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33042         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
33043         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
33044         LDKPublicKey next_per_commitment_point_arg_ref;
33045         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33046         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33047         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33048         int64_t ret_ref = 0;
33049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33051         return ret_ref;
33052 }
33053
33054 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33055         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33056         int64_t ret_ref = 0;
33057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33059         return ret_ref;
33060 }
33061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33062         LDKRevokeAndACK arg_conv;
33063         arg_conv.inner = untag_ptr(arg);
33064         arg_conv.is_owned = ptr_is_owned(arg);
33065         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33066         arg_conv.is_owned = false;
33067         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33068         return ret_conv;
33069 }
33070
33071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33072         LDKRevokeAndACK orig_conv;
33073         orig_conv.inner = untag_ptr(orig);
33074         orig_conv.is_owned = ptr_is_owned(orig);
33075         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33076         orig_conv.is_owned = false;
33077         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33078         int64_t ret_ref = 0;
33079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33081         return ret_ref;
33082 }
33083
33084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33085         LDKUpdateFee this_obj_conv;
33086         this_obj_conv.inner = untag_ptr(this_obj);
33087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33089         UpdateFee_free(this_obj_conv);
33090 }
33091
33092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33093         LDKUpdateFee this_ptr_conv;
33094         this_ptr_conv.inner = untag_ptr(this_ptr);
33095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33097         this_ptr_conv.is_owned = false;
33098         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33099         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
33100         return ret_arr;
33101 }
33102
33103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33104         LDKUpdateFee this_ptr_conv;
33105         this_ptr_conv.inner = untag_ptr(this_ptr);
33106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33108         this_ptr_conv.is_owned = false;
33109         LDKThirtyTwoBytes val_ref;
33110         CHECK((*env)->GetArrayLength(env, val) == 32);
33111         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33112         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33113 }
33114
33115 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
33116         LDKUpdateFee this_ptr_conv;
33117         this_ptr_conv.inner = untag_ptr(this_ptr);
33118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33120         this_ptr_conv.is_owned = false;
33121         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33122         return ret_conv;
33123 }
33124
33125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33126         LDKUpdateFee this_ptr_conv;
33127         this_ptr_conv.inner = untag_ptr(this_ptr);
33128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33130         this_ptr_conv.is_owned = false;
33131         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33132 }
33133
33134 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) {
33135         LDKThirtyTwoBytes channel_id_arg_ref;
33136         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33137         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33138         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33139         int64_t ret_ref = 0;
33140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33142         return ret_ref;
33143 }
33144
33145 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33146         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33147         int64_t ret_ref = 0;
33148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33150         return ret_ref;
33151 }
33152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33153         LDKUpdateFee arg_conv;
33154         arg_conv.inner = untag_ptr(arg);
33155         arg_conv.is_owned = ptr_is_owned(arg);
33156         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33157         arg_conv.is_owned = false;
33158         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33159         return ret_conv;
33160 }
33161
33162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33163         LDKUpdateFee orig_conv;
33164         orig_conv.inner = untag_ptr(orig);
33165         orig_conv.is_owned = ptr_is_owned(orig);
33166         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33167         orig_conv.is_owned = false;
33168         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33169         int64_t ret_ref = 0;
33170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33172         return ret_ref;
33173 }
33174
33175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33176         LDKDataLossProtect this_obj_conv;
33177         this_obj_conv.inner = untag_ptr(this_obj);
33178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33180         DataLossProtect_free(this_obj_conv);
33181 }
33182
33183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33184         LDKDataLossProtect this_ptr_conv;
33185         this_ptr_conv.inner = untag_ptr(this_ptr);
33186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33188         this_ptr_conv.is_owned = false;
33189         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33190         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
33191         return ret_arr;
33192 }
33193
33194 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) {
33195         LDKDataLossProtect this_ptr_conv;
33196         this_ptr_conv.inner = untag_ptr(this_ptr);
33197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33199         this_ptr_conv.is_owned = false;
33200         LDKThirtyTwoBytes val_ref;
33201         CHECK((*env)->GetArrayLength(env, val) == 32);
33202         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33203         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33204 }
33205
33206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33207         LDKDataLossProtect this_ptr_conv;
33208         this_ptr_conv.inner = untag_ptr(this_ptr);
33209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33211         this_ptr_conv.is_owned = false;
33212         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33213         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
33214         return ret_arr;
33215 }
33216
33217 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) {
33218         LDKDataLossProtect this_ptr_conv;
33219         this_ptr_conv.inner = untag_ptr(this_ptr);
33220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33222         this_ptr_conv.is_owned = false;
33223         LDKPublicKey val_ref;
33224         CHECK((*env)->GetArrayLength(env, val) == 33);
33225         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33226         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33227 }
33228
33229 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) {
33230         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33231         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
33232         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
33233         LDKPublicKey my_current_per_commitment_point_arg_ref;
33234         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
33235         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
33236         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33237         int64_t ret_ref = 0;
33238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33240         return ret_ref;
33241 }
33242
33243 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33244         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33245         int64_t ret_ref = 0;
33246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33248         return ret_ref;
33249 }
33250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33251         LDKDataLossProtect arg_conv;
33252         arg_conv.inner = untag_ptr(arg);
33253         arg_conv.is_owned = ptr_is_owned(arg);
33254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33255         arg_conv.is_owned = false;
33256         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33257         return ret_conv;
33258 }
33259
33260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33261         LDKDataLossProtect orig_conv;
33262         orig_conv.inner = untag_ptr(orig);
33263         orig_conv.is_owned = ptr_is_owned(orig);
33264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33265         orig_conv.is_owned = false;
33266         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33267         int64_t ret_ref = 0;
33268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33270         return ret_ref;
33271 }
33272
33273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33274         LDKChannelReestablish this_obj_conv;
33275         this_obj_conv.inner = untag_ptr(this_obj);
33276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33278         ChannelReestablish_free(this_obj_conv);
33279 }
33280
33281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33282         LDKChannelReestablish this_ptr_conv;
33283         this_ptr_conv.inner = untag_ptr(this_ptr);
33284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33286         this_ptr_conv.is_owned = false;
33287         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33288         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
33289         return ret_arr;
33290 }
33291
33292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33293         LDKChannelReestablish this_ptr_conv;
33294         this_ptr_conv.inner = untag_ptr(this_ptr);
33295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33297         this_ptr_conv.is_owned = false;
33298         LDKThirtyTwoBytes val_ref;
33299         CHECK((*env)->GetArrayLength(env, val) == 32);
33300         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33301         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33302 }
33303
33304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33305         LDKChannelReestablish this_ptr_conv;
33306         this_ptr_conv.inner = untag_ptr(this_ptr);
33307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33309         this_ptr_conv.is_owned = false;
33310         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33311         return ret_conv;
33312 }
33313
33314 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) {
33315         LDKChannelReestablish this_ptr_conv;
33316         this_ptr_conv.inner = untag_ptr(this_ptr);
33317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33319         this_ptr_conv.is_owned = false;
33320         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33321 }
33322
33323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33324         LDKChannelReestablish this_ptr_conv;
33325         this_ptr_conv.inner = untag_ptr(this_ptr);
33326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33328         this_ptr_conv.is_owned = false;
33329         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33330         return ret_conv;
33331 }
33332
33333 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) {
33334         LDKChannelReestablish this_ptr_conv;
33335         this_ptr_conv.inner = untag_ptr(this_ptr);
33336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33338         this_ptr_conv.is_owned = false;
33339         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33340 }
33341
33342 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33343         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33344         int64_t ret_ref = 0;
33345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33347         return ret_ref;
33348 }
33349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33350         LDKChannelReestablish arg_conv;
33351         arg_conv.inner = untag_ptr(arg);
33352         arg_conv.is_owned = ptr_is_owned(arg);
33353         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33354         arg_conv.is_owned = false;
33355         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33356         return ret_conv;
33357 }
33358
33359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33360         LDKChannelReestablish orig_conv;
33361         orig_conv.inner = untag_ptr(orig);
33362         orig_conv.is_owned = ptr_is_owned(orig);
33363         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33364         orig_conv.is_owned = false;
33365         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33366         int64_t ret_ref = 0;
33367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33369         return ret_ref;
33370 }
33371
33372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33373         LDKAnnouncementSignatures this_obj_conv;
33374         this_obj_conv.inner = untag_ptr(this_obj);
33375         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33377         AnnouncementSignatures_free(this_obj_conv);
33378 }
33379
33380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33381         LDKAnnouncementSignatures this_ptr_conv;
33382         this_ptr_conv.inner = untag_ptr(this_ptr);
33383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33385         this_ptr_conv.is_owned = false;
33386         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33387         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
33388         return ret_arr;
33389 }
33390
33391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33392         LDKAnnouncementSignatures this_ptr_conv;
33393         this_ptr_conv.inner = untag_ptr(this_ptr);
33394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33396         this_ptr_conv.is_owned = false;
33397         LDKThirtyTwoBytes val_ref;
33398         CHECK((*env)->GetArrayLength(env, val) == 32);
33399         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33400         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33401 }
33402
33403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33404         LDKAnnouncementSignatures this_ptr_conv;
33405         this_ptr_conv.inner = untag_ptr(this_ptr);
33406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33408         this_ptr_conv.is_owned = false;
33409         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33410         return ret_conv;
33411 }
33412
33413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33414         LDKAnnouncementSignatures this_ptr_conv;
33415         this_ptr_conv.inner = untag_ptr(this_ptr);
33416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33418         this_ptr_conv.is_owned = false;
33419         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33420 }
33421
33422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33423         LDKAnnouncementSignatures this_ptr_conv;
33424         this_ptr_conv.inner = untag_ptr(this_ptr);
33425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33427         this_ptr_conv.is_owned = false;
33428         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33429         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
33430         return ret_arr;
33431 }
33432
33433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33434         LDKAnnouncementSignatures this_ptr_conv;
33435         this_ptr_conv.inner = untag_ptr(this_ptr);
33436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33438         this_ptr_conv.is_owned = false;
33439         LDKSignature val_ref;
33440         CHECK((*env)->GetArrayLength(env, val) == 64);
33441         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33442         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33443 }
33444
33445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33446         LDKAnnouncementSignatures this_ptr_conv;
33447         this_ptr_conv.inner = untag_ptr(this_ptr);
33448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33450         this_ptr_conv.is_owned = false;
33451         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33452         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
33453         return ret_arr;
33454 }
33455
33456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33457         LDKAnnouncementSignatures this_ptr_conv;
33458         this_ptr_conv.inner = untag_ptr(this_ptr);
33459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33461         this_ptr_conv.is_owned = false;
33462         LDKSignature val_ref;
33463         CHECK((*env)->GetArrayLength(env, val) == 64);
33464         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33465         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33466 }
33467
33468 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) {
33469         LDKThirtyTwoBytes channel_id_arg_ref;
33470         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33471         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33472         LDKSignature node_signature_arg_ref;
33473         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
33474         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
33475         LDKSignature bitcoin_signature_arg_ref;
33476         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
33477         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
33478         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33479         int64_t ret_ref = 0;
33480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33482         return ret_ref;
33483 }
33484
33485 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33486         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33487         int64_t ret_ref = 0;
33488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33490         return ret_ref;
33491 }
33492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33493         LDKAnnouncementSignatures arg_conv;
33494         arg_conv.inner = untag_ptr(arg);
33495         arg_conv.is_owned = ptr_is_owned(arg);
33496         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33497         arg_conv.is_owned = false;
33498         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33499         return ret_conv;
33500 }
33501
33502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33503         LDKAnnouncementSignatures orig_conv;
33504         orig_conv.inner = untag_ptr(orig);
33505         orig_conv.is_owned = ptr_is_owned(orig);
33506         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33507         orig_conv.is_owned = false;
33508         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33509         int64_t ret_ref = 0;
33510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33512         return ret_ref;
33513 }
33514
33515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33516         if (!ptr_is_owned(this_ptr)) return;
33517         void* this_ptr_ptr = untag_ptr(this_ptr);
33518         CHECK_ACCESS(this_ptr_ptr);
33519         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33520         FREE(untag_ptr(this_ptr));
33521         NetAddress_free(this_ptr_conv);
33522 }
33523
33524 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33525         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33526         *ret_copy = NetAddress_clone(arg);
33527         int64_t ret_ref = tag_ptr(ret_copy, true);
33528         return ret_ref;
33529 }
33530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33531         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33532         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33533         return ret_conv;
33534 }
33535
33536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33537         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33538         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33539         *ret_copy = NetAddress_clone(orig_conv);
33540         int64_t ret_ref = tag_ptr(ret_copy, true);
33541         return ret_ref;
33542 }
33543
33544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33545         LDKFourBytes addr_ref;
33546         CHECK((*env)->GetArrayLength(env, addr) == 4);
33547         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
33548         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33549         *ret_copy = NetAddress_ipv4(addr_ref, port);
33550         int64_t ret_ref = tag_ptr(ret_copy, true);
33551         return ret_ref;
33552 }
33553
33554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33555         LDKSixteenBytes addr_ref;
33556         CHECK((*env)->GetArrayLength(env, addr) == 16);
33557         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
33558         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33559         *ret_copy = NetAddress_ipv6(addr_ref, port);
33560         int64_t ret_ref = tag_ptr(ret_copy, true);
33561         return ret_ref;
33562 }
33563
33564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
33565         LDKTwelveBytes a_ref;
33566         CHECK((*env)->GetArrayLength(env, a) == 12);
33567         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
33568         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33569         *ret_copy = NetAddress_onion_v2(a_ref);
33570         int64_t ret_ref = tag_ptr(ret_copy, true);
33571         return ret_ref;
33572 }
33573
33574 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) {
33575         LDKThirtyTwoBytes ed25519_pubkey_ref;
33576         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
33577         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
33578         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33579         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33580         int64_t ret_ref = tag_ptr(ret_copy, true);
33581         return ret_ref;
33582 }
33583
33584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
33585         LDKHostname hostname_conv;
33586         hostname_conv.inner = untag_ptr(hostname);
33587         hostname_conv.is_owned = ptr_is_owned(hostname);
33588         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33589         hostname_conv = Hostname_clone(&hostname_conv);
33590         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33591         *ret_copy = NetAddress_hostname(hostname_conv, port);
33592         int64_t ret_ref = tag_ptr(ret_copy, true);
33593         return ret_ref;
33594 }
33595
33596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
33597         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33598         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33599         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33600         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33601         CVec_u8Z_free(ret_var);
33602         return ret_arr;
33603 }
33604
33605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33606         LDKu8slice ser_ref;
33607         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33608         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33609         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33610         *ret_conv = NetAddress_read(ser_ref);
33611         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33612         return tag_ptr(ret_conv, true);
33613 }
33614
33615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33616         LDKUnsignedNodeAnnouncement this_obj_conv;
33617         this_obj_conv.inner = untag_ptr(this_obj);
33618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33620         UnsignedNodeAnnouncement_free(this_obj_conv);
33621 }
33622
33623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33624         LDKUnsignedNodeAnnouncement this_ptr_conv;
33625         this_ptr_conv.inner = untag_ptr(this_ptr);
33626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33628         this_ptr_conv.is_owned = false;
33629         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33630         int64_t ret_ref = 0;
33631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33633         return ret_ref;
33634 }
33635
33636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33637         LDKUnsignedNodeAnnouncement this_ptr_conv;
33638         this_ptr_conv.inner = untag_ptr(this_ptr);
33639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33641         this_ptr_conv.is_owned = false;
33642         LDKNodeFeatures val_conv;
33643         val_conv.inner = untag_ptr(val);
33644         val_conv.is_owned = ptr_is_owned(val);
33645         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33646         val_conv = NodeFeatures_clone(&val_conv);
33647         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33648 }
33649
33650 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33651         LDKUnsignedNodeAnnouncement this_ptr_conv;
33652         this_ptr_conv.inner = untag_ptr(this_ptr);
33653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33655         this_ptr_conv.is_owned = false;
33656         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33657         return ret_conv;
33658 }
33659
33660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33661         LDKUnsignedNodeAnnouncement this_ptr_conv;
33662         this_ptr_conv.inner = untag_ptr(this_ptr);
33663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33665         this_ptr_conv.is_owned = false;
33666         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33667 }
33668
33669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33670         LDKUnsignedNodeAnnouncement this_ptr_conv;
33671         this_ptr_conv.inner = untag_ptr(this_ptr);
33672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33674         this_ptr_conv.is_owned = false;
33675         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33676         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
33677         return ret_arr;
33678 }
33679
33680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33681         LDKUnsignedNodeAnnouncement this_ptr_conv;
33682         this_ptr_conv.inner = untag_ptr(this_ptr);
33683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33685         this_ptr_conv.is_owned = false;
33686         LDKPublicKey val_ref;
33687         CHECK((*env)->GetArrayLength(env, val) == 33);
33688         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33689         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
33690 }
33691
33692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
33693         LDKUnsignedNodeAnnouncement this_ptr_conv;
33694         this_ptr_conv.inner = untag_ptr(this_ptr);
33695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33697         this_ptr_conv.is_owned = false;
33698         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
33699         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
33700         return ret_arr;
33701 }
33702
33703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33704         LDKUnsignedNodeAnnouncement this_ptr_conv;
33705         this_ptr_conv.inner = untag_ptr(this_ptr);
33706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33708         this_ptr_conv.is_owned = false;
33709         LDKThreeBytes val_ref;
33710         CHECK((*env)->GetArrayLength(env, val) == 3);
33711         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
33712         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33713 }
33714
33715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33716         LDKUnsignedNodeAnnouncement this_ptr_conv;
33717         this_ptr_conv.inner = untag_ptr(this_ptr);
33718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33720         this_ptr_conv.is_owned = false;
33721         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33722         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
33723         return ret_arr;
33724 }
33725
33726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33727         LDKUnsignedNodeAnnouncement this_ptr_conv;
33728         this_ptr_conv.inner = untag_ptr(this_ptr);
33729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33731         this_ptr_conv.is_owned = false;
33732         LDKThirtyTwoBytes val_ref;
33733         CHECK((*env)->GetArrayLength(env, val) == 32);
33734         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33735         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
33736 }
33737
33738 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
33739         LDKUnsignedNodeAnnouncement this_ptr_conv;
33740         this_ptr_conv.inner = untag_ptr(this_ptr);
33741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33743         this_ptr_conv.is_owned = false;
33744         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
33745         int64_tArray ret_arr = NULL;
33746         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33747         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33748         for (size_t m = 0; m < ret_var.datalen; m++) {
33749                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33750                 *ret_conv_12_copy = ret_var.data[m];
33751                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
33752                 ret_arr_ptr[m] = ret_conv_12_ref;
33753         }
33754         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33755         FREE(ret_var.data);
33756         return ret_arr;
33757 }
33758
33759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33760         LDKUnsignedNodeAnnouncement this_ptr_conv;
33761         this_ptr_conv.inner = untag_ptr(this_ptr);
33762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33764         this_ptr_conv.is_owned = false;
33765         LDKCVec_NetAddressZ val_constr;
33766         val_constr.datalen = (*env)->GetArrayLength(env, val);
33767         if (val_constr.datalen > 0)
33768                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
33769         else
33770                 val_constr.data = NULL;
33771         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33772         for (size_t m = 0; m < val_constr.datalen; m++) {
33773                 int64_t val_conv_12 = val_vals[m];
33774                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
33775                 CHECK_ACCESS(val_conv_12_ptr);
33776                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
33777                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
33778                 val_constr.data[m] = val_conv_12_conv;
33779         }
33780         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33781         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
33782 }
33783
33784 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
33785         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
33786         int64_t ret_ref = 0;
33787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33789         return ret_ref;
33790 }
33791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33792         LDKUnsignedNodeAnnouncement arg_conv;
33793         arg_conv.inner = untag_ptr(arg);
33794         arg_conv.is_owned = ptr_is_owned(arg);
33795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33796         arg_conv.is_owned = false;
33797         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
33798         return ret_conv;
33799 }
33800
33801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33802         LDKUnsignedNodeAnnouncement orig_conv;
33803         orig_conv.inner = untag_ptr(orig);
33804         orig_conv.is_owned = ptr_is_owned(orig);
33805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33806         orig_conv.is_owned = false;
33807         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
33808         int64_t ret_ref = 0;
33809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33811         return ret_ref;
33812 }
33813
33814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33815         LDKNodeAnnouncement this_obj_conv;
33816         this_obj_conv.inner = untag_ptr(this_obj);
33817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33819         NodeAnnouncement_free(this_obj_conv);
33820 }
33821
33822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33823         LDKNodeAnnouncement this_ptr_conv;
33824         this_ptr_conv.inner = untag_ptr(this_ptr);
33825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33827         this_ptr_conv.is_owned = false;
33828         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33829         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
33830         return ret_arr;
33831 }
33832
33833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33834         LDKNodeAnnouncement this_ptr_conv;
33835         this_ptr_conv.inner = untag_ptr(this_ptr);
33836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33838         this_ptr_conv.is_owned = false;
33839         LDKSignature val_ref;
33840         CHECK((*env)->GetArrayLength(env, val) == 64);
33841         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33842         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
33843 }
33844
33845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33846         LDKNodeAnnouncement this_ptr_conv;
33847         this_ptr_conv.inner = untag_ptr(this_ptr);
33848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33850         this_ptr_conv.is_owned = false;
33851         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
33852         int64_t ret_ref = 0;
33853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33855         return ret_ref;
33856 }
33857
33858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33859         LDKNodeAnnouncement this_ptr_conv;
33860         this_ptr_conv.inner = untag_ptr(this_ptr);
33861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33863         this_ptr_conv.is_owned = false;
33864         LDKUnsignedNodeAnnouncement val_conv;
33865         val_conv.inner = untag_ptr(val);
33866         val_conv.is_owned = ptr_is_owned(val);
33867         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33868         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
33869         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
33870 }
33871
33872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
33873         LDKSignature signature_arg_ref;
33874         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33875         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33876         LDKUnsignedNodeAnnouncement contents_arg_conv;
33877         contents_arg_conv.inner = untag_ptr(contents_arg);
33878         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
33879         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33880         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
33881         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
33882         int64_t ret_ref = 0;
33883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33885         return ret_ref;
33886 }
33887
33888 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
33889         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
33890         int64_t ret_ref = 0;
33891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33893         return ret_ref;
33894 }
33895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33896         LDKNodeAnnouncement arg_conv;
33897         arg_conv.inner = untag_ptr(arg);
33898         arg_conv.is_owned = ptr_is_owned(arg);
33899         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33900         arg_conv.is_owned = false;
33901         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
33902         return ret_conv;
33903 }
33904
33905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33906         LDKNodeAnnouncement orig_conv;
33907         orig_conv.inner = untag_ptr(orig);
33908         orig_conv.is_owned = ptr_is_owned(orig);
33909         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33910         orig_conv.is_owned = false;
33911         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
33912         int64_t ret_ref = 0;
33913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33915         return ret_ref;
33916 }
33917
33918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33919         LDKUnsignedChannelAnnouncement this_obj_conv;
33920         this_obj_conv.inner = untag_ptr(this_obj);
33921         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33923         UnsignedChannelAnnouncement_free(this_obj_conv);
33924 }
33925
33926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33927         LDKUnsignedChannelAnnouncement this_ptr_conv;
33928         this_ptr_conv.inner = untag_ptr(this_ptr);
33929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33931         this_ptr_conv.is_owned = false;
33932         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
33933         int64_t ret_ref = 0;
33934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33936         return ret_ref;
33937 }
33938
33939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33940         LDKUnsignedChannelAnnouncement this_ptr_conv;
33941         this_ptr_conv.inner = untag_ptr(this_ptr);
33942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33944         this_ptr_conv.is_owned = false;
33945         LDKChannelFeatures val_conv;
33946         val_conv.inner = untag_ptr(val);
33947         val_conv.is_owned = ptr_is_owned(val);
33948         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33949         val_conv = ChannelFeatures_clone(&val_conv);
33950         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
33951 }
33952
33953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33954         LDKUnsignedChannelAnnouncement 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33960         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
33961         return ret_arr;
33962 }
33963
33964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33965         LDKUnsignedChannelAnnouncement this_ptr_conv;
33966         this_ptr_conv.inner = untag_ptr(this_ptr);
33967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33969         this_ptr_conv.is_owned = false;
33970         LDKThirtyTwoBytes val_ref;
33971         CHECK((*env)->GetArrayLength(env, val) == 32);
33972         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33973         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
33974 }
33975
33976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33977         LDKUnsignedChannelAnnouncement this_ptr_conv;
33978         this_ptr_conv.inner = untag_ptr(this_ptr);
33979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33981         this_ptr_conv.is_owned = false;
33982         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
33983         return ret_conv;
33984 }
33985
33986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33987         LDKUnsignedChannelAnnouncement this_ptr_conv;
33988         this_ptr_conv.inner = untag_ptr(this_ptr);
33989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33991         this_ptr_conv.is_owned = false;
33992         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
33993 }
33994
33995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33996         LDKUnsignedChannelAnnouncement this_ptr_conv;
33997         this_ptr_conv.inner = untag_ptr(this_ptr);
33998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34000         this_ptr_conv.is_owned = false;
34001         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34002         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
34003         return ret_arr;
34004 }
34005
34006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34007         LDKUnsignedChannelAnnouncement this_ptr_conv;
34008         this_ptr_conv.inner = untag_ptr(this_ptr);
34009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34011         this_ptr_conv.is_owned = false;
34012         LDKPublicKey val_ref;
34013         CHECK((*env)->GetArrayLength(env, val) == 33);
34014         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34015         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
34016 }
34017
34018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34019         LDKUnsignedChannelAnnouncement this_ptr_conv;
34020         this_ptr_conv.inner = untag_ptr(this_ptr);
34021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34023         this_ptr_conv.is_owned = false;
34024         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34025         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
34026         return ret_arr;
34027 }
34028
34029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34030         LDKUnsignedChannelAnnouncement this_ptr_conv;
34031         this_ptr_conv.inner = untag_ptr(this_ptr);
34032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34034         this_ptr_conv.is_owned = false;
34035         LDKPublicKey val_ref;
34036         CHECK((*env)->GetArrayLength(env, val) == 33);
34037         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34038         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
34039 }
34040
34041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34042         LDKUnsignedChannelAnnouncement 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34048         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
34049         return ret_arr;
34050 }
34051
34052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34053         LDKUnsignedChannelAnnouncement this_ptr_conv;
34054         this_ptr_conv.inner = untag_ptr(this_ptr);
34055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34057         this_ptr_conv.is_owned = false;
34058         LDKPublicKey val_ref;
34059         CHECK((*env)->GetArrayLength(env, val) == 33);
34060         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34061         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
34062 }
34063
34064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34065         LDKUnsignedChannelAnnouncement this_ptr_conv;
34066         this_ptr_conv.inner = untag_ptr(this_ptr);
34067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34069         this_ptr_conv.is_owned = false;
34070         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34071         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
34072         return ret_arr;
34073 }
34074
34075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34076         LDKUnsignedChannelAnnouncement this_ptr_conv;
34077         this_ptr_conv.inner = untag_ptr(this_ptr);
34078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34080         this_ptr_conv.is_owned = false;
34081         LDKPublicKey val_ref;
34082         CHECK((*env)->GetArrayLength(env, val) == 33);
34083         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34084         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
34085 }
34086
34087 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34088         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34089         int64_t ret_ref = 0;
34090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34092         return ret_ref;
34093 }
34094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34095         LDKUnsignedChannelAnnouncement arg_conv;
34096         arg_conv.inner = untag_ptr(arg);
34097         arg_conv.is_owned = ptr_is_owned(arg);
34098         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34099         arg_conv.is_owned = false;
34100         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34101         return ret_conv;
34102 }
34103
34104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34105         LDKUnsignedChannelAnnouncement orig_conv;
34106         orig_conv.inner = untag_ptr(orig);
34107         orig_conv.is_owned = ptr_is_owned(orig);
34108         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34109         orig_conv.is_owned = false;
34110         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34111         int64_t ret_ref = 0;
34112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34114         return ret_ref;
34115 }
34116
34117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34118         LDKChannelAnnouncement this_obj_conv;
34119         this_obj_conv.inner = untag_ptr(this_obj);
34120         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34122         ChannelAnnouncement_free(this_obj_conv);
34123 }
34124
34125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34126         LDKChannelAnnouncement this_ptr_conv;
34127         this_ptr_conv.inner = untag_ptr(this_ptr);
34128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34130         this_ptr_conv.is_owned = false;
34131         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34132         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
34133         return ret_arr;
34134 }
34135
34136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34137         LDKChannelAnnouncement this_ptr_conv;
34138         this_ptr_conv.inner = untag_ptr(this_ptr);
34139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34141         this_ptr_conv.is_owned = false;
34142         LDKSignature val_ref;
34143         CHECK((*env)->GetArrayLength(env, val) == 64);
34144         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34145         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34146 }
34147
34148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34149         LDKChannelAnnouncement 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34155         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
34156         return ret_arr;
34157 }
34158
34159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34160         LDKChannelAnnouncement this_ptr_conv;
34161         this_ptr_conv.inner = untag_ptr(this_ptr);
34162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34164         this_ptr_conv.is_owned = false;
34165         LDKSignature val_ref;
34166         CHECK((*env)->GetArrayLength(env, val) == 64);
34167         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34168         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34169 }
34170
34171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34172         LDKChannelAnnouncement this_ptr_conv;
34173         this_ptr_conv.inner = untag_ptr(this_ptr);
34174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34176         this_ptr_conv.is_owned = false;
34177         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34178         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
34179         return ret_arr;
34180 }
34181
34182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34183         LDKChannelAnnouncement this_ptr_conv;
34184         this_ptr_conv.inner = untag_ptr(this_ptr);
34185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34187         this_ptr_conv.is_owned = false;
34188         LDKSignature val_ref;
34189         CHECK((*env)->GetArrayLength(env, val) == 64);
34190         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34191         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34192 }
34193
34194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34195         LDKChannelAnnouncement this_ptr_conv;
34196         this_ptr_conv.inner = untag_ptr(this_ptr);
34197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34199         this_ptr_conv.is_owned = false;
34200         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34201         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
34202         return ret_arr;
34203 }
34204
34205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34206         LDKChannelAnnouncement this_ptr_conv;
34207         this_ptr_conv.inner = untag_ptr(this_ptr);
34208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34210         this_ptr_conv.is_owned = false;
34211         LDKSignature val_ref;
34212         CHECK((*env)->GetArrayLength(env, val) == 64);
34213         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34214         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34215 }
34216
34217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34218         LDKChannelAnnouncement this_ptr_conv;
34219         this_ptr_conv.inner = untag_ptr(this_ptr);
34220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34222         this_ptr_conv.is_owned = false;
34223         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34224         int64_t ret_ref = 0;
34225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34227         return ret_ref;
34228 }
34229
34230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34231         LDKChannelAnnouncement this_ptr_conv;
34232         this_ptr_conv.inner = untag_ptr(this_ptr);
34233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34235         this_ptr_conv.is_owned = false;
34236         LDKUnsignedChannelAnnouncement val_conv;
34237         val_conv.inner = untag_ptr(val);
34238         val_conv.is_owned = ptr_is_owned(val);
34239         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34240         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34241         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34242 }
34243
34244 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) {
34245         LDKSignature node_signature_1_arg_ref;
34246         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
34247         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
34248         LDKSignature node_signature_2_arg_ref;
34249         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
34250         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
34251         LDKSignature bitcoin_signature_1_arg_ref;
34252         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
34253         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
34254         LDKSignature bitcoin_signature_2_arg_ref;
34255         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
34256         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
34257         LDKUnsignedChannelAnnouncement contents_arg_conv;
34258         contents_arg_conv.inner = untag_ptr(contents_arg);
34259         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34260         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34261         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34262         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);
34263         int64_t ret_ref = 0;
34264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34266         return ret_ref;
34267 }
34268
34269 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34270         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34271         int64_t ret_ref = 0;
34272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34274         return ret_ref;
34275 }
34276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34277         LDKChannelAnnouncement arg_conv;
34278         arg_conv.inner = untag_ptr(arg);
34279         arg_conv.is_owned = ptr_is_owned(arg);
34280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34281         arg_conv.is_owned = false;
34282         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34283         return ret_conv;
34284 }
34285
34286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34287         LDKChannelAnnouncement orig_conv;
34288         orig_conv.inner = untag_ptr(orig);
34289         orig_conv.is_owned = ptr_is_owned(orig);
34290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34291         orig_conv.is_owned = false;
34292         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34293         int64_t ret_ref = 0;
34294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34296         return ret_ref;
34297 }
34298
34299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34300         LDKUnsignedChannelUpdate this_obj_conv;
34301         this_obj_conv.inner = untag_ptr(this_obj);
34302         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34304         UnsignedChannelUpdate_free(this_obj_conv);
34305 }
34306
34307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34308         LDKUnsignedChannelUpdate this_ptr_conv;
34309         this_ptr_conv.inner = untag_ptr(this_ptr);
34310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34312         this_ptr_conv.is_owned = false;
34313         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34314         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
34315         return ret_arr;
34316 }
34317
34318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34319         LDKUnsignedChannelUpdate this_ptr_conv;
34320         this_ptr_conv.inner = untag_ptr(this_ptr);
34321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34323         this_ptr_conv.is_owned = false;
34324         LDKThirtyTwoBytes val_ref;
34325         CHECK((*env)->GetArrayLength(env, val) == 32);
34326         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34327         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34328 }
34329
34330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34331         LDKUnsignedChannelUpdate this_ptr_conv;
34332         this_ptr_conv.inner = untag_ptr(this_ptr);
34333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34335         this_ptr_conv.is_owned = false;
34336         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34337         return ret_conv;
34338 }
34339
34340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34341         LDKUnsignedChannelUpdate this_ptr_conv;
34342         this_ptr_conv.inner = untag_ptr(this_ptr);
34343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34345         this_ptr_conv.is_owned = false;
34346         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34347 }
34348
34349 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34350         LDKUnsignedChannelUpdate this_ptr_conv;
34351         this_ptr_conv.inner = untag_ptr(this_ptr);
34352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34354         this_ptr_conv.is_owned = false;
34355         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34356         return ret_conv;
34357 }
34358
34359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34360         LDKUnsignedChannelUpdate this_ptr_conv;
34361         this_ptr_conv.inner = untag_ptr(this_ptr);
34362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34364         this_ptr_conv.is_owned = false;
34365         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34366 }
34367
34368 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
34369         LDKUnsignedChannelUpdate this_ptr_conv;
34370         this_ptr_conv.inner = untag_ptr(this_ptr);
34371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34373         this_ptr_conv.is_owned = false;
34374         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34375         return ret_conv;
34376 }
34377
34378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
34379         LDKUnsignedChannelUpdate this_ptr_conv;
34380         this_ptr_conv.inner = untag_ptr(this_ptr);
34381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34383         this_ptr_conv.is_owned = false;
34384         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34385 }
34386
34387 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34388         LDKUnsignedChannelUpdate this_ptr_conv;
34389         this_ptr_conv.inner = untag_ptr(this_ptr);
34390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34392         this_ptr_conv.is_owned = false;
34393         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34394         return ret_conv;
34395 }
34396
34397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34398         LDKUnsignedChannelUpdate this_ptr_conv;
34399         this_ptr_conv.inner = untag_ptr(this_ptr);
34400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34402         this_ptr_conv.is_owned = false;
34403         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34404 }
34405
34406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34407         LDKUnsignedChannelUpdate this_ptr_conv;
34408         this_ptr_conv.inner = untag_ptr(this_ptr);
34409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34411         this_ptr_conv.is_owned = false;
34412         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34413         return ret_conv;
34414 }
34415
34416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34417         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34423 }
34424
34425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34426         LDKUnsignedChannelUpdate this_ptr_conv;
34427         this_ptr_conv.inner = untag_ptr(this_ptr);
34428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34430         this_ptr_conv.is_owned = false;
34431         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34432         return ret_conv;
34433 }
34434
34435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34436         LDKUnsignedChannelUpdate this_ptr_conv;
34437         this_ptr_conv.inner = untag_ptr(this_ptr);
34438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34440         this_ptr_conv.is_owned = false;
34441         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34442 }
34443
34444 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34445         LDKUnsignedChannelUpdate this_ptr_conv;
34446         this_ptr_conv.inner = untag_ptr(this_ptr);
34447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34449         this_ptr_conv.is_owned = false;
34450         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34451         return ret_conv;
34452 }
34453
34454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34455         LDKUnsignedChannelUpdate this_ptr_conv;
34456         this_ptr_conv.inner = untag_ptr(this_ptr);
34457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34459         this_ptr_conv.is_owned = false;
34460         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34461 }
34462
34463 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34464         LDKUnsignedChannelUpdate this_ptr_conv;
34465         this_ptr_conv.inner = untag_ptr(this_ptr);
34466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34468         this_ptr_conv.is_owned = false;
34469         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34470         return ret_conv;
34471 }
34472
34473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34474         LDKUnsignedChannelUpdate this_ptr_conv;
34475         this_ptr_conv.inner = untag_ptr(this_ptr);
34476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34478         this_ptr_conv.is_owned = false;
34479         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34480 }
34481
34482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
34483         LDKUnsignedChannelUpdate this_ptr_conv;
34484         this_ptr_conv.inner = untag_ptr(this_ptr);
34485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34487         this_ptr_conv.is_owned = false;
34488         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34489         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34490         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34491         CVec_u8Z_free(ret_var);
34492         return ret_arr;
34493 }
34494
34495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34496         LDKUnsignedChannelUpdate this_ptr_conv;
34497         this_ptr_conv.inner = untag_ptr(this_ptr);
34498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34500         this_ptr_conv.is_owned = false;
34501         LDKCVec_u8Z val_ref;
34502         val_ref.datalen = (*env)->GetArrayLength(env, val);
34503         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34504         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
34505         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34506 }
34507
34508 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) {
34509         LDKThirtyTwoBytes chain_hash_arg_ref;
34510         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34511         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34512         LDKCVec_u8Z excess_data_arg_ref;
34513         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
34514         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34515         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
34516         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);
34517         int64_t ret_ref = 0;
34518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34520         return ret_ref;
34521 }
34522
34523 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34524         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34525         int64_t ret_ref = 0;
34526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34528         return ret_ref;
34529 }
34530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34531         LDKUnsignedChannelUpdate arg_conv;
34532         arg_conv.inner = untag_ptr(arg);
34533         arg_conv.is_owned = ptr_is_owned(arg);
34534         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34535         arg_conv.is_owned = false;
34536         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34537         return ret_conv;
34538 }
34539
34540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34541         LDKUnsignedChannelUpdate orig_conv;
34542         orig_conv.inner = untag_ptr(orig);
34543         orig_conv.is_owned = ptr_is_owned(orig);
34544         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34545         orig_conv.is_owned = false;
34546         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
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
34553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34554         LDKChannelUpdate this_obj_conv;
34555         this_obj_conv.inner = untag_ptr(this_obj);
34556         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34558         ChannelUpdate_free(this_obj_conv);
34559 }
34560
34561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34562         LDKChannelUpdate this_ptr_conv;
34563         this_ptr_conv.inner = untag_ptr(this_ptr);
34564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34566         this_ptr_conv.is_owned = false;
34567         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34568         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
34569         return ret_arr;
34570 }
34571
34572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34573         LDKChannelUpdate this_ptr_conv;
34574         this_ptr_conv.inner = untag_ptr(this_ptr);
34575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34577         this_ptr_conv.is_owned = false;
34578         LDKSignature val_ref;
34579         CHECK((*env)->GetArrayLength(env, val) == 64);
34580         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34581         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34582 }
34583
34584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34585         LDKChannelUpdate this_ptr_conv;
34586         this_ptr_conv.inner = untag_ptr(this_ptr);
34587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34589         this_ptr_conv.is_owned = false;
34590         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34591         int64_t ret_ref = 0;
34592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34594         return ret_ref;
34595 }
34596
34597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34598         LDKChannelUpdate this_ptr_conv;
34599         this_ptr_conv.inner = untag_ptr(this_ptr);
34600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34602         this_ptr_conv.is_owned = false;
34603         LDKUnsignedChannelUpdate val_conv;
34604         val_conv.inner = untag_ptr(val);
34605         val_conv.is_owned = ptr_is_owned(val);
34606         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34607         val_conv = UnsignedChannelUpdate_clone(&val_conv);
34608         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34609 }
34610
34611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34612         LDKSignature signature_arg_ref;
34613         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34614         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34615         LDKUnsignedChannelUpdate contents_arg_conv;
34616         contents_arg_conv.inner = untag_ptr(contents_arg);
34617         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34618         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34619         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
34620         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
34621         int64_t ret_ref = 0;
34622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34624         return ret_ref;
34625 }
34626
34627 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
34628         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
34629         int64_t ret_ref = 0;
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34632         return ret_ref;
34633 }
34634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34635         LDKChannelUpdate arg_conv;
34636         arg_conv.inner = untag_ptr(arg);
34637         arg_conv.is_owned = ptr_is_owned(arg);
34638         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34639         arg_conv.is_owned = false;
34640         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
34641         return ret_conv;
34642 }
34643
34644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34645         LDKChannelUpdate orig_conv;
34646         orig_conv.inner = untag_ptr(orig);
34647         orig_conv.is_owned = ptr_is_owned(orig);
34648         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34649         orig_conv.is_owned = false;
34650         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
34651         int64_t ret_ref = 0;
34652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34654         return ret_ref;
34655 }
34656
34657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34658         LDKQueryChannelRange this_obj_conv;
34659         this_obj_conv.inner = untag_ptr(this_obj);
34660         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34662         QueryChannelRange_free(this_obj_conv);
34663 }
34664
34665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34666         LDKQueryChannelRange this_ptr_conv;
34667         this_ptr_conv.inner = untag_ptr(this_ptr);
34668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34670         this_ptr_conv.is_owned = false;
34671         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34672         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
34673         return ret_arr;
34674 }
34675
34676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34677         LDKQueryChannelRange this_ptr_conv;
34678         this_ptr_conv.inner = untag_ptr(this_ptr);
34679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34681         this_ptr_conv.is_owned = false;
34682         LDKThirtyTwoBytes val_ref;
34683         CHECK((*env)->GetArrayLength(env, val) == 32);
34684         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34685         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34686 }
34687
34688 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34689         LDKQueryChannelRange this_ptr_conv;
34690         this_ptr_conv.inner = untag_ptr(this_ptr);
34691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34693         this_ptr_conv.is_owned = false;
34694         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
34695         return ret_conv;
34696 }
34697
34698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34699         LDKQueryChannelRange this_ptr_conv;
34700         this_ptr_conv.inner = untag_ptr(this_ptr);
34701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34703         this_ptr_conv.is_owned = false;
34704         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
34705 }
34706
34707 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34708         LDKQueryChannelRange this_ptr_conv;
34709         this_ptr_conv.inner = untag_ptr(this_ptr);
34710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34712         this_ptr_conv.is_owned = false;
34713         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
34714         return ret_conv;
34715 }
34716
34717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34718         LDKQueryChannelRange this_ptr_conv;
34719         this_ptr_conv.inner = untag_ptr(this_ptr);
34720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34722         this_ptr_conv.is_owned = false;
34723         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34724 }
34725
34726 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) {
34727         LDKThirtyTwoBytes chain_hash_arg_ref;
34728         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34729         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34730         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
34731         int64_t ret_ref = 0;
34732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34734         return ret_ref;
34735 }
34736
34737 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
34738         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
34739         int64_t ret_ref = 0;
34740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34742         return ret_ref;
34743 }
34744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34745         LDKQueryChannelRange arg_conv;
34746         arg_conv.inner = untag_ptr(arg);
34747         arg_conv.is_owned = ptr_is_owned(arg);
34748         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34749         arg_conv.is_owned = false;
34750         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
34751         return ret_conv;
34752 }
34753
34754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34755         LDKQueryChannelRange orig_conv;
34756         orig_conv.inner = untag_ptr(orig);
34757         orig_conv.is_owned = ptr_is_owned(orig);
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34759         orig_conv.is_owned = false;
34760         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
34761         int64_t ret_ref = 0;
34762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34764         return ret_ref;
34765 }
34766
34767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34768         LDKReplyChannelRange this_obj_conv;
34769         this_obj_conv.inner = untag_ptr(this_obj);
34770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34772         ReplyChannelRange_free(this_obj_conv);
34773 }
34774
34775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34776         LDKReplyChannelRange this_ptr_conv;
34777         this_ptr_conv.inner = untag_ptr(this_ptr);
34778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34780         this_ptr_conv.is_owned = false;
34781         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34782         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
34783         return ret_arr;
34784 }
34785
34786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34787         LDKReplyChannelRange this_ptr_conv;
34788         this_ptr_conv.inner = untag_ptr(this_ptr);
34789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34791         this_ptr_conv.is_owned = false;
34792         LDKThirtyTwoBytes val_ref;
34793         CHECK((*env)->GetArrayLength(env, val) == 32);
34794         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34795         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34796 }
34797
34798 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34799         LDKReplyChannelRange this_ptr_conv;
34800         this_ptr_conv.inner = untag_ptr(this_ptr);
34801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34803         this_ptr_conv.is_owned = false;
34804         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
34805         return ret_conv;
34806 }
34807
34808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34809         LDKReplyChannelRange 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         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
34815 }
34816
34817 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34818         LDKReplyChannelRange this_ptr_conv;
34819         this_ptr_conv.inner = untag_ptr(this_ptr);
34820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34822         this_ptr_conv.is_owned = false;
34823         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
34824         return ret_conv;
34825 }
34826
34827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34828         LDKReplyChannelRange this_ptr_conv;
34829         this_ptr_conv.inner = untag_ptr(this_ptr);
34830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34832         this_ptr_conv.is_owned = false;
34833         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34834 }
34835
34836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
34837         LDKReplyChannelRange this_ptr_conv;
34838         this_ptr_conv.inner = untag_ptr(this_ptr);
34839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34841         this_ptr_conv.is_owned = false;
34842         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
34843         return ret_conv;
34844 }
34845
34846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34847         LDKReplyChannelRange this_ptr_conv;
34848         this_ptr_conv.inner = untag_ptr(this_ptr);
34849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34851         this_ptr_conv.is_owned = false;
34852         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
34853 }
34854
34855 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
34856         LDKReplyChannelRange this_ptr_conv;
34857         this_ptr_conv.inner = untag_ptr(this_ptr);
34858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34860         this_ptr_conv.is_owned = false;
34861         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
34862         int64_tArray ret_arr = NULL;
34863         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34864         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34865         for (size_t g = 0; g < ret_var.datalen; g++) {
34866                 int64_t ret_conv_6_conv = ret_var.data[g];
34867                 ret_arr_ptr[g] = ret_conv_6_conv;
34868         }
34869         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34870         FREE(ret_var.data);
34871         return ret_arr;
34872 }
34873
34874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34875         LDKReplyChannelRange this_ptr_conv;
34876         this_ptr_conv.inner = untag_ptr(this_ptr);
34877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34879         this_ptr_conv.is_owned = false;
34880         LDKCVec_u64Z val_constr;
34881         val_constr.datalen = (*env)->GetArrayLength(env, val);
34882         if (val_constr.datalen > 0)
34883                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34884         else
34885                 val_constr.data = NULL;
34886         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34887         for (size_t g = 0; g < val_constr.datalen; g++) {
34888                 int64_t val_conv_6 = val_vals[g];
34889                 val_constr.data[g] = val_conv_6;
34890         }
34891         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34892         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
34893 }
34894
34895 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) {
34896         LDKThirtyTwoBytes chain_hash_arg_ref;
34897         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34898         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34899         LDKCVec_u64Z short_channel_ids_arg_constr;
34900         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
34901         if (short_channel_ids_arg_constr.datalen > 0)
34902                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34903         else
34904                 short_channel_ids_arg_constr.data = NULL;
34905         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
34906         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
34907                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
34908                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
34909         }
34910         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
34911         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
34912         int64_t ret_ref = 0;
34913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34915         return ret_ref;
34916 }
34917
34918 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
34919         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
34920         int64_t ret_ref = 0;
34921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34923         return ret_ref;
34924 }
34925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34926         LDKReplyChannelRange arg_conv;
34927         arg_conv.inner = untag_ptr(arg);
34928         arg_conv.is_owned = ptr_is_owned(arg);
34929         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34930         arg_conv.is_owned = false;
34931         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
34932         return ret_conv;
34933 }
34934
34935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34936         LDKReplyChannelRange orig_conv;
34937         orig_conv.inner = untag_ptr(orig);
34938         orig_conv.is_owned = ptr_is_owned(orig);
34939         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34940         orig_conv.is_owned = false;
34941         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
34942         int64_t ret_ref = 0;
34943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34945         return ret_ref;
34946 }
34947
34948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34949         LDKQueryShortChannelIds this_obj_conv;
34950         this_obj_conv.inner = untag_ptr(this_obj);
34951         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34953         QueryShortChannelIds_free(this_obj_conv);
34954 }
34955
34956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34957         LDKQueryShortChannelIds this_ptr_conv;
34958         this_ptr_conv.inner = untag_ptr(this_ptr);
34959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34961         this_ptr_conv.is_owned = false;
34962         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34963         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
34964         return ret_arr;
34965 }
34966
34967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34968         LDKQueryShortChannelIds this_ptr_conv;
34969         this_ptr_conv.inner = untag_ptr(this_ptr);
34970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34972         this_ptr_conv.is_owned = false;
34973         LDKThirtyTwoBytes val_ref;
34974         CHECK((*env)->GetArrayLength(env, val) == 32);
34975         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34976         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
34977 }
34978
34979 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
34980         LDKQueryShortChannelIds this_ptr_conv;
34981         this_ptr_conv.inner = untag_ptr(this_ptr);
34982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34984         this_ptr_conv.is_owned = false;
34985         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
34986         int64_tArray ret_arr = NULL;
34987         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34988         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34989         for (size_t g = 0; g < ret_var.datalen; g++) {
34990                 int64_t ret_conv_6_conv = ret_var.data[g];
34991                 ret_arr_ptr[g] = ret_conv_6_conv;
34992         }
34993         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34994         FREE(ret_var.data);
34995         return ret_arr;
34996 }
34997
34998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34999         LDKQueryShortChannelIds this_ptr_conv;
35000         this_ptr_conv.inner = untag_ptr(this_ptr);
35001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35003         this_ptr_conv.is_owned = false;
35004         LDKCVec_u64Z val_constr;
35005         val_constr.datalen = (*env)->GetArrayLength(env, val);
35006         if (val_constr.datalen > 0)
35007                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35008         else
35009                 val_constr.data = NULL;
35010         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35011         for (size_t g = 0; g < val_constr.datalen; g++) {
35012                 int64_t val_conv_6 = val_vals[g];
35013                 val_constr.data[g] = val_conv_6;
35014         }
35015         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35016         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35017 }
35018
35019 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) {
35020         LDKThirtyTwoBytes chain_hash_arg_ref;
35021         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35022         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35023         LDKCVec_u64Z short_channel_ids_arg_constr;
35024         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35025         if (short_channel_ids_arg_constr.datalen > 0)
35026                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35027         else
35028                 short_channel_ids_arg_constr.data = NULL;
35029         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35030         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35031                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35032                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35033         }
35034         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35035         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
35036         int64_t ret_ref = 0;
35037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35039         return ret_ref;
35040 }
35041
35042 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35043         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
35044         int64_t ret_ref = 0;
35045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35047         return ret_ref;
35048 }
35049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35050         LDKQueryShortChannelIds arg_conv;
35051         arg_conv.inner = untag_ptr(arg);
35052         arg_conv.is_owned = ptr_is_owned(arg);
35053         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35054         arg_conv.is_owned = false;
35055         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
35056         return ret_conv;
35057 }
35058
35059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35060         LDKQueryShortChannelIds orig_conv;
35061         orig_conv.inner = untag_ptr(orig);
35062         orig_conv.is_owned = ptr_is_owned(orig);
35063         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35064         orig_conv.is_owned = false;
35065         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
35066         int64_t ret_ref = 0;
35067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35069         return ret_ref;
35070 }
35071
35072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35073         LDKReplyShortChannelIdsEnd this_obj_conv;
35074         this_obj_conv.inner = untag_ptr(this_obj);
35075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35077         ReplyShortChannelIdsEnd_free(this_obj_conv);
35078 }
35079
35080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35081         LDKReplyShortChannelIdsEnd this_ptr_conv;
35082         this_ptr_conv.inner = untag_ptr(this_ptr);
35083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35085         this_ptr_conv.is_owned = false;
35086         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35087         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
35088         return ret_arr;
35089 }
35090
35091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35092         LDKReplyShortChannelIdsEnd this_ptr_conv;
35093         this_ptr_conv.inner = untag_ptr(this_ptr);
35094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35096         this_ptr_conv.is_owned = false;
35097         LDKThirtyTwoBytes val_ref;
35098         CHECK((*env)->GetArrayLength(env, val) == 32);
35099         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35100         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35101 }
35102
35103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
35104         LDKReplyShortChannelIdsEnd this_ptr_conv;
35105         this_ptr_conv.inner = untag_ptr(this_ptr);
35106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35108         this_ptr_conv.is_owned = false;
35109         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35110         return ret_conv;
35111 }
35112
35113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35114         LDKReplyShortChannelIdsEnd this_ptr_conv;
35115         this_ptr_conv.inner = untag_ptr(this_ptr);
35116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35118         this_ptr_conv.is_owned = false;
35119         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35120 }
35121
35122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
35123         LDKThirtyTwoBytes chain_hash_arg_ref;
35124         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35125         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35126         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35127         int64_t ret_ref = 0;
35128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35130         return ret_ref;
35131 }
35132
35133 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35134         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35135         int64_t ret_ref = 0;
35136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35138         return ret_ref;
35139 }
35140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35141         LDKReplyShortChannelIdsEnd arg_conv;
35142         arg_conv.inner = untag_ptr(arg);
35143         arg_conv.is_owned = ptr_is_owned(arg);
35144         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35145         arg_conv.is_owned = false;
35146         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35147         return ret_conv;
35148 }
35149
35150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35151         LDKReplyShortChannelIdsEnd orig_conv;
35152         orig_conv.inner = untag_ptr(orig);
35153         orig_conv.is_owned = ptr_is_owned(orig);
35154         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35155         orig_conv.is_owned = false;
35156         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35157         int64_t ret_ref = 0;
35158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35160         return ret_ref;
35161 }
35162
35163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35164         LDKGossipTimestampFilter this_obj_conv;
35165         this_obj_conv.inner = untag_ptr(this_obj);
35166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35168         GossipTimestampFilter_free(this_obj_conv);
35169 }
35170
35171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35172         LDKGossipTimestampFilter this_ptr_conv;
35173         this_ptr_conv.inner = untag_ptr(this_ptr);
35174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35176         this_ptr_conv.is_owned = false;
35177         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35178         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
35179         return ret_arr;
35180 }
35181
35182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35183         LDKGossipTimestampFilter this_ptr_conv;
35184         this_ptr_conv.inner = untag_ptr(this_ptr);
35185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35187         this_ptr_conv.is_owned = false;
35188         LDKThirtyTwoBytes val_ref;
35189         CHECK((*env)->GetArrayLength(env, val) == 32);
35190         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35191         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35192 }
35193
35194 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35195         LDKGossipTimestampFilter this_ptr_conv;
35196         this_ptr_conv.inner = untag_ptr(this_ptr);
35197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35199         this_ptr_conv.is_owned = false;
35200         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35201         return ret_conv;
35202 }
35203
35204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35205         LDKGossipTimestampFilter this_ptr_conv;
35206         this_ptr_conv.inner = untag_ptr(this_ptr);
35207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35209         this_ptr_conv.is_owned = false;
35210         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35211 }
35212
35213 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
35214         LDKGossipTimestampFilter this_ptr_conv;
35215         this_ptr_conv.inner = untag_ptr(this_ptr);
35216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35218         this_ptr_conv.is_owned = false;
35219         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35220         return ret_conv;
35221 }
35222
35223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35224         LDKGossipTimestampFilter this_ptr_conv;
35225         this_ptr_conv.inner = untag_ptr(this_ptr);
35226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35228         this_ptr_conv.is_owned = false;
35229         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35230 }
35231
35232 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) {
35233         LDKThirtyTwoBytes chain_hash_arg_ref;
35234         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35235         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35236         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35237         int64_t ret_ref = 0;
35238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35240         return ret_ref;
35241 }
35242
35243 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35244         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35245         int64_t ret_ref = 0;
35246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35248         return ret_ref;
35249 }
35250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35251         LDKGossipTimestampFilter arg_conv;
35252         arg_conv.inner = untag_ptr(arg);
35253         arg_conv.is_owned = ptr_is_owned(arg);
35254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35255         arg_conv.is_owned = false;
35256         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35257         return ret_conv;
35258 }
35259
35260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35261         LDKGossipTimestampFilter orig_conv;
35262         orig_conv.inner = untag_ptr(orig);
35263         orig_conv.is_owned = ptr_is_owned(orig);
35264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35265         orig_conv.is_owned = false;
35266         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35267         int64_t ret_ref = 0;
35268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35270         return ret_ref;
35271 }
35272
35273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35274         if (!ptr_is_owned(this_ptr)) return;
35275         void* this_ptr_ptr = untag_ptr(this_ptr);
35276         CHECK_ACCESS(this_ptr_ptr);
35277         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35278         FREE(untag_ptr(this_ptr));
35279         ErrorAction_free(this_ptr_conv);
35280 }
35281
35282 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35283         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35284         *ret_copy = ErrorAction_clone(arg);
35285         int64_t ret_ref = tag_ptr(ret_copy, true);
35286         return ret_ref;
35287 }
35288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35289         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35290         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35291         return ret_conv;
35292 }
35293
35294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35295         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35296         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35297         *ret_copy = ErrorAction_clone(orig_conv);
35298         int64_t ret_ref = tag_ptr(ret_copy, true);
35299         return ret_ref;
35300 }
35301
35302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
35303         LDKErrorMessage msg_conv;
35304         msg_conv.inner = untag_ptr(msg);
35305         msg_conv.is_owned = ptr_is_owned(msg);
35306         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35307         msg_conv = ErrorMessage_clone(&msg_conv);
35308         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35309         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35310         int64_t ret_ref = tag_ptr(ret_copy, true);
35311         return ret_ref;
35312 }
35313
35314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
35315         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35316         *ret_copy = ErrorAction_ignore_error();
35317         int64_t ret_ref = tag_ptr(ret_copy, true);
35318         return ret_ref;
35319 }
35320
35321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
35322         LDKLevel a_conv = LDKLevel_from_java(env, a);
35323         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35324         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35325         int64_t ret_ref = tag_ptr(ret_copy, true);
35326         return ret_ref;
35327 }
35328
35329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
35330         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35331         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35332         int64_t ret_ref = tag_ptr(ret_copy, true);
35333         return ret_ref;
35334 }
35335
35336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
35337         LDKErrorMessage msg_conv;
35338         msg_conv.inner = untag_ptr(msg);
35339         msg_conv.is_owned = ptr_is_owned(msg);
35340         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35341         msg_conv = ErrorMessage_clone(&msg_conv);
35342         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35343         *ret_copy = ErrorAction_send_error_message(msg_conv);
35344         int64_t ret_ref = tag_ptr(ret_copy, true);
35345         return ret_ref;
35346 }
35347
35348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
35349         LDKWarningMessage msg_conv;
35350         msg_conv.inner = untag_ptr(msg);
35351         msg_conv.is_owned = ptr_is_owned(msg);
35352         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35353         msg_conv = WarningMessage_clone(&msg_conv);
35354         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
35355         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35356         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35357         int64_t ret_ref = tag_ptr(ret_copy, true);
35358         return ret_ref;
35359 }
35360
35361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35362         LDKLightningError this_obj_conv;
35363         this_obj_conv.inner = untag_ptr(this_obj);
35364         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35366         LightningError_free(this_obj_conv);
35367 }
35368
35369 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
35370         LDKLightningError 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         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35376         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35377         Str_free(ret_str);
35378         return ret_conv;
35379 }
35380
35381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35382         LDKLightningError this_ptr_conv;
35383         this_ptr_conv.inner = untag_ptr(this_ptr);
35384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35386         this_ptr_conv.is_owned = false;
35387         LDKStr val_conv = java_to_owned_str(env, val);
35388         LightningError_set_err(&this_ptr_conv, val_conv);
35389 }
35390
35391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
35392         LDKLightningError this_ptr_conv;
35393         this_ptr_conv.inner = untag_ptr(this_ptr);
35394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35396         this_ptr_conv.is_owned = false;
35397         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35398         *ret_copy = LightningError_get_action(&this_ptr_conv);
35399         int64_t ret_ref = tag_ptr(ret_copy, true);
35400         return ret_ref;
35401 }
35402
35403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35404         LDKLightningError 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         void* val_ptr = untag_ptr(val);
35410         CHECK_ACCESS(val_ptr);
35411         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35412         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35413         LightningError_set_action(&this_ptr_conv, val_conv);
35414 }
35415
35416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
35417         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
35418         void* action_arg_ptr = untag_ptr(action_arg);
35419         CHECK_ACCESS(action_arg_ptr);
35420         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35421         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35422         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35423         int64_t ret_ref = 0;
35424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35426         return ret_ref;
35427 }
35428
35429 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35430         LDKLightningError ret_var = LightningError_clone(arg);
35431         int64_t ret_ref = 0;
35432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35434         return ret_ref;
35435 }
35436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35437         LDKLightningError arg_conv;
35438         arg_conv.inner = untag_ptr(arg);
35439         arg_conv.is_owned = ptr_is_owned(arg);
35440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35441         arg_conv.is_owned = false;
35442         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35443         return ret_conv;
35444 }
35445
35446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35447         LDKLightningError orig_conv;
35448         orig_conv.inner = untag_ptr(orig);
35449         orig_conv.is_owned = ptr_is_owned(orig);
35450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35451         orig_conv.is_owned = false;
35452         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35453         int64_t ret_ref = 0;
35454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35456         return ret_ref;
35457 }
35458
35459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35460         LDKCommitmentUpdate this_obj_conv;
35461         this_obj_conv.inner = untag_ptr(this_obj);
35462         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35464         CommitmentUpdate_free(this_obj_conv);
35465 }
35466
35467 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35468         LDKCommitmentUpdate this_ptr_conv;
35469         this_ptr_conv.inner = untag_ptr(this_ptr);
35470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35472         this_ptr_conv.is_owned = false;
35473         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35474         int64_tArray ret_arr = NULL;
35475         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35476         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35477         for (size_t p = 0; p < ret_var.datalen; p++) {
35478                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35479                 int64_t ret_conv_15_ref = 0;
35480                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35481                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35482                 ret_arr_ptr[p] = ret_conv_15_ref;
35483         }
35484         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35485         FREE(ret_var.data);
35486         return ret_arr;
35487 }
35488
35489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35490         LDKCommitmentUpdate this_ptr_conv;
35491         this_ptr_conv.inner = untag_ptr(this_ptr);
35492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35494         this_ptr_conv.is_owned = false;
35495         LDKCVec_UpdateAddHTLCZ val_constr;
35496         val_constr.datalen = (*env)->GetArrayLength(env, val);
35497         if (val_constr.datalen > 0)
35498                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35499         else
35500                 val_constr.data = NULL;
35501         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35502         for (size_t p = 0; p < val_constr.datalen; p++) {
35503                 int64_t val_conv_15 = val_vals[p];
35504                 LDKUpdateAddHTLC val_conv_15_conv;
35505                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35506                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35507                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35508                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35509                 val_constr.data[p] = val_conv_15_conv;
35510         }
35511         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35512         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35513 }
35514
35515 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35516         LDKCommitmentUpdate this_ptr_conv;
35517         this_ptr_conv.inner = untag_ptr(this_ptr);
35518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35520         this_ptr_conv.is_owned = false;
35521         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35522         int64_tArray ret_arr = NULL;
35523         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35524         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35525         for (size_t t = 0; t < ret_var.datalen; t++) {
35526                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35527                 int64_t ret_conv_19_ref = 0;
35528                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35529                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
35530                 ret_arr_ptr[t] = ret_conv_19_ref;
35531         }
35532         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35533         FREE(ret_var.data);
35534         return ret_arr;
35535 }
35536
35537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35538         LDKCommitmentUpdate this_ptr_conv;
35539         this_ptr_conv.inner = untag_ptr(this_ptr);
35540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35542         this_ptr_conv.is_owned = false;
35543         LDKCVec_UpdateFulfillHTLCZ val_constr;
35544         val_constr.datalen = (*env)->GetArrayLength(env, val);
35545         if (val_constr.datalen > 0)
35546                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35547         else
35548                 val_constr.data = NULL;
35549         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35550         for (size_t t = 0; t < val_constr.datalen; t++) {
35551                 int64_t val_conv_19 = val_vals[t];
35552                 LDKUpdateFulfillHTLC val_conv_19_conv;
35553                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
35554                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
35555                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35556                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35557                 val_constr.data[t] = val_conv_19_conv;
35558         }
35559         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35560         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35561 }
35562
35563 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35564         LDKCommitmentUpdate this_ptr_conv;
35565         this_ptr_conv.inner = untag_ptr(this_ptr);
35566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35568         this_ptr_conv.is_owned = false;
35569         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35570         int64_tArray ret_arr = NULL;
35571         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35572         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35573         for (size_t q = 0; q < ret_var.datalen; q++) {
35574                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35575                 int64_t ret_conv_16_ref = 0;
35576                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35577                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35578                 ret_arr_ptr[q] = ret_conv_16_ref;
35579         }
35580         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35581         FREE(ret_var.data);
35582         return ret_arr;
35583 }
35584
35585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35586         LDKCommitmentUpdate this_ptr_conv;
35587         this_ptr_conv.inner = untag_ptr(this_ptr);
35588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35590         this_ptr_conv.is_owned = false;
35591         LDKCVec_UpdateFailHTLCZ val_constr;
35592         val_constr.datalen = (*env)->GetArrayLength(env, val);
35593         if (val_constr.datalen > 0)
35594                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35595         else
35596                 val_constr.data = NULL;
35597         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35598         for (size_t q = 0; q < val_constr.datalen; q++) {
35599                 int64_t val_conv_16 = val_vals[q];
35600                 LDKUpdateFailHTLC val_conv_16_conv;
35601                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
35602                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
35603                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35604                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
35605                 val_constr.data[q] = val_conv_16_conv;
35606         }
35607         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35608         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
35609 }
35610
35611 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35612         LDKCommitmentUpdate this_ptr_conv;
35613         this_ptr_conv.inner = untag_ptr(this_ptr);
35614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35616         this_ptr_conv.is_owned = false;
35617         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
35618         int64_tArray ret_arr = NULL;
35619         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35620         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35621         for (size_t z = 0; z < ret_var.datalen; z++) {
35622                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
35623                 int64_t ret_conv_25_ref = 0;
35624                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
35625                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
35626                 ret_arr_ptr[z] = ret_conv_25_ref;
35627         }
35628         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35629         FREE(ret_var.data);
35630         return ret_arr;
35631 }
35632
35633 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) {
35634         LDKCommitmentUpdate this_ptr_conv;
35635         this_ptr_conv.inner = untag_ptr(this_ptr);
35636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35638         this_ptr_conv.is_owned = false;
35639         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
35640         val_constr.datalen = (*env)->GetArrayLength(env, val);
35641         if (val_constr.datalen > 0)
35642                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35643         else
35644                 val_constr.data = NULL;
35645         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35646         for (size_t z = 0; z < val_constr.datalen; z++) {
35647                 int64_t val_conv_25 = val_vals[z];
35648                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
35649                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
35650                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
35651                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
35652                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
35653                 val_constr.data[z] = val_conv_25_conv;
35654         }
35655         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35656         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
35657 }
35658
35659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
35660         LDKCommitmentUpdate this_ptr_conv;
35661         this_ptr_conv.inner = untag_ptr(this_ptr);
35662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35664         this_ptr_conv.is_owned = false;
35665         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
35666         int64_t ret_ref = 0;
35667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35669         return ret_ref;
35670 }
35671
35672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35673         LDKCommitmentUpdate this_ptr_conv;
35674         this_ptr_conv.inner = untag_ptr(this_ptr);
35675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35677         this_ptr_conv.is_owned = false;
35678         LDKUpdateFee val_conv;
35679         val_conv.inner = untag_ptr(val);
35680         val_conv.is_owned = ptr_is_owned(val);
35681         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35682         val_conv = UpdateFee_clone(&val_conv);
35683         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
35684 }
35685
35686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
35687         LDKCommitmentUpdate this_ptr_conv;
35688         this_ptr_conv.inner = untag_ptr(this_ptr);
35689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35691         this_ptr_conv.is_owned = false;
35692         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
35693         int64_t ret_ref = 0;
35694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35696         return ret_ref;
35697 }
35698
35699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35700         LDKCommitmentUpdate this_ptr_conv;
35701         this_ptr_conv.inner = untag_ptr(this_ptr);
35702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35704         this_ptr_conv.is_owned = false;
35705         LDKCommitmentSigned val_conv;
35706         val_conv.inner = untag_ptr(val);
35707         val_conv.is_owned = ptr_is_owned(val);
35708         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35709         val_conv = CommitmentSigned_clone(&val_conv);
35710         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
35711 }
35712
35713 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) {
35714         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
35715         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
35716         if (update_add_htlcs_arg_constr.datalen > 0)
35717                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35718         else
35719                 update_add_htlcs_arg_constr.data = NULL;
35720         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
35721         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
35722                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
35723                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
35724                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
35725                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
35726                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
35727                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
35728                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
35729         }
35730         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
35731         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
35732         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
35733         if (update_fulfill_htlcs_arg_constr.datalen > 0)
35734                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35735         else
35736                 update_fulfill_htlcs_arg_constr.data = NULL;
35737         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
35738         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
35739                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
35740                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
35741                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
35742                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
35743                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
35744                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
35745                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
35746         }
35747         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
35748         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
35749         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
35750         if (update_fail_htlcs_arg_constr.datalen > 0)
35751                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35752         else
35753                 update_fail_htlcs_arg_constr.data = NULL;
35754         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
35755         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
35756                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
35757                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
35758                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
35759                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
35760                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
35761                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
35762                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
35763         }
35764         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
35765         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
35766         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
35767         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
35768                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35769         else
35770                 update_fail_malformed_htlcs_arg_constr.data = NULL;
35771         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
35772         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
35773                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
35774                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
35775                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
35776                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
35777                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
35778                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
35779                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
35780         }
35781         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
35782         LDKUpdateFee update_fee_arg_conv;
35783         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
35784         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
35785         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
35786         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
35787         LDKCommitmentSigned commitment_signed_arg_conv;
35788         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
35789         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
35790         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
35791         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
35792         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);
35793         int64_t ret_ref = 0;
35794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35796         return ret_ref;
35797 }
35798
35799 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
35800         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
35801         int64_t ret_ref = 0;
35802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35804         return ret_ref;
35805 }
35806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35807         LDKCommitmentUpdate arg_conv;
35808         arg_conv.inner = untag_ptr(arg);
35809         arg_conv.is_owned = ptr_is_owned(arg);
35810         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35811         arg_conv.is_owned = false;
35812         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
35813         return ret_conv;
35814 }
35815
35816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35817         LDKCommitmentUpdate orig_conv;
35818         orig_conv.inner = untag_ptr(orig);
35819         orig_conv.is_owned = ptr_is_owned(orig);
35820         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35821         orig_conv.is_owned = false;
35822         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
35823         int64_t ret_ref = 0;
35824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35826         return ret_ref;
35827 }
35828
35829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35830         if (!ptr_is_owned(this_ptr)) return;
35831         void* this_ptr_ptr = untag_ptr(this_ptr);
35832         CHECK_ACCESS(this_ptr_ptr);
35833         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
35834         FREE(untag_ptr(this_ptr));
35835         ChannelMessageHandler_free(this_ptr_conv);
35836 }
35837
35838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35839         if (!ptr_is_owned(this_ptr)) return;
35840         void* this_ptr_ptr = untag_ptr(this_ptr);
35841         CHECK_ACCESS(this_ptr_ptr);
35842         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
35843         FREE(untag_ptr(this_ptr));
35844         RoutingMessageHandler_free(this_ptr_conv);
35845 }
35846
35847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
35848         LDKAcceptChannel obj_conv;
35849         obj_conv.inner = untag_ptr(obj);
35850         obj_conv.is_owned = ptr_is_owned(obj);
35851         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35852         obj_conv.is_owned = false;
35853         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
35854         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35855         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35856         CVec_u8Z_free(ret_var);
35857         return ret_arr;
35858 }
35859
35860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35861         LDKu8slice ser_ref;
35862         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35863         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35864         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
35865         *ret_conv = AcceptChannel_read(ser_ref);
35866         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35867         return tag_ptr(ret_conv, true);
35868 }
35869
35870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35871         LDKAnnouncementSignatures obj_conv;
35872         obj_conv.inner = untag_ptr(obj);
35873         obj_conv.is_owned = ptr_is_owned(obj);
35874         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35875         obj_conv.is_owned = false;
35876         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
35877         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35878         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35879         CVec_u8Z_free(ret_var);
35880         return ret_arr;
35881 }
35882
35883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35884         LDKu8slice ser_ref;
35885         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35886         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35887         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
35888         *ret_conv = AnnouncementSignatures_read(ser_ref);
35889         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35890         return tag_ptr(ret_conv, true);
35891 }
35892
35893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
35894         LDKChannelReestablish obj_conv;
35895         obj_conv.inner = untag_ptr(obj);
35896         obj_conv.is_owned = ptr_is_owned(obj);
35897         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35898         obj_conv.is_owned = false;
35899         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
35900         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35901         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35902         CVec_u8Z_free(ret_var);
35903         return ret_arr;
35904 }
35905
35906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35907         LDKu8slice ser_ref;
35908         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35909         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35910         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
35911         *ret_conv = ChannelReestablish_read(ser_ref);
35912         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35913         return tag_ptr(ret_conv, true);
35914 }
35915
35916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35917         LDKClosingSigned obj_conv;
35918         obj_conv.inner = untag_ptr(obj);
35919         obj_conv.is_owned = ptr_is_owned(obj);
35920         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35921         obj_conv.is_owned = false;
35922         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
35923         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35924         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35925         CVec_u8Z_free(ret_var);
35926         return ret_arr;
35927 }
35928
35929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35930         LDKu8slice ser_ref;
35931         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35932         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35933         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
35934         *ret_conv = ClosingSigned_read(ser_ref);
35935         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35936         return tag_ptr(ret_conv, true);
35937 }
35938
35939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
35940         LDKClosingSignedFeeRange obj_conv;
35941         obj_conv.inner = untag_ptr(obj);
35942         obj_conv.is_owned = ptr_is_owned(obj);
35943         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35944         obj_conv.is_owned = false;
35945         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
35946         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35947         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35948         CVec_u8Z_free(ret_var);
35949         return ret_arr;
35950 }
35951
35952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35953         LDKu8slice ser_ref;
35954         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35955         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35956         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
35957         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
35958         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35959         return tag_ptr(ret_conv, true);
35960 }
35961
35962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35963         LDKCommitmentSigned obj_conv;
35964         obj_conv.inner = untag_ptr(obj);
35965         obj_conv.is_owned = ptr_is_owned(obj);
35966         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35967         obj_conv.is_owned = false;
35968         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
35969         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35970         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35971         CVec_u8Z_free(ret_var);
35972         return ret_arr;
35973 }
35974
35975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35976         LDKu8slice ser_ref;
35977         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35978         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35979         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
35980         *ret_conv = CommitmentSigned_read(ser_ref);
35981         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35982         return tag_ptr(ret_conv, true);
35983 }
35984
35985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
35986         LDKFundingCreated obj_conv;
35987         obj_conv.inner = untag_ptr(obj);
35988         obj_conv.is_owned = ptr_is_owned(obj);
35989         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35990         obj_conv.is_owned = false;
35991         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
35992         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35993         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35994         CVec_u8Z_free(ret_var);
35995         return ret_arr;
35996 }
35997
35998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35999         LDKu8slice ser_ref;
36000         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36001         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36002         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36003         *ret_conv = FundingCreated_read(ser_ref);
36004         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36005         return tag_ptr(ret_conv, true);
36006 }
36007
36008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36009         LDKFundingSigned obj_conv;
36010         obj_conv.inner = untag_ptr(obj);
36011         obj_conv.is_owned = ptr_is_owned(obj);
36012         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36013         obj_conv.is_owned = false;
36014         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36015         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36016         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36017         CVec_u8Z_free(ret_var);
36018         return ret_arr;
36019 }
36020
36021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36022         LDKu8slice ser_ref;
36023         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36024         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36025         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36026         *ret_conv = FundingSigned_read(ser_ref);
36027         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36028         return tag_ptr(ret_conv, true);
36029 }
36030
36031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
36032         LDKChannelReady obj_conv;
36033         obj_conv.inner = untag_ptr(obj);
36034         obj_conv.is_owned = ptr_is_owned(obj);
36035         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36036         obj_conv.is_owned = false;
36037         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36038         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36039         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36040         CVec_u8Z_free(ret_var);
36041         return ret_arr;
36042 }
36043
36044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36045         LDKu8slice ser_ref;
36046         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36047         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36048         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36049         *ret_conv = ChannelReady_read(ser_ref);
36050         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36051         return tag_ptr(ret_conv, true);
36052 }
36053
36054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
36055         LDKInit obj_conv;
36056         obj_conv.inner = untag_ptr(obj);
36057         obj_conv.is_owned = ptr_is_owned(obj);
36058         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36059         obj_conv.is_owned = false;
36060         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36061         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36062         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36063         CVec_u8Z_free(ret_var);
36064         return ret_arr;
36065 }
36066
36067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36068         LDKu8slice ser_ref;
36069         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36070         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36071         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36072         *ret_conv = Init_read(ser_ref);
36073         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36074         return tag_ptr(ret_conv, true);
36075 }
36076
36077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36078         LDKOpenChannel obj_conv;
36079         obj_conv.inner = untag_ptr(obj);
36080         obj_conv.is_owned = ptr_is_owned(obj);
36081         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36082         obj_conv.is_owned = false;
36083         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36084         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36085         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36086         CVec_u8Z_free(ret_var);
36087         return ret_arr;
36088 }
36089
36090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36091         LDKu8slice ser_ref;
36092         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36093         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36094         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36095         *ret_conv = OpenChannel_read(ser_ref);
36096         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36097         return tag_ptr(ret_conv, true);
36098 }
36099
36100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
36101         LDKRevokeAndACK obj_conv;
36102         obj_conv.inner = untag_ptr(obj);
36103         obj_conv.is_owned = ptr_is_owned(obj);
36104         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36105         obj_conv.is_owned = false;
36106         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36107         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36108         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36109         CVec_u8Z_free(ret_var);
36110         return ret_arr;
36111 }
36112
36113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36114         LDKu8slice ser_ref;
36115         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36116         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36117         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36118         *ret_conv = RevokeAndACK_read(ser_ref);
36119         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36120         return tag_ptr(ret_conv, true);
36121 }
36122
36123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
36124         LDKShutdown obj_conv;
36125         obj_conv.inner = untag_ptr(obj);
36126         obj_conv.is_owned = ptr_is_owned(obj);
36127         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36128         obj_conv.is_owned = false;
36129         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36130         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36131         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36132         CVec_u8Z_free(ret_var);
36133         return ret_arr;
36134 }
36135
36136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36137         LDKu8slice ser_ref;
36138         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36139         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36140         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36141         *ret_conv = Shutdown_read(ser_ref);
36142         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36143         return tag_ptr(ret_conv, true);
36144 }
36145
36146 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36147         LDKUpdateFailHTLC obj_conv;
36148         obj_conv.inner = untag_ptr(obj);
36149         obj_conv.is_owned = ptr_is_owned(obj);
36150         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36151         obj_conv.is_owned = false;
36152         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36153         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36154         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36155         CVec_u8Z_free(ret_var);
36156         return ret_arr;
36157 }
36158
36159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36160         LDKu8slice ser_ref;
36161         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36162         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36163         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36164         *ret_conv = UpdateFailHTLC_read(ser_ref);
36165         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36166         return tag_ptr(ret_conv, true);
36167 }
36168
36169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36170         LDKUpdateFailMalformedHTLC obj_conv;
36171         obj_conv.inner = untag_ptr(obj);
36172         obj_conv.is_owned = ptr_is_owned(obj);
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36174         obj_conv.is_owned = false;
36175         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36176         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36177         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36178         CVec_u8Z_free(ret_var);
36179         return ret_arr;
36180 }
36181
36182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36183         LDKu8slice ser_ref;
36184         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36185         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36186         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36187         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36188         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36189         return tag_ptr(ret_conv, true);
36190 }
36191
36192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
36193         LDKUpdateFee obj_conv;
36194         obj_conv.inner = untag_ptr(obj);
36195         obj_conv.is_owned = ptr_is_owned(obj);
36196         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36197         obj_conv.is_owned = false;
36198         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36199         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36200         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36201         CVec_u8Z_free(ret_var);
36202         return ret_arr;
36203 }
36204
36205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36206         LDKu8slice ser_ref;
36207         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36208         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36209         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36210         *ret_conv = UpdateFee_read(ser_ref);
36211         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36212         return tag_ptr(ret_conv, true);
36213 }
36214
36215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36216         LDKUpdateFulfillHTLC obj_conv;
36217         obj_conv.inner = untag_ptr(obj);
36218         obj_conv.is_owned = ptr_is_owned(obj);
36219         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36220         obj_conv.is_owned = false;
36221         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36222         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36223         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36224         CVec_u8Z_free(ret_var);
36225         return ret_arr;
36226 }
36227
36228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36229         LDKu8slice ser_ref;
36230         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36231         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36232         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36233         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36234         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36235         return tag_ptr(ret_conv, true);
36236 }
36237
36238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36239         LDKUpdateAddHTLC obj_conv;
36240         obj_conv.inner = untag_ptr(obj);
36241         obj_conv.is_owned = ptr_is_owned(obj);
36242         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36243         obj_conv.is_owned = false;
36244         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36245         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36246         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36247         CVec_u8Z_free(ret_var);
36248         return ret_arr;
36249 }
36250
36251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36252         LDKu8slice ser_ref;
36253         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36254         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36255         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36256         *ret_conv = UpdateAddHTLC_read(ser_ref);
36257         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36258         return tag_ptr(ret_conv, true);
36259 }
36260
36261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
36262         LDKPing obj_conv;
36263         obj_conv.inner = untag_ptr(obj);
36264         obj_conv.is_owned = ptr_is_owned(obj);
36265         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36266         obj_conv.is_owned = false;
36267         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36268         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36269         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36270         CVec_u8Z_free(ret_var);
36271         return ret_arr;
36272 }
36273
36274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36275         LDKu8slice ser_ref;
36276         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36277         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36278         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36279         *ret_conv = Ping_read(ser_ref);
36280         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36281         return tag_ptr(ret_conv, true);
36282 }
36283
36284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
36285         LDKPong obj_conv;
36286         obj_conv.inner = untag_ptr(obj);
36287         obj_conv.is_owned = ptr_is_owned(obj);
36288         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36289         obj_conv.is_owned = false;
36290         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36291         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36292         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36293         CVec_u8Z_free(ret_var);
36294         return ret_arr;
36295 }
36296
36297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36298         LDKu8slice ser_ref;
36299         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36300         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36301         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36302         *ret_conv = Pong_read(ser_ref);
36303         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36304         return tag_ptr(ret_conv, true);
36305 }
36306
36307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36308         LDKUnsignedChannelAnnouncement obj_conv;
36309         obj_conv.inner = untag_ptr(obj);
36310         obj_conv.is_owned = ptr_is_owned(obj);
36311         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36312         obj_conv.is_owned = false;
36313         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36314         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36315         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36316         CVec_u8Z_free(ret_var);
36317         return ret_arr;
36318 }
36319
36320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36321         LDKu8slice ser_ref;
36322         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36323         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36324         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36325         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36326         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36327         return tag_ptr(ret_conv, true);
36328 }
36329
36330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36331         LDKChannelAnnouncement obj_conv;
36332         obj_conv.inner = untag_ptr(obj);
36333         obj_conv.is_owned = ptr_is_owned(obj);
36334         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36335         obj_conv.is_owned = false;
36336         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36337         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36338         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36339         CVec_u8Z_free(ret_var);
36340         return ret_arr;
36341 }
36342
36343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36344         LDKu8slice ser_ref;
36345         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36346         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36347         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36348         *ret_conv = ChannelAnnouncement_read(ser_ref);
36349         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36350         return tag_ptr(ret_conv, true);
36351 }
36352
36353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36354         LDKUnsignedChannelUpdate obj_conv;
36355         obj_conv.inner = untag_ptr(obj);
36356         obj_conv.is_owned = ptr_is_owned(obj);
36357         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36358         obj_conv.is_owned = false;
36359         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36360         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36361         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36362         CVec_u8Z_free(ret_var);
36363         return ret_arr;
36364 }
36365
36366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36367         LDKu8slice ser_ref;
36368         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36369         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36370         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36371         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36372         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36373         return tag_ptr(ret_conv, true);
36374 }
36375
36376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36377         LDKChannelUpdate obj_conv;
36378         obj_conv.inner = untag_ptr(obj);
36379         obj_conv.is_owned = ptr_is_owned(obj);
36380         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36381         obj_conv.is_owned = false;
36382         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36383         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36384         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36385         CVec_u8Z_free(ret_var);
36386         return ret_arr;
36387 }
36388
36389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36390         LDKu8slice ser_ref;
36391         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36392         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36393         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36394         *ret_conv = ChannelUpdate_read(ser_ref);
36395         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36396         return tag_ptr(ret_conv, true);
36397 }
36398
36399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36400         LDKErrorMessage obj_conv;
36401         obj_conv.inner = untag_ptr(obj);
36402         obj_conv.is_owned = ptr_is_owned(obj);
36403         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36404         obj_conv.is_owned = false;
36405         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36406         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36407         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36408         CVec_u8Z_free(ret_var);
36409         return ret_arr;
36410 }
36411
36412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36413         LDKu8slice ser_ref;
36414         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36415         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36416         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36417         *ret_conv = ErrorMessage_read(ser_ref);
36418         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36419         return tag_ptr(ret_conv, true);
36420 }
36421
36422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36423         LDKWarningMessage obj_conv;
36424         obj_conv.inner = untag_ptr(obj);
36425         obj_conv.is_owned = ptr_is_owned(obj);
36426         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36427         obj_conv.is_owned = false;
36428         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36429         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36430         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36431         CVec_u8Z_free(ret_var);
36432         return ret_arr;
36433 }
36434
36435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36436         LDKu8slice ser_ref;
36437         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36438         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36439         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36440         *ret_conv = WarningMessage_read(ser_ref);
36441         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36442         return tag_ptr(ret_conv, true);
36443 }
36444
36445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36446         LDKUnsignedNodeAnnouncement obj_conv;
36447         obj_conv.inner = untag_ptr(obj);
36448         obj_conv.is_owned = ptr_is_owned(obj);
36449         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36450         obj_conv.is_owned = false;
36451         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36452         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36453         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36454         CVec_u8Z_free(ret_var);
36455         return ret_arr;
36456 }
36457
36458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36459         LDKu8slice ser_ref;
36460         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36461         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36462         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36463         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36464         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36465         return tag_ptr(ret_conv, true);
36466 }
36467
36468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36469         LDKNodeAnnouncement obj_conv;
36470         obj_conv.inner = untag_ptr(obj);
36471         obj_conv.is_owned = ptr_is_owned(obj);
36472         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36473         obj_conv.is_owned = false;
36474         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36475         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36476         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36477         CVec_u8Z_free(ret_var);
36478         return ret_arr;
36479 }
36480
36481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36482         LDKu8slice ser_ref;
36483         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36484         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36485         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36486         *ret_conv = NodeAnnouncement_read(ser_ref);
36487         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36488         return tag_ptr(ret_conv, true);
36489 }
36490
36491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36492         LDKu8slice ser_ref;
36493         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36494         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36495         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36496         *ret_conv = QueryShortChannelIds_read(ser_ref);
36497         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36498         return tag_ptr(ret_conv, true);
36499 }
36500
36501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
36502         LDKQueryShortChannelIds obj_conv;
36503         obj_conv.inner = untag_ptr(obj);
36504         obj_conv.is_owned = ptr_is_owned(obj);
36505         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36506         obj_conv.is_owned = false;
36507         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
36508         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36509         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36510         CVec_u8Z_free(ret_var);
36511         return ret_arr;
36512 }
36513
36514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
36515         LDKReplyShortChannelIdsEnd obj_conv;
36516         obj_conv.inner = untag_ptr(obj);
36517         obj_conv.is_owned = ptr_is_owned(obj);
36518         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36519         obj_conv.is_owned = false;
36520         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36521         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36522         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36523         CVec_u8Z_free(ret_var);
36524         return ret_arr;
36525 }
36526
36527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36528         LDKu8slice ser_ref;
36529         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36530         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36531         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36532         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36533         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36534         return tag_ptr(ret_conv, true);
36535 }
36536
36537 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
36538         LDKQueryChannelRange this_arg_conv;
36539         this_arg_conv.inner = untag_ptr(this_arg);
36540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36542         this_arg_conv.is_owned = false;
36543         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
36544         return ret_conv;
36545 }
36546
36547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36548         LDKQueryChannelRange obj_conv;
36549         obj_conv.inner = untag_ptr(obj);
36550         obj_conv.is_owned = ptr_is_owned(obj);
36551         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36552         obj_conv.is_owned = false;
36553         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36554         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36555         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36556         CVec_u8Z_free(ret_var);
36557         return ret_arr;
36558 }
36559
36560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36561         LDKu8slice ser_ref;
36562         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36563         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36564         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36565         *ret_conv = QueryChannelRange_read(ser_ref);
36566         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36567         return tag_ptr(ret_conv, true);
36568 }
36569
36570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36571         LDKu8slice ser_ref;
36572         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36573         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36574         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36575         *ret_conv = ReplyChannelRange_read(ser_ref);
36576         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36577         return tag_ptr(ret_conv, true);
36578 }
36579
36580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36581         LDKReplyChannelRange obj_conv;
36582         obj_conv.inner = untag_ptr(obj);
36583         obj_conv.is_owned = ptr_is_owned(obj);
36584         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36585         obj_conv.is_owned = false;
36586         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36587         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36588         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36589         CVec_u8Z_free(ret_var);
36590         return ret_arr;
36591 }
36592
36593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
36594         LDKGossipTimestampFilter obj_conv;
36595         obj_conv.inner = untag_ptr(obj);
36596         obj_conv.is_owned = ptr_is_owned(obj);
36597         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36598         obj_conv.is_owned = false;
36599         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
36600         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36601         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36602         CVec_u8Z_free(ret_var);
36603         return ret_arr;
36604 }
36605
36606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36607         LDKu8slice ser_ref;
36608         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36609         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36610         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36611         *ret_conv = GossipTimestampFilter_read(ser_ref);
36612         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36613         return tag_ptr(ret_conv, true);
36614 }
36615
36616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36617         if (!ptr_is_owned(this_ptr)) return;
36618         void* this_ptr_ptr = untag_ptr(this_ptr);
36619         CHECK_ACCESS(this_ptr_ptr);
36620         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
36621         FREE(untag_ptr(this_ptr));
36622         CustomMessageHandler_free(this_ptr_conv);
36623 }
36624
36625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36626         LDKIgnoringMessageHandler this_obj_conv;
36627         this_obj_conv.inner = untag_ptr(this_obj);
36628         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36630         IgnoringMessageHandler_free(this_obj_conv);
36631 }
36632
36633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
36634         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
36635         int64_t ret_ref = 0;
36636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36638         return ret_ref;
36639 }
36640
36641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36642         LDKIgnoringMessageHandler this_arg_conv;
36643         this_arg_conv.inner = untag_ptr(this_arg);
36644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36646         this_arg_conv.is_owned = false;
36647         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36648         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36649         return tag_ptr(ret_ret, true);
36650 }
36651
36652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36653         LDKIgnoringMessageHandler this_arg_conv;
36654         this_arg_conv.inner = untag_ptr(this_arg);
36655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36657         this_arg_conv.is_owned = false;
36658         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
36659         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
36660         return tag_ptr(ret_ret, true);
36661 }
36662
36663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
36664         LDKIgnoringMessageHandler this_arg_conv;
36665         this_arg_conv.inner = untag_ptr(this_arg);
36666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36668         this_arg_conv.is_owned = false;
36669         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
36670         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
36671         return tag_ptr(ret_ret, true);
36672 }
36673
36674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36675         LDKIgnoringMessageHandler this_arg_conv;
36676         this_arg_conv.inner = untag_ptr(this_arg);
36677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36679         this_arg_conv.is_owned = false;
36680         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
36681         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
36682         return tag_ptr(ret_ret, true);
36683 }
36684
36685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36686         LDKErroringMessageHandler this_obj_conv;
36687         this_obj_conv.inner = untag_ptr(this_obj);
36688         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36690         ErroringMessageHandler_free(this_obj_conv);
36691 }
36692
36693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
36694         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
36695         int64_t ret_ref = 0;
36696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36698         return ret_ref;
36699 }
36700
36701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36702         LDKErroringMessageHandler this_arg_conv;
36703         this_arg_conv.inner = untag_ptr(this_arg);
36704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36706         this_arg_conv.is_owned = false;
36707         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36708         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36709         return tag_ptr(ret_ret, true);
36710 }
36711
36712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36713         LDKErroringMessageHandler this_arg_conv;
36714         this_arg_conv.inner = untag_ptr(this_arg);
36715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36717         this_arg_conv.is_owned = false;
36718         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36719         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
36720         return tag_ptr(ret_ret, true);
36721 }
36722
36723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36724         LDKMessageHandler this_obj_conv;
36725         this_obj_conv.inner = untag_ptr(this_obj);
36726         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36728         MessageHandler_free(this_obj_conv);
36729 }
36730
36731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36732         LDKMessageHandler this_ptr_conv;
36733         this_ptr_conv.inner = untag_ptr(this_ptr);
36734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36736         this_ptr_conv.is_owned = false;
36737         // WARNING: This object doesn't live past this scope, needs clone!
36738         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
36739         return ret_ret;
36740 }
36741
36742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36743         LDKMessageHandler this_ptr_conv;
36744         this_ptr_conv.inner = untag_ptr(this_ptr);
36745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36747         this_ptr_conv.is_owned = false;
36748         void* val_ptr = untag_ptr(val);
36749         CHECK_ACCESS(val_ptr);
36750         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
36751         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
36752                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36753                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
36754         }
36755         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
36756 }
36757
36758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36759         LDKMessageHandler this_ptr_conv;
36760         this_ptr_conv.inner = untag_ptr(this_ptr);
36761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36763         this_ptr_conv.is_owned = false;
36764         // WARNING: This object doesn't live past this scope, needs clone!
36765         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
36766         return ret_ret;
36767 }
36768
36769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36770         LDKMessageHandler this_ptr_conv;
36771         this_ptr_conv.inner = untag_ptr(this_ptr);
36772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36774         this_ptr_conv.is_owned = false;
36775         void* val_ptr = untag_ptr(val);
36776         CHECK_ACCESS(val_ptr);
36777         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
36778         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36779                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36780                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
36781         }
36782         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
36783 }
36784
36785 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) {
36786         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
36787         CHECK_ACCESS(chan_handler_arg_ptr);
36788         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
36789         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
36790                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36791                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
36792         }
36793         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
36794         CHECK_ACCESS(route_handler_arg_ptr);
36795         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
36796         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36797                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36798                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
36799         }
36800         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
36801         int64_t ret_ref = 0;
36802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36804         return ret_ref;
36805 }
36806
36807 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
36808         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36809         *ret_ret = SocketDescriptor_clone(arg);
36810         return tag_ptr(ret_ret, true);
36811 }
36812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36813         void* arg_ptr = untag_ptr(arg);
36814         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
36815         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
36816         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
36817         return ret_conv;
36818 }
36819
36820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36821         void* orig_ptr = untag_ptr(orig);
36822         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
36823         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
36824         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36825         *ret_ret = SocketDescriptor_clone(orig_conv);
36826         return tag_ptr(ret_ret, true);
36827 }
36828
36829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36830         if (!ptr_is_owned(this_ptr)) return;
36831         void* this_ptr_ptr = untag_ptr(this_ptr);
36832         CHECK_ACCESS(this_ptr_ptr);
36833         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
36834         FREE(untag_ptr(this_ptr));
36835         SocketDescriptor_free(this_ptr_conv);
36836 }
36837
36838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36839         LDKPeerHandleError this_obj_conv;
36840         this_obj_conv.inner = untag_ptr(this_obj);
36841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36843         PeerHandleError_free(this_obj_conv);
36844 }
36845
36846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
36847         LDKPeerHandleError this_ptr_conv;
36848         this_ptr_conv.inner = untag_ptr(this_ptr);
36849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36851         this_ptr_conv.is_owned = false;
36852         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
36853         return ret_conv;
36854 }
36855
36856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36857         LDKPeerHandleError this_ptr_conv;
36858         this_ptr_conv.inner = untag_ptr(this_ptr);
36859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36861         this_ptr_conv.is_owned = false;
36862         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
36863 }
36864
36865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
36866         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_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
36873 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
36874         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
36875         int64_t ret_ref = 0;
36876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36878         return ret_ref;
36879 }
36880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36881         LDKPeerHandleError arg_conv;
36882         arg_conv.inner = untag_ptr(arg);
36883         arg_conv.is_owned = ptr_is_owned(arg);
36884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36885         arg_conv.is_owned = false;
36886         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
36887         return ret_conv;
36888 }
36889
36890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36891         LDKPeerHandleError orig_conv;
36892         orig_conv.inner = untag_ptr(orig);
36893         orig_conv.is_owned = ptr_is_owned(orig);
36894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36895         orig_conv.is_owned = false;
36896         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
36897         int64_t ret_ref = 0;
36898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36900         return ret_ref;
36901 }
36902
36903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36904         LDKPeerManager this_obj_conv;
36905         this_obj_conv.inner = untag_ptr(this_obj);
36906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36908         PeerManager_free(this_obj_conv);
36909 }
36910
36911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
36912         LDKMessageHandler message_handler_conv;
36913         message_handler_conv.inner = untag_ptr(message_handler);
36914         message_handler_conv.is_owned = ptr_is_owned(message_handler);
36915         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
36916         // WARNING: we need a move here but no clone is available for LDKMessageHandler
36917         
36918         LDKSecretKey our_node_secret_ref;
36919         CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
36920         (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
36921         unsigned char ephemeral_random_data_arr[32];
36922         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
36923         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
36924         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
36925         void* logger_ptr = untag_ptr(logger);
36926         CHECK_ACCESS(logger_ptr);
36927         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36928         if (logger_conv.free == LDKLogger_JCalls_free) {
36929                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36930                 LDKLogger_JCalls_cloned(&logger_conv);
36931         }
36932         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
36933         CHECK_ACCESS(custom_message_handler_ptr);
36934         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
36935         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
36936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36937                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
36938         }
36939         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
36940         int64_t ret_ref = 0;
36941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36943         return ret_ref;
36944 }
36945
36946 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
36947         LDKPeerManager this_arg_conv;
36948         this_arg_conv.inner = untag_ptr(this_arg);
36949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36951         this_arg_conv.is_owned = false;
36952         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
36953         jobjectArray ret_arr = NULL;
36954         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
36955         ;
36956         for (size_t i = 0; i < ret_var.datalen; i++) {
36957                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
36958                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
36959                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
36960         }
36961         
36962         FREE(ret_var.data);
36963         return ret_arr;
36964 }
36965
36966 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) {
36967         LDKPeerManager this_arg_conv;
36968         this_arg_conv.inner = untag_ptr(this_arg);
36969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36971         this_arg_conv.is_owned = false;
36972         LDKPublicKey their_node_id_ref;
36973         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
36974         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
36975         void* descriptor_ptr = untag_ptr(descriptor);
36976         CHECK_ACCESS(descriptor_ptr);
36977         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36978         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36979                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36980                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36981         }
36982         void* remote_network_address_ptr = untag_ptr(remote_network_address);
36983         CHECK_ACCESS(remote_network_address_ptr);
36984         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36985         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
36986         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
36987         return tag_ptr(ret_conv, true);
36988 }
36989
36990 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) {
36991         LDKPeerManager this_arg_conv;
36992         this_arg_conv.inner = untag_ptr(this_arg);
36993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36995         this_arg_conv.is_owned = false;
36996         void* descriptor_ptr = untag_ptr(descriptor);
36997         CHECK_ACCESS(descriptor_ptr);
36998         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36999         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37001                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37002         }
37003         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37004         CHECK_ACCESS(remote_network_address_ptr);
37005         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37006         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37007         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37008         return tag_ptr(ret_conv, true);
37009 }
37010
37011 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) {
37012         LDKPeerManager this_arg_conv;
37013         this_arg_conv.inner = untag_ptr(this_arg);
37014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37016         this_arg_conv.is_owned = false;
37017         void* descriptor_ptr = untag_ptr(descriptor);
37018         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37019         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37020         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37021         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37022         return tag_ptr(ret_conv, true);
37023 }
37024
37025 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) {
37026         LDKPeerManager this_arg_conv;
37027         this_arg_conv.inner = untag_ptr(this_arg);
37028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37030         this_arg_conv.is_owned = false;
37031         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37032         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37033         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37034         LDKu8slice data_ref;
37035         data_ref.datalen = (*env)->GetArrayLength(env, data);
37036         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
37037         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37038         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37039         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
37040         return tag_ptr(ret_conv, true);
37041 }
37042
37043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
37044         LDKPeerManager this_arg_conv;
37045         this_arg_conv.inner = untag_ptr(this_arg);
37046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37048         this_arg_conv.is_owned = false;
37049         PeerManager_process_events(&this_arg_conv);
37050 }
37051
37052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
37053         LDKPeerManager this_arg_conv;
37054         this_arg_conv.inner = untag_ptr(this_arg);
37055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37057         this_arg_conv.is_owned = false;
37058         void* descriptor_ptr = untag_ptr(descriptor);
37059         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37060         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37061         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37062 }
37063
37064 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) {
37065         LDKPeerManager this_arg_conv;
37066         this_arg_conv.inner = untag_ptr(this_arg);
37067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37069         this_arg_conv.is_owned = false;
37070         LDKPublicKey node_id_ref;
37071         CHECK((*env)->GetArrayLength(env, node_id) == 33);
37072         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
37073         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
37074 }
37075
37076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
37077         LDKPeerManager this_arg_conv;
37078         this_arg_conv.inner = untag_ptr(this_arg);
37079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37081         this_arg_conv.is_owned = false;
37082         PeerManager_disconnect_all_peers(&this_arg_conv);
37083 }
37084
37085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
37086         LDKPeerManager this_arg_conv;
37087         this_arg_conv.inner = untag_ptr(this_arg);
37088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37090         this_arg_conv.is_owned = false;
37091         PeerManager_timer_tick_occurred(&this_arg_conv);
37092 }
37093
37094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37095         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37096         return ret_conv;
37097 }
37098
37099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37100         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37101         return ret_conv;
37102 }
37103
37104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
37105         unsigned char commitment_seed_arr[32];
37106         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
37107         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
37108         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
37109         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37110         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
37111         return ret_arr;
37112 }
37113
37114 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) {
37115         LDKCVec_u8Z to_holder_script_ref;
37116         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
37117         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37118         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
37119         LDKCVec_u8Z to_counterparty_script_ref;
37120         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
37121         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37122         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
37123         LDKOutPoint funding_outpoint_conv;
37124         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37125         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37126         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37127         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37128         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);
37129         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37130         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37131         Transaction_free(ret_var);
37132         return ret_arr;
37133 }
37134
37135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37136         LDKCounterpartyCommitmentSecrets this_obj_conv;
37137         this_obj_conv.inner = untag_ptr(this_obj);
37138         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37140         CounterpartyCommitmentSecrets_free(this_obj_conv);
37141 }
37142
37143 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37144         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37145         int64_t ret_ref = 0;
37146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37148         return ret_ref;
37149 }
37150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37151         LDKCounterpartyCommitmentSecrets arg_conv;
37152         arg_conv.inner = untag_ptr(arg);
37153         arg_conv.is_owned = ptr_is_owned(arg);
37154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37155         arg_conv.is_owned = false;
37156         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37157         return ret_conv;
37158 }
37159
37160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37161         LDKCounterpartyCommitmentSecrets orig_conv;
37162         orig_conv.inner = untag_ptr(orig);
37163         orig_conv.is_owned = ptr_is_owned(orig);
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37165         orig_conv.is_owned = false;
37166         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37167         int64_t ret_ref = 0;
37168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37170         return ret_ref;
37171 }
37172
37173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
37174         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37175         int64_t ret_ref = 0;
37176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37178         return ret_ref;
37179 }
37180
37181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
37182         LDKCounterpartyCommitmentSecrets this_arg_conv;
37183         this_arg_conv.inner = untag_ptr(this_arg);
37184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37186         this_arg_conv.is_owned = false;
37187         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37188         return ret_conv;
37189 }
37190
37191 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) {
37192         LDKCounterpartyCommitmentSecrets this_arg_conv;
37193         this_arg_conv.inner = untag_ptr(this_arg);
37194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37196         this_arg_conv.is_owned = false;
37197         LDKThirtyTwoBytes secret_ref;
37198         CHECK((*env)->GetArrayLength(env, secret) == 32);
37199         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
37200         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37201         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37202         return tag_ptr(ret_conv, true);
37203 }
37204
37205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
37206         LDKCounterpartyCommitmentSecrets this_arg_conv;
37207         this_arg_conv.inner = untag_ptr(this_arg);
37208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37210         this_arg_conv.is_owned = false;
37211         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37212         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
37213         return ret_arr;
37214 }
37215
37216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
37217         LDKCounterpartyCommitmentSecrets obj_conv;
37218         obj_conv.inner = untag_ptr(obj);
37219         obj_conv.is_owned = ptr_is_owned(obj);
37220         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37221         obj_conv.is_owned = false;
37222         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37223         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37224         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37225         CVec_u8Z_free(ret_var);
37226         return ret_arr;
37227 }
37228
37229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37230         LDKu8slice ser_ref;
37231         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37232         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37233         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37234         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37235         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37236         return tag_ptr(ret_conv, true);
37237 }
37238
37239 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) {
37240         LDKPublicKey per_commitment_point_ref;
37241         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37242         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37243         unsigned char base_secret_arr[32];
37244         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
37245         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
37246         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
37247         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37248         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
37249         return tag_ptr(ret_conv, true);
37250 }
37251
37252 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) {
37253         LDKPublicKey per_commitment_point_ref;
37254         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37255         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37256         LDKPublicKey base_point_ref;
37257         CHECK((*env)->GetArrayLength(env, base_point) == 33);
37258         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
37259         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37260         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
37261         return tag_ptr(ret_conv, true);
37262 }
37263
37264 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) {
37265         unsigned char per_commitment_secret_arr[32];
37266         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
37267         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
37268         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37269         unsigned char countersignatory_revocation_base_secret_arr[32];
37270         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
37271         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
37272         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37273         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37274         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
37275         return tag_ptr(ret_conv, true);
37276 }
37277
37278 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) {
37279         LDKPublicKey per_commitment_point_ref;
37280         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37281         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37282         LDKPublicKey countersignatory_revocation_base_point_ref;
37283         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
37284         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
37285         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37286         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
37287         return tag_ptr(ret_conv, true);
37288 }
37289
37290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37291         LDKTxCreationKeys this_obj_conv;
37292         this_obj_conv.inner = untag_ptr(this_obj);
37293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37295         TxCreationKeys_free(this_obj_conv);
37296 }
37297
37298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37299         LDKTxCreationKeys this_ptr_conv;
37300         this_ptr_conv.inner = untag_ptr(this_ptr);
37301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37303         this_ptr_conv.is_owned = false;
37304         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37305         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
37306         return ret_arr;
37307 }
37308
37309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37310         LDKTxCreationKeys this_ptr_conv;
37311         this_ptr_conv.inner = untag_ptr(this_ptr);
37312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37314         this_ptr_conv.is_owned = false;
37315         LDKPublicKey val_ref;
37316         CHECK((*env)->GetArrayLength(env, val) == 33);
37317         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37318         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37319 }
37320
37321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37322         LDKTxCreationKeys this_ptr_conv;
37323         this_ptr_conv.inner = untag_ptr(this_ptr);
37324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37326         this_ptr_conv.is_owned = false;
37327         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37328         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
37329         return ret_arr;
37330 }
37331
37332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37333         LDKTxCreationKeys this_ptr_conv;
37334         this_ptr_conv.inner = untag_ptr(this_ptr);
37335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37337         this_ptr_conv.is_owned = false;
37338         LDKPublicKey val_ref;
37339         CHECK((*env)->GetArrayLength(env, val) == 33);
37340         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37341         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37342 }
37343
37344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37345         LDKTxCreationKeys this_ptr_conv;
37346         this_ptr_conv.inner = untag_ptr(this_ptr);
37347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37349         this_ptr_conv.is_owned = false;
37350         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37351         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
37352         return ret_arr;
37353 }
37354
37355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37356         LDKTxCreationKeys this_ptr_conv;
37357         this_ptr_conv.inner = untag_ptr(this_ptr);
37358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37360         this_ptr_conv.is_owned = false;
37361         LDKPublicKey val_ref;
37362         CHECK((*env)->GetArrayLength(env, val) == 33);
37363         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37364         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
37365 }
37366
37367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37368         LDKTxCreationKeys this_ptr_conv;
37369         this_ptr_conv.inner = untag_ptr(this_ptr);
37370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37372         this_ptr_conv.is_owned = false;
37373         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37374         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
37375         return ret_arr;
37376 }
37377
37378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37379         LDKTxCreationKeys this_ptr_conv;
37380         this_ptr_conv.inner = untag_ptr(this_ptr);
37381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37383         this_ptr_conv.is_owned = false;
37384         LDKPublicKey val_ref;
37385         CHECK((*env)->GetArrayLength(env, val) == 33);
37386         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37387         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
37388 }
37389
37390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37391         LDKTxCreationKeys this_ptr_conv;
37392         this_ptr_conv.inner = untag_ptr(this_ptr);
37393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37395         this_ptr_conv.is_owned = false;
37396         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37397         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
37398         return ret_arr;
37399 }
37400
37401 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) {
37402         LDKTxCreationKeys this_ptr_conv;
37403         this_ptr_conv.inner = untag_ptr(this_ptr);
37404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37406         this_ptr_conv.is_owned = false;
37407         LDKPublicKey val_ref;
37408         CHECK((*env)->GetArrayLength(env, val) == 33);
37409         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37410         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
37411 }
37412
37413 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) {
37414         LDKPublicKey per_commitment_point_arg_ref;
37415         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
37416         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
37417         LDKPublicKey revocation_key_arg_ref;
37418         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
37419         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
37420         LDKPublicKey broadcaster_htlc_key_arg_ref;
37421         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
37422         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
37423         LDKPublicKey countersignatory_htlc_key_arg_ref;
37424         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
37425         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
37426         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
37427         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
37428         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
37429         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);
37430         int64_t ret_ref = 0;
37431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37433         return ret_ref;
37434 }
37435
37436 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
37437         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
37438         int64_t ret_ref = 0;
37439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37441         return ret_ref;
37442 }
37443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37444         LDKTxCreationKeys arg_conv;
37445         arg_conv.inner = untag_ptr(arg);
37446         arg_conv.is_owned = ptr_is_owned(arg);
37447         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37448         arg_conv.is_owned = false;
37449         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
37450         return ret_conv;
37451 }
37452
37453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37454         LDKTxCreationKeys orig_conv;
37455         orig_conv.inner = untag_ptr(orig);
37456         orig_conv.is_owned = ptr_is_owned(orig);
37457         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37458         orig_conv.is_owned = false;
37459         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
37460         int64_t ret_ref = 0;
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37463         return ret_ref;
37464 }
37465
37466 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37467         LDKTxCreationKeys obj_conv;
37468         obj_conv.inner = untag_ptr(obj);
37469         obj_conv.is_owned = ptr_is_owned(obj);
37470         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37471         obj_conv.is_owned = false;
37472         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
37473         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37474         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37475         CVec_u8Z_free(ret_var);
37476         return ret_arr;
37477 }
37478
37479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37480         LDKu8slice ser_ref;
37481         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37482         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37483         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37484         *ret_conv = TxCreationKeys_read(ser_ref);
37485         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37486         return tag_ptr(ret_conv, true);
37487 }
37488
37489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37490         LDKChannelPublicKeys this_obj_conv;
37491         this_obj_conv.inner = untag_ptr(this_obj);
37492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37494         ChannelPublicKeys_free(this_obj_conv);
37495 }
37496
37497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37498         LDKChannelPublicKeys this_ptr_conv;
37499         this_ptr_conv.inner = untag_ptr(this_ptr);
37500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37502         this_ptr_conv.is_owned = false;
37503         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37504         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
37505         return ret_arr;
37506 }
37507
37508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37509         LDKChannelPublicKeys this_ptr_conv;
37510         this_ptr_conv.inner = untag_ptr(this_ptr);
37511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37513         this_ptr_conv.is_owned = false;
37514         LDKPublicKey val_ref;
37515         CHECK((*env)->GetArrayLength(env, val) == 33);
37516         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37517         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37518 }
37519
37520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37521         LDKChannelPublicKeys this_ptr_conv;
37522         this_ptr_conv.inner = untag_ptr(this_ptr);
37523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37525         this_ptr_conv.is_owned = false;
37526         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37527         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
37528         return ret_arr;
37529 }
37530
37531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37532         LDKChannelPublicKeys this_ptr_conv;
37533         this_ptr_conv.inner = untag_ptr(this_ptr);
37534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37536         this_ptr_conv.is_owned = false;
37537         LDKPublicKey val_ref;
37538         CHECK((*env)->GetArrayLength(env, val) == 33);
37539         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37540         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37541 }
37542
37543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37544         LDKChannelPublicKeys this_ptr_conv;
37545         this_ptr_conv.inner = untag_ptr(this_ptr);
37546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37548         this_ptr_conv.is_owned = false;
37549         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37550         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
37551         return ret_arr;
37552 }
37553
37554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37555         LDKChannelPublicKeys this_ptr_conv;
37556         this_ptr_conv.inner = untag_ptr(this_ptr);
37557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37559         this_ptr_conv.is_owned = false;
37560         LDKPublicKey val_ref;
37561         CHECK((*env)->GetArrayLength(env, val) == 33);
37562         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37563         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37564 }
37565
37566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37567         LDKChannelPublicKeys this_ptr_conv;
37568         this_ptr_conv.inner = untag_ptr(this_ptr);
37569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37571         this_ptr_conv.is_owned = false;
37572         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37573         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
37574         return ret_arr;
37575 }
37576
37577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37578         LDKChannelPublicKeys this_ptr_conv;
37579         this_ptr_conv.inner = untag_ptr(this_ptr);
37580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37582         this_ptr_conv.is_owned = false;
37583         LDKPublicKey val_ref;
37584         CHECK((*env)->GetArrayLength(env, val) == 33);
37585         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37586         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37587 }
37588
37589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37590         LDKChannelPublicKeys this_ptr_conv;
37591         this_ptr_conv.inner = untag_ptr(this_ptr);
37592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37594         this_ptr_conv.is_owned = false;
37595         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37596         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
37597         return ret_arr;
37598 }
37599
37600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37601         LDKChannelPublicKeys this_ptr_conv;
37602         this_ptr_conv.inner = untag_ptr(this_ptr);
37603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37605         this_ptr_conv.is_owned = false;
37606         LDKPublicKey val_ref;
37607         CHECK((*env)->GetArrayLength(env, val) == 33);
37608         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37609         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
37610 }
37611
37612 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) {
37613         LDKPublicKey funding_pubkey_arg_ref;
37614         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
37615         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
37616         LDKPublicKey revocation_basepoint_arg_ref;
37617         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
37618         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
37619         LDKPublicKey payment_point_arg_ref;
37620         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
37621         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
37622         LDKPublicKey delayed_payment_basepoint_arg_ref;
37623         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
37624         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
37625         LDKPublicKey htlc_basepoint_arg_ref;
37626         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
37627         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
37628         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);
37629         int64_t ret_ref = 0;
37630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37632         return ret_ref;
37633 }
37634
37635 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
37636         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
37637         int64_t ret_ref = 0;
37638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37640         return ret_ref;
37641 }
37642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37643         LDKChannelPublicKeys arg_conv;
37644         arg_conv.inner = untag_ptr(arg);
37645         arg_conv.is_owned = ptr_is_owned(arg);
37646         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37647         arg_conv.is_owned = false;
37648         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
37649         return ret_conv;
37650 }
37651
37652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37653         LDKChannelPublicKeys orig_conv;
37654         orig_conv.inner = untag_ptr(orig);
37655         orig_conv.is_owned = ptr_is_owned(orig);
37656         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37657         orig_conv.is_owned = false;
37658         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
37659         int64_t ret_ref = 0;
37660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37662         return ret_ref;
37663 }
37664
37665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37666         LDKChannelPublicKeys obj_conv;
37667         obj_conv.inner = untag_ptr(obj);
37668         obj_conv.is_owned = ptr_is_owned(obj);
37669         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37670         obj_conv.is_owned = false;
37671         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
37672         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37673         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37674         CVec_u8Z_free(ret_var);
37675         return ret_arr;
37676 }
37677
37678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37679         LDKu8slice ser_ref;
37680         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37681         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37682         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37683         *ret_conv = ChannelPublicKeys_read(ser_ref);
37684         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37685         return tag_ptr(ret_conv, true);
37686 }
37687
37688 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) {
37689         LDKPublicKey per_commitment_point_ref;
37690         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37691         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37692         LDKPublicKey broadcaster_delayed_payment_base_ref;
37693         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
37694         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
37695         LDKPublicKey broadcaster_htlc_base_ref;
37696         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
37697         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
37698         LDKPublicKey countersignatory_revocation_base_ref;
37699         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
37700         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
37701         LDKPublicKey countersignatory_htlc_base_ref;
37702         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
37703         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
37704         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37705         *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);
37706         return tag_ptr(ret_conv, true);
37707 }
37708
37709 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) {
37710         LDKPublicKey per_commitment_point_ref;
37711         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37712         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37713         LDKChannelPublicKeys broadcaster_keys_conv;
37714         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
37715         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
37716         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37717         broadcaster_keys_conv.is_owned = false;
37718         LDKChannelPublicKeys countersignatory_keys_conv;
37719         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
37720         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
37721         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37722         countersignatory_keys_conv.is_owned = false;
37723         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37724         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
37725         return tag_ptr(ret_conv, true);
37726 }
37727
37728 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) {
37729         LDKPublicKey revocation_key_ref;
37730         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37731         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37732         LDKPublicKey broadcaster_delayed_payment_key_ref;
37733         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37734         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37735         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
37736         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37737         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37738         CVec_u8Z_free(ret_var);
37739         return ret_arr;
37740 }
37741
37742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37743         LDKHTLCOutputInCommitment this_obj_conv;
37744         this_obj_conv.inner = untag_ptr(this_obj);
37745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37747         HTLCOutputInCommitment_free(this_obj_conv);
37748 }
37749
37750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
37751         LDKHTLCOutputInCommitment this_ptr_conv;
37752         this_ptr_conv.inner = untag_ptr(this_ptr);
37753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37755         this_ptr_conv.is_owned = false;
37756         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
37757         return ret_conv;
37758 }
37759
37760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37761         LDKHTLCOutputInCommitment this_ptr_conv;
37762         this_ptr_conv.inner = untag_ptr(this_ptr);
37763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37765         this_ptr_conv.is_owned = false;
37766         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
37767 }
37768
37769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37770         LDKHTLCOutputInCommitment this_ptr_conv;
37771         this_ptr_conv.inner = untag_ptr(this_ptr);
37772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37774         this_ptr_conv.is_owned = false;
37775         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
37776         return ret_conv;
37777 }
37778
37779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37780         LDKHTLCOutputInCommitment this_ptr_conv;
37781         this_ptr_conv.inner = untag_ptr(this_ptr);
37782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37784         this_ptr_conv.is_owned = false;
37785         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
37786 }
37787
37788 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
37789         LDKHTLCOutputInCommitment this_ptr_conv;
37790         this_ptr_conv.inner = untag_ptr(this_ptr);
37791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37793         this_ptr_conv.is_owned = false;
37794         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
37795         return ret_conv;
37796 }
37797
37798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37799         LDKHTLCOutputInCommitment this_ptr_conv;
37800         this_ptr_conv.inner = untag_ptr(this_ptr);
37801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37803         this_ptr_conv.is_owned = false;
37804         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
37805 }
37806
37807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
37808         LDKHTLCOutputInCommitment this_ptr_conv;
37809         this_ptr_conv.inner = untag_ptr(this_ptr);
37810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37812         this_ptr_conv.is_owned = false;
37813         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37814         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
37815         return ret_arr;
37816 }
37817
37818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37819         LDKHTLCOutputInCommitment this_ptr_conv;
37820         this_ptr_conv.inner = untag_ptr(this_ptr);
37821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37823         this_ptr_conv.is_owned = false;
37824         LDKThirtyTwoBytes val_ref;
37825         CHECK((*env)->GetArrayLength(env, val) == 32);
37826         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37827         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
37828 }
37829
37830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
37831         LDKHTLCOutputInCommitment this_ptr_conv;
37832         this_ptr_conv.inner = untag_ptr(this_ptr);
37833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37835         this_ptr_conv.is_owned = false;
37836         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37837         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
37838         int64_t ret_ref = tag_ptr(ret_copy, true);
37839         return ret_ref;
37840 }
37841
37842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37843         LDKHTLCOutputInCommitment this_ptr_conv;
37844         this_ptr_conv.inner = untag_ptr(this_ptr);
37845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37847         this_ptr_conv.is_owned = false;
37848         void* val_ptr = untag_ptr(val);
37849         CHECK_ACCESS(val_ptr);
37850         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37851         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37852         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
37853 }
37854
37855 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) {
37856         LDKThirtyTwoBytes payment_hash_arg_ref;
37857         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
37858         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
37859         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
37860         CHECK_ACCESS(transaction_output_index_arg_ptr);
37861         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
37862         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
37863         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
37864         int64_t ret_ref = 0;
37865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37867         return ret_ref;
37868 }
37869
37870 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
37871         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
37872         int64_t ret_ref = 0;
37873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37875         return ret_ref;
37876 }
37877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37878         LDKHTLCOutputInCommitment arg_conv;
37879         arg_conv.inner = untag_ptr(arg);
37880         arg_conv.is_owned = ptr_is_owned(arg);
37881         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37882         arg_conv.is_owned = false;
37883         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
37884         return ret_conv;
37885 }
37886
37887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37888         LDKHTLCOutputInCommitment orig_conv;
37889         orig_conv.inner = untag_ptr(orig);
37890         orig_conv.is_owned = ptr_is_owned(orig);
37891         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37892         orig_conv.is_owned = false;
37893         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
37894         int64_t ret_ref = 0;
37895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37897         return ret_ref;
37898 }
37899
37900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
37901         LDKHTLCOutputInCommitment obj_conv;
37902         obj_conv.inner = untag_ptr(obj);
37903         obj_conv.is_owned = ptr_is_owned(obj);
37904         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37905         obj_conv.is_owned = false;
37906         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
37907         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37908         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37909         CVec_u8Z_free(ret_var);
37910         return ret_arr;
37911 }
37912
37913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37914         LDKu8slice ser_ref;
37915         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37916         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37917         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37918         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
37919         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37920         return tag_ptr(ret_conv, true);
37921 }
37922
37923 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) {
37924         LDKHTLCOutputInCommitment htlc_conv;
37925         htlc_conv.inner = untag_ptr(htlc);
37926         htlc_conv.is_owned = ptr_is_owned(htlc);
37927         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37928         htlc_conv.is_owned = false;
37929         LDKTxCreationKeys keys_conv;
37930         keys_conv.inner = untag_ptr(keys);
37931         keys_conv.is_owned = ptr_is_owned(keys);
37932         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
37933         keys_conv.is_owned = false;
37934         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
37935         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37936         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37937         CVec_u8Z_free(ret_var);
37938         return ret_arr;
37939 }
37940
37941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
37942         LDKPublicKey broadcaster_ref;
37943         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
37944         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
37945         LDKPublicKey countersignatory_ref;
37946         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
37947         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
37948         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
37949         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37950         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37951         CVec_u8Z_free(ret_var);
37952         return ret_arr;
37953 }
37954
37955 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) {
37956         unsigned char commitment_txid_arr[32];
37957         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
37958         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
37959         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
37960         LDKHTLCOutputInCommitment htlc_conv;
37961         htlc_conv.inner = untag_ptr(htlc);
37962         htlc_conv.is_owned = ptr_is_owned(htlc);
37963         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37964         htlc_conv.is_owned = false;
37965         LDKPublicKey broadcaster_delayed_payment_key_ref;
37966         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37967         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37968         LDKPublicKey revocation_key_ref;
37969         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37970         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37971         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);
37972         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37973         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37974         Transaction_free(ret_var);
37975         return ret_arr;
37976 }
37977
37978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
37979         LDKPublicKey funding_pubkey_ref;
37980         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
37981         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
37982         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
37983         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37984         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37985         CVec_u8Z_free(ret_var);
37986         return ret_arr;
37987 }
37988
37989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37990         LDKChannelTransactionParameters this_obj_conv;
37991         this_obj_conv.inner = untag_ptr(this_obj);
37992         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37994         ChannelTransactionParameters_free(this_obj_conv);
37995 }
37996
37997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
37998         LDKChannelTransactionParameters this_ptr_conv;
37999         this_ptr_conv.inner = untag_ptr(this_ptr);
38000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38002         this_ptr_conv.is_owned = false;
38003         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38004         int64_t ret_ref = 0;
38005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38007         return ret_ref;
38008 }
38009
38010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38011         LDKChannelTransactionParameters this_ptr_conv;
38012         this_ptr_conv.inner = untag_ptr(this_ptr);
38013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38015         this_ptr_conv.is_owned = false;
38016         LDKChannelPublicKeys val_conv;
38017         val_conv.inner = untag_ptr(val);
38018         val_conv.is_owned = ptr_is_owned(val);
38019         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38020         val_conv = ChannelPublicKeys_clone(&val_conv);
38021         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38022 }
38023
38024 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38025         LDKChannelTransactionParameters this_ptr_conv;
38026         this_ptr_conv.inner = untag_ptr(this_ptr);
38027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38029         this_ptr_conv.is_owned = false;
38030         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38031         return ret_conv;
38032 }
38033
38034 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) {
38035         LDKChannelTransactionParameters this_ptr_conv;
38036         this_ptr_conv.inner = untag_ptr(this_ptr);
38037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38039         this_ptr_conv.is_owned = false;
38040         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38041 }
38042
38043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
38044         LDKChannelTransactionParameters this_ptr_conv;
38045         this_ptr_conv.inner = untag_ptr(this_ptr);
38046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38048         this_ptr_conv.is_owned = false;
38049         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38050         return ret_conv;
38051 }
38052
38053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38054         LDKChannelTransactionParameters this_ptr_conv;
38055         this_ptr_conv.inner = untag_ptr(this_ptr);
38056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38058         this_ptr_conv.is_owned = false;
38059         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38060 }
38061
38062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
38063         LDKChannelTransactionParameters this_ptr_conv;
38064         this_ptr_conv.inner = untag_ptr(this_ptr);
38065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38067         this_ptr_conv.is_owned = false;
38068         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38069         int64_t ret_ref = 0;
38070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38072         return ret_ref;
38073 }
38074
38075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38076         LDKChannelTransactionParameters this_ptr_conv;
38077         this_ptr_conv.inner = untag_ptr(this_ptr);
38078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38080         this_ptr_conv.is_owned = false;
38081         LDKCounterpartyChannelTransactionParameters val_conv;
38082         val_conv.inner = untag_ptr(val);
38083         val_conv.is_owned = ptr_is_owned(val);
38084         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38085         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38086         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38087 }
38088
38089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38090         LDKChannelTransactionParameters this_ptr_conv;
38091         this_ptr_conv.inner = untag_ptr(this_ptr);
38092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38094         this_ptr_conv.is_owned = false;
38095         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38096         int64_t ret_ref = 0;
38097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38099         return ret_ref;
38100 }
38101
38102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38103         LDKChannelTransactionParameters this_ptr_conv;
38104         this_ptr_conv.inner = untag_ptr(this_ptr);
38105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38107         this_ptr_conv.is_owned = false;
38108         LDKOutPoint val_conv;
38109         val_conv.inner = untag_ptr(val);
38110         val_conv.is_owned = ptr_is_owned(val);
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38112         val_conv = OutPoint_clone(&val_conv);
38113         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38114 }
38115
38116 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
38117         LDKChannelTransactionParameters this_ptr_conv;
38118         this_ptr_conv.inner = untag_ptr(this_ptr);
38119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38121         this_ptr_conv.is_owned = false;
38122         jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38123         return ret_conv;
38124 }
38125
38126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38127         LDKChannelTransactionParameters this_ptr_conv;
38128         this_ptr_conv.inner = untag_ptr(this_ptr);
38129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38131         this_ptr_conv.is_owned = false;
38132         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
38133         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38134 }
38135
38136 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) {
38137         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38138         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38139         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38140         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38141         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38142         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38143         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38144         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38145         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38146         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38147         LDKOutPoint funding_outpoint_arg_conv;
38148         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38149         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38150         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38151         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38152         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
38153         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);
38154         int64_t ret_ref = 0;
38155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38157         return ret_ref;
38158 }
38159
38160 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38161         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38162         int64_t ret_ref = 0;
38163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38165         return ret_ref;
38166 }
38167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38168         LDKChannelTransactionParameters arg_conv;
38169         arg_conv.inner = untag_ptr(arg);
38170         arg_conv.is_owned = ptr_is_owned(arg);
38171         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38172         arg_conv.is_owned = false;
38173         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38174         return ret_conv;
38175 }
38176
38177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38178         LDKChannelTransactionParameters orig_conv;
38179         orig_conv.inner = untag_ptr(orig);
38180         orig_conv.is_owned = ptr_is_owned(orig);
38181         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38182         orig_conv.is_owned = false;
38183         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38184         int64_t ret_ref = 0;
38185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38187         return ret_ref;
38188 }
38189
38190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38191         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38192         this_obj_conv.inner = untag_ptr(this_obj);
38193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38195         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38196 }
38197
38198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38199         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38200         this_ptr_conv.inner = untag_ptr(this_ptr);
38201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38203         this_ptr_conv.is_owned = false;
38204         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38205         int64_t ret_ref = 0;
38206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38208         return ret_ref;
38209 }
38210
38211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38212         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38213         this_ptr_conv.inner = untag_ptr(this_ptr);
38214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38216         this_ptr_conv.is_owned = false;
38217         LDKChannelPublicKeys val_conv;
38218         val_conv.inner = untag_ptr(val);
38219         val_conv.is_owned = ptr_is_owned(val);
38220         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38221         val_conv = ChannelPublicKeys_clone(&val_conv);
38222         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
38223 }
38224
38225 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38226         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38227         this_ptr_conv.inner = untag_ptr(this_ptr);
38228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38230         this_ptr_conv.is_owned = false;
38231         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
38232         return ret_conv;
38233 }
38234
38235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38236         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38237         this_ptr_conv.inner = untag_ptr(this_ptr);
38238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38240         this_ptr_conv.is_owned = false;
38241         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
38242 }
38243
38244 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) {
38245         LDKChannelPublicKeys pubkeys_arg_conv;
38246         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
38247         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
38248         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
38249         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
38250         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
38251         int64_t ret_ref = 0;
38252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38254         return ret_ref;
38255 }
38256
38257 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
38258         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
38259         int64_t ret_ref = 0;
38260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38262         return ret_ref;
38263 }
38264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38265         LDKCounterpartyChannelTransactionParameters arg_conv;
38266         arg_conv.inner = untag_ptr(arg);
38267         arg_conv.is_owned = ptr_is_owned(arg);
38268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38269         arg_conv.is_owned = false;
38270         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
38271         return ret_conv;
38272 }
38273
38274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38275         LDKCounterpartyChannelTransactionParameters orig_conv;
38276         orig_conv.inner = untag_ptr(orig);
38277         orig_conv.is_owned = ptr_is_owned(orig);
38278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38279         orig_conv.is_owned = false;
38280         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
38281         int64_t ret_ref = 0;
38282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38284         return ret_ref;
38285 }
38286
38287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
38288         LDKChannelTransactionParameters this_arg_conv;
38289         this_arg_conv.inner = untag_ptr(this_arg);
38290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38292         this_arg_conv.is_owned = false;
38293         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
38294         return ret_conv;
38295 }
38296
38297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38298         LDKChannelTransactionParameters this_arg_conv;
38299         this_arg_conv.inner = untag_ptr(this_arg);
38300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38302         this_arg_conv.is_owned = false;
38303         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
38304         int64_t ret_ref = 0;
38305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38307         return ret_ref;
38308 }
38309
38310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38311         LDKChannelTransactionParameters this_arg_conv;
38312         this_arg_conv.inner = untag_ptr(this_arg);
38313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38315         this_arg_conv.is_owned = false;
38316         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
38317         int64_t ret_ref = 0;
38318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38320         return ret_ref;
38321 }
38322
38323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38324         LDKCounterpartyChannelTransactionParameters obj_conv;
38325         obj_conv.inner = untag_ptr(obj);
38326         obj_conv.is_owned = ptr_is_owned(obj);
38327         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38328         obj_conv.is_owned = false;
38329         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
38330         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38331         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38332         CVec_u8Z_free(ret_var);
38333         return ret_arr;
38334 }
38335
38336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38337         LDKu8slice ser_ref;
38338         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38339         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38340         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
38341         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
38342         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38343         return tag_ptr(ret_conv, true);
38344 }
38345
38346 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38347         LDKChannelTransactionParameters obj_conv;
38348         obj_conv.inner = untag_ptr(obj);
38349         obj_conv.is_owned = ptr_is_owned(obj);
38350         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38351         obj_conv.is_owned = false;
38352         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
38353         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38354         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38355         CVec_u8Z_free(ret_var);
38356         return ret_arr;
38357 }
38358
38359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38360         LDKu8slice ser_ref;
38361         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38362         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38363         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
38364         *ret_conv = ChannelTransactionParameters_read(ser_ref);
38365         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38366         return tag_ptr(ret_conv, true);
38367 }
38368
38369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38370         LDKDirectedChannelTransactionParameters this_obj_conv;
38371         this_obj_conv.inner = untag_ptr(this_obj);
38372         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38374         DirectedChannelTransactionParameters_free(this_obj_conv);
38375 }
38376
38377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38378         LDKDirectedChannelTransactionParameters this_arg_conv;
38379         this_arg_conv.inner = untag_ptr(this_arg);
38380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38382         this_arg_conv.is_owned = false;
38383         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
38384         int64_t ret_ref = 0;
38385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38387         return ret_ref;
38388 }
38389
38390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38391         LDKDirectedChannelTransactionParameters this_arg_conv;
38392         this_arg_conv.inner = untag_ptr(this_arg);
38393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38395         this_arg_conv.is_owned = false;
38396         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
38397         int64_t ret_ref = 0;
38398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38400         return ret_ref;
38401 }
38402
38403 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
38404         LDKDirectedChannelTransactionParameters this_arg_conv;
38405         this_arg_conv.inner = untag_ptr(this_arg);
38406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38408         this_arg_conv.is_owned = false;
38409         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
38410         return ret_conv;
38411 }
38412
38413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
38414         LDKDirectedChannelTransactionParameters this_arg_conv;
38415         this_arg_conv.inner = untag_ptr(this_arg);
38416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38418         this_arg_conv.is_owned = false;
38419         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
38420         return ret_conv;
38421 }
38422
38423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
38424         LDKDirectedChannelTransactionParameters this_arg_conv;
38425         this_arg_conv.inner = untag_ptr(this_arg);
38426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38428         this_arg_conv.is_owned = false;
38429         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
38430         int64_t ret_ref = 0;
38431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38433         return ret_ref;
38434 }
38435
38436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38437         LDKDirectedChannelTransactionParameters this_arg_conv;
38438         this_arg_conv.inner = untag_ptr(this_arg);
38439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38441         this_arg_conv.is_owned = false;
38442         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
38443         return ret_conv;
38444 }
38445
38446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38447         LDKHolderCommitmentTransaction this_obj_conv;
38448         this_obj_conv.inner = untag_ptr(this_obj);
38449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38451         HolderCommitmentTransaction_free(this_obj_conv);
38452 }
38453
38454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
38455         LDKHolderCommitmentTransaction this_ptr_conv;
38456         this_ptr_conv.inner = untag_ptr(this_ptr);
38457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38459         this_ptr_conv.is_owned = false;
38460         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38461         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
38462         return ret_arr;
38463 }
38464
38465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38466         LDKHolderCommitmentTransaction this_ptr_conv;
38467         this_ptr_conv.inner = untag_ptr(this_ptr);
38468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38470         this_ptr_conv.is_owned = false;
38471         LDKSignature val_ref;
38472         CHECK((*env)->GetArrayLength(env, val) == 64);
38473         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38474         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38475 }
38476
38477 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
38478         LDKHolderCommitmentTransaction this_ptr_conv;
38479         this_ptr_conv.inner = untag_ptr(this_ptr);
38480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38482         this_ptr_conv.is_owned = false;
38483         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
38484         jobjectArray ret_arr = NULL;
38485         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38486         ;
38487         for (size_t i = 0; i < ret_var.datalen; i++) {
38488                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
38489                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
38490                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38491         }
38492         
38493         FREE(ret_var.data);
38494         return ret_arr;
38495 }
38496
38497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
38498         LDKHolderCommitmentTransaction this_ptr_conv;
38499         this_ptr_conv.inner = untag_ptr(this_ptr);
38500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38502         this_ptr_conv.is_owned = false;
38503         LDKCVec_SignatureZ val_constr;
38504         val_constr.datalen = (*env)->GetArrayLength(env, val);
38505         if (val_constr.datalen > 0)
38506                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38507         else
38508                 val_constr.data = NULL;
38509         for (size_t i = 0; i < val_constr.datalen; i++) {
38510                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
38511                 LDKSignature val_conv_8_ref;
38512                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
38513                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
38514                 val_constr.data[i] = val_conv_8_ref;
38515         }
38516         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38517 }
38518
38519 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38520         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38521         int64_t ret_ref = 0;
38522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38524         return ret_ref;
38525 }
38526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38527         LDKHolderCommitmentTransaction arg_conv;
38528         arg_conv.inner = untag_ptr(arg);
38529         arg_conv.is_owned = ptr_is_owned(arg);
38530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38531         arg_conv.is_owned = false;
38532         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38533         return ret_conv;
38534 }
38535
38536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38537         LDKHolderCommitmentTransaction orig_conv;
38538         orig_conv.inner = untag_ptr(orig);
38539         orig_conv.is_owned = ptr_is_owned(orig);
38540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38541         orig_conv.is_owned = false;
38542         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38543         int64_t ret_ref = 0;
38544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38546         return ret_ref;
38547 }
38548
38549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38550         LDKHolderCommitmentTransaction obj_conv;
38551         obj_conv.inner = untag_ptr(obj);
38552         obj_conv.is_owned = ptr_is_owned(obj);
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38554         obj_conv.is_owned = false;
38555         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
38556         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38557         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38558         CVec_u8Z_free(ret_var);
38559         return ret_arr;
38560 }
38561
38562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38563         LDKu8slice ser_ref;
38564         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38565         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38566         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
38567         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
38568         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38569         return tag_ptr(ret_conv, true);
38570 }
38571
38572 JNIEXPORT 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) {
38573         LDKCommitmentTransaction commitment_tx_conv;
38574         commitment_tx_conv.inner = untag_ptr(commitment_tx);
38575         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
38577         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
38578         LDKSignature counterparty_sig_ref;
38579         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
38580         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
38581         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
38582         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
38583         if (counterparty_htlc_sigs_constr.datalen > 0)
38584                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38585         else
38586                 counterparty_htlc_sigs_constr.data = NULL;
38587         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
38588                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
38589                 LDKSignature counterparty_htlc_sigs_conv_8_ref;
38590                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
38591                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
38592                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
38593         }
38594         LDKPublicKey holder_funding_key_ref;
38595         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
38596         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
38597         LDKPublicKey counterparty_funding_key_ref;
38598         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
38599         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
38600         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
38601         int64_t ret_ref = 0;
38602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38604         return ret_ref;
38605 }
38606
38607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38608         LDKBuiltCommitmentTransaction this_obj_conv;
38609         this_obj_conv.inner = untag_ptr(this_obj);
38610         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38612         BuiltCommitmentTransaction_free(this_obj_conv);
38613 }
38614
38615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
38616         LDKBuiltCommitmentTransaction this_ptr_conv;
38617         this_ptr_conv.inner = untag_ptr(this_ptr);
38618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38620         this_ptr_conv.is_owned = false;
38621         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
38622         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38623         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38624         Transaction_free(ret_var);
38625         return ret_arr;
38626 }
38627
38628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38629         LDKBuiltCommitmentTransaction this_ptr_conv;
38630         this_ptr_conv.inner = untag_ptr(this_ptr);
38631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38633         this_ptr_conv.is_owned = false;
38634         LDKTransaction val_ref;
38635         val_ref.datalen = (*env)->GetArrayLength(env, val);
38636         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
38637         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
38638         val_ref.data_is_owned = true;
38639         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
38640 }
38641
38642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38643         LDKBuiltCommitmentTransaction this_ptr_conv;
38644         this_ptr_conv.inner = untag_ptr(this_ptr);
38645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38647         this_ptr_conv.is_owned = false;
38648         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38649         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
38650         return ret_arr;
38651 }
38652
38653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38654         LDKBuiltCommitmentTransaction this_ptr_conv;
38655         this_ptr_conv.inner = untag_ptr(this_ptr);
38656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38658         this_ptr_conv.is_owned = false;
38659         LDKThirtyTwoBytes val_ref;
38660         CHECK((*env)->GetArrayLength(env, val) == 32);
38661         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38662         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
38663 }
38664
38665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
38666         LDKTransaction transaction_arg_ref;
38667         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
38668         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
38669         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
38670         transaction_arg_ref.data_is_owned = true;
38671         LDKThirtyTwoBytes txid_arg_ref;
38672         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38673         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38674         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
38675         int64_t ret_ref = 0;
38676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38678         return ret_ref;
38679 }
38680
38681 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
38682         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
38683         int64_t ret_ref = 0;
38684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38686         return ret_ref;
38687 }
38688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38689         LDKBuiltCommitmentTransaction arg_conv;
38690         arg_conv.inner = untag_ptr(arg);
38691         arg_conv.is_owned = ptr_is_owned(arg);
38692         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38693         arg_conv.is_owned = false;
38694         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
38695         return ret_conv;
38696 }
38697
38698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38699         LDKBuiltCommitmentTransaction orig_conv;
38700         orig_conv.inner = untag_ptr(orig);
38701         orig_conv.is_owned = ptr_is_owned(orig);
38702         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38703         orig_conv.is_owned = false;
38704         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
38705         int64_t ret_ref = 0;
38706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38708         return ret_ref;
38709 }
38710
38711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38712         LDKBuiltCommitmentTransaction obj_conv;
38713         obj_conv.inner = untag_ptr(obj);
38714         obj_conv.is_owned = ptr_is_owned(obj);
38715         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38716         obj_conv.is_owned = false;
38717         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
38718         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38719         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38720         CVec_u8Z_free(ret_var);
38721         return ret_arr;
38722 }
38723
38724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38725         LDKu8slice ser_ref;
38726         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38727         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38728         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
38729         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
38730         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38731         return tag_ptr(ret_conv, true);
38732 }
38733
38734 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) {
38735         LDKBuiltCommitmentTransaction this_arg_conv;
38736         this_arg_conv.inner = untag_ptr(this_arg);
38737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38739         this_arg_conv.is_owned = false;
38740         LDKu8slice funding_redeemscript_ref;
38741         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38742         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38743         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38744         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38745         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38746         return ret_arr;
38747 }
38748
38749 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) {
38750         LDKBuiltCommitmentTransaction this_arg_conv;
38751         this_arg_conv.inner = untag_ptr(this_arg);
38752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38754         this_arg_conv.is_owned = false;
38755         unsigned char funding_key_arr[32];
38756         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38757         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38758         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38759         LDKu8slice funding_redeemscript_ref;
38760         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38761         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38762         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38763         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38764         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38765         return ret_arr;
38766 }
38767
38768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38769         LDKClosingTransaction this_obj_conv;
38770         this_obj_conv.inner = untag_ptr(this_obj);
38771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38773         ClosingTransaction_free(this_obj_conv);
38774 }
38775
38776 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
38777         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
38778         int64_t ret_ref = 0;
38779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38781         return ret_ref;
38782 }
38783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38784         LDKClosingTransaction arg_conv;
38785         arg_conv.inner = untag_ptr(arg);
38786         arg_conv.is_owned = ptr_is_owned(arg);
38787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38788         arg_conv.is_owned = false;
38789         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
38790         return ret_conv;
38791 }
38792
38793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38794         LDKClosingTransaction orig_conv;
38795         orig_conv.inner = untag_ptr(orig);
38796         orig_conv.is_owned = ptr_is_owned(orig);
38797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38798         orig_conv.is_owned = false;
38799         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
38800         int64_t ret_ref = 0;
38801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38803         return ret_ref;
38804 }
38805
38806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
38807         LDKClosingTransaction o_conv;
38808         o_conv.inner = untag_ptr(o);
38809         o_conv.is_owned = ptr_is_owned(o);
38810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38811         o_conv.is_owned = false;
38812         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
38813         return ret_conv;
38814 }
38815
38816 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) {
38817         LDKCVec_u8Z to_holder_script_ref;
38818         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
38819         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
38820         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
38821         LDKCVec_u8Z to_counterparty_script_ref;
38822         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
38823         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
38824         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
38825         LDKOutPoint funding_outpoint_conv;
38826         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
38827         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
38828         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38829         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38830         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
38831         int64_t ret_ref = 0;
38832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38834         return ret_ref;
38835 }
38836
38837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
38838         LDKClosingTransaction this_arg_conv;
38839         this_arg_conv.inner = untag_ptr(this_arg);
38840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38842         this_arg_conv.is_owned = false;
38843         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
38844         int64_t ret_ref = 0;
38845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38847         return ret_ref;
38848 }
38849
38850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
38851         LDKClosingTransaction this_arg_conv;
38852         this_arg_conv.inner = untag_ptr(this_arg);
38853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38855         this_arg_conv.is_owned = false;
38856         LDKOutPoint funding_outpoint_conv;
38857         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
38858         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
38859         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38860         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38861         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
38862         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
38863         return tag_ptr(ret_conv, true);
38864 }
38865
38866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38867         LDKClosingTransaction this_arg_conv;
38868         this_arg_conv.inner = untag_ptr(this_arg);
38869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38871         this_arg_conv.is_owned = false;
38872         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
38873         return ret_conv;
38874 }
38875
38876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38877         LDKClosingTransaction this_arg_conv;
38878         this_arg_conv.inner = untag_ptr(this_arg);
38879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38881         this_arg_conv.is_owned = false;
38882         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
38883         return ret_conv;
38884 }
38885
38886 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
38887         LDKClosingTransaction this_arg_conv;
38888         this_arg_conv.inner = untag_ptr(this_arg);
38889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38891         this_arg_conv.is_owned = false;
38892         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
38893         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38894         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38895         return ret_arr;
38896 }
38897
38898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
38899         LDKClosingTransaction this_arg_conv;
38900         this_arg_conv.inner = untag_ptr(this_arg);
38901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38903         this_arg_conv.is_owned = false;
38904         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
38905         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38906         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38907         return ret_arr;
38908 }
38909
38910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38911         LDKTrustedClosingTransaction this_obj_conv;
38912         this_obj_conv.inner = untag_ptr(this_obj);
38913         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38915         TrustedClosingTransaction_free(this_obj_conv);
38916 }
38917
38918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
38919         LDKTrustedClosingTransaction this_arg_conv;
38920         this_arg_conv.inner = untag_ptr(this_arg);
38921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38923         this_arg_conv.is_owned = false;
38924         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
38925         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38926         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38927         Transaction_free(ret_var);
38928         return ret_arr;
38929 }
38930
38931 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) {
38932         LDKTrustedClosingTransaction this_arg_conv;
38933         this_arg_conv.inner = untag_ptr(this_arg);
38934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38936         this_arg_conv.is_owned = false;
38937         LDKu8slice funding_redeemscript_ref;
38938         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38939         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38940         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38941         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38942         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38943         return ret_arr;
38944 }
38945
38946 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) {
38947         LDKTrustedClosingTransaction this_arg_conv;
38948         this_arg_conv.inner = untag_ptr(this_arg);
38949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38951         this_arg_conv.is_owned = false;
38952         unsigned char funding_key_arr[32];
38953         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38954         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38955         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38956         LDKu8slice funding_redeemscript_ref;
38957         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38958         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38959         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38960         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38961         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38962         return ret_arr;
38963 }
38964
38965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38966         LDKCommitmentTransaction this_obj_conv;
38967         this_obj_conv.inner = untag_ptr(this_obj);
38968         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38970         CommitmentTransaction_free(this_obj_conv);
38971 }
38972
38973 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
38974         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38981         LDKCommitmentTransaction arg_conv;
38982         arg_conv.inner = untag_ptr(arg);
38983         arg_conv.is_owned = ptr_is_owned(arg);
38984         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38985         arg_conv.is_owned = false;
38986         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
38987         return ret_conv;
38988 }
38989
38990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38991         LDKCommitmentTransaction orig_conv;
38992         orig_conv.inner = untag_ptr(orig);
38993         orig_conv.is_owned = ptr_is_owned(orig);
38994         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38995         orig_conv.is_owned = false;
38996         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
38997         int64_t ret_ref = 0;
38998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39000         return ret_ref;
39001 }
39002
39003 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39004         LDKCommitmentTransaction obj_conv;
39005         obj_conv.inner = untag_ptr(obj);
39006         obj_conv.is_owned = ptr_is_owned(obj);
39007         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39008         obj_conv.is_owned = false;
39009         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39010         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39011         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39012         CVec_u8Z_free(ret_var);
39013         return ret_arr;
39014 }
39015
39016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39017         LDKu8slice ser_ref;
39018         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39019         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39020         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39021         *ret_conv = CommitmentTransaction_read(ser_ref);
39022         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39023         return tag_ptr(ret_conv, true);
39024 }
39025
39026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
39027         LDKCommitmentTransaction this_arg_conv;
39028         this_arg_conv.inner = untag_ptr(this_arg);
39029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39031         this_arg_conv.is_owned = false;
39032         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39033         return ret_conv;
39034 }
39035
39036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39037         LDKCommitmentTransaction this_arg_conv;
39038         this_arg_conv.inner = untag_ptr(this_arg);
39039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39041         this_arg_conv.is_owned = false;
39042         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39043         return ret_conv;
39044 }
39045
39046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39047         LDKCommitmentTransaction 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         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39053         return ret_conv;
39054 }
39055
39056 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
39057         LDKCommitmentTransaction this_arg_conv;
39058         this_arg_conv.inner = untag_ptr(this_arg);
39059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39061         this_arg_conv.is_owned = false;
39062         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39063         return ret_conv;
39064 }
39065
39066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39067         LDKCommitmentTransaction this_arg_conv;
39068         this_arg_conv.inner = untag_ptr(this_arg);
39069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39071         this_arg_conv.is_owned = false;
39072         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39073         int64_t ret_ref = 0;
39074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39076         return ret_ref;
39077 }
39078
39079 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) {
39080         LDKCommitmentTransaction this_arg_conv;
39081         this_arg_conv.inner = untag_ptr(this_arg);
39082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39084         this_arg_conv.is_owned = false;
39085         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39086         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39087         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39088         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39089         channel_parameters_conv.is_owned = false;
39090         LDKChannelPublicKeys broadcaster_keys_conv;
39091         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39092         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39093         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39094         broadcaster_keys_conv.is_owned = false;
39095         LDKChannelPublicKeys countersignatory_keys_conv;
39096         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39097         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39098         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39099         countersignatory_keys_conv.is_owned = false;
39100         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39101         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39102         return tag_ptr(ret_conv, true);
39103 }
39104
39105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39106         LDKTrustedCommitmentTransaction this_obj_conv;
39107         this_obj_conv.inner = untag_ptr(this_obj);
39108         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39110         TrustedCommitmentTransaction_free(this_obj_conv);
39111 }
39112
39113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
39114         LDKTrustedCommitmentTransaction this_arg_conv;
39115         this_arg_conv.inner = untag_ptr(this_arg);
39116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39118         this_arg_conv.is_owned = false;
39119         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39120         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
39121         return ret_arr;
39122 }
39123
39124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39125         LDKTrustedCommitmentTransaction this_arg_conv;
39126         this_arg_conv.inner = untag_ptr(this_arg);
39127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39129         this_arg_conv.is_owned = false;
39130         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39131         int64_t ret_ref = 0;
39132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39134         return ret_ref;
39135 }
39136
39137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
39138         LDKTrustedCommitmentTransaction this_arg_conv;
39139         this_arg_conv.inner = untag_ptr(this_arg);
39140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39142         this_arg_conv.is_owned = false;
39143         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39144         int64_t ret_ref = 0;
39145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39147         return ret_ref;
39148 }
39149
39150 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
39151         LDKTrustedCommitmentTransaction this_arg_conv;
39152         this_arg_conv.inner = untag_ptr(this_arg);
39153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39155         this_arg_conv.is_owned = false;
39156         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39157         return ret_conv;
39158 }
39159
39160 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) {
39161         LDKTrustedCommitmentTransaction this_arg_conv;
39162         this_arg_conv.inner = untag_ptr(this_arg);
39163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39165         this_arg_conv.is_owned = false;
39166         unsigned char htlc_base_key_arr[32];
39167         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
39168         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
39169         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
39170         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39171         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39172         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39173         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39174         channel_parameters_conv.is_owned = false;
39175         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
39176         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
39177         return tag_ptr(ret_conv, true);
39178 }
39179
39180 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) {
39181         LDKPublicKey broadcaster_payment_basepoint_ref;
39182         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
39183         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
39184         LDKPublicKey countersignatory_payment_basepoint_ref;
39185         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
39186         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
39187         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
39188         return ret_conv;
39189 }
39190
39191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39192         LDKInitFeatures a_conv;
39193         a_conv.inner = untag_ptr(a);
39194         a_conv.is_owned = ptr_is_owned(a);
39195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39196         a_conv.is_owned = false;
39197         LDKInitFeatures b_conv;
39198         b_conv.inner = untag_ptr(b);
39199         b_conv.is_owned = ptr_is_owned(b);
39200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39201         b_conv.is_owned = false;
39202         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
39203         return ret_conv;
39204 }
39205
39206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39207         LDKNodeFeatures a_conv;
39208         a_conv.inner = untag_ptr(a);
39209         a_conv.is_owned = ptr_is_owned(a);
39210         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39211         a_conv.is_owned = false;
39212         LDKNodeFeatures b_conv;
39213         b_conv.inner = untag_ptr(b);
39214         b_conv.is_owned = ptr_is_owned(b);
39215         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39216         b_conv.is_owned = false;
39217         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
39218         return ret_conv;
39219 }
39220
39221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39222         LDKChannelFeatures a_conv;
39223         a_conv.inner = untag_ptr(a);
39224         a_conv.is_owned = ptr_is_owned(a);
39225         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39226         a_conv.is_owned = false;
39227         LDKChannelFeatures b_conv;
39228         b_conv.inner = untag_ptr(b);
39229         b_conv.is_owned = ptr_is_owned(b);
39230         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39231         b_conv.is_owned = false;
39232         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
39233         return ret_conv;
39234 }
39235
39236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39237         LDKInvoiceFeatures a_conv;
39238         a_conv.inner = untag_ptr(a);
39239         a_conv.is_owned = ptr_is_owned(a);
39240         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39241         a_conv.is_owned = false;
39242         LDKInvoiceFeatures b_conv;
39243         b_conv.inner = untag_ptr(b);
39244         b_conv.is_owned = ptr_is_owned(b);
39245         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39246         b_conv.is_owned = false;
39247         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
39248         return ret_conv;
39249 }
39250
39251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39252         LDKChannelTypeFeatures a_conv;
39253         a_conv.inner = untag_ptr(a);
39254         a_conv.is_owned = ptr_is_owned(a);
39255         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39256         a_conv.is_owned = false;
39257         LDKChannelTypeFeatures b_conv;
39258         b_conv.inner = untag_ptr(b);
39259         b_conv.is_owned = ptr_is_owned(b);
39260         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39261         b_conv.is_owned = false;
39262         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
39263         return ret_conv;
39264 }
39265
39266 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
39267         LDKInitFeatures ret_var = InitFeatures_clone(arg);
39268         int64_t ret_ref = 0;
39269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39271         return ret_ref;
39272 }
39273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39274         LDKInitFeatures arg_conv;
39275         arg_conv.inner = untag_ptr(arg);
39276         arg_conv.is_owned = ptr_is_owned(arg);
39277         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39278         arg_conv.is_owned = false;
39279         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
39280         return ret_conv;
39281 }
39282
39283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39284         LDKInitFeatures orig_conv;
39285         orig_conv.inner = untag_ptr(orig);
39286         orig_conv.is_owned = ptr_is_owned(orig);
39287         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39288         orig_conv.is_owned = false;
39289         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
39290         int64_t ret_ref = 0;
39291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39293         return ret_ref;
39294 }
39295
39296 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
39297         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
39298         int64_t ret_ref = 0;
39299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39301         return ret_ref;
39302 }
39303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39304         LDKNodeFeatures arg_conv;
39305         arg_conv.inner = untag_ptr(arg);
39306         arg_conv.is_owned = ptr_is_owned(arg);
39307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39308         arg_conv.is_owned = false;
39309         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
39310         return ret_conv;
39311 }
39312
39313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39314         LDKNodeFeatures orig_conv;
39315         orig_conv.inner = untag_ptr(orig);
39316         orig_conv.is_owned = ptr_is_owned(orig);
39317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39318         orig_conv.is_owned = false;
39319         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
39320         int64_t ret_ref = 0;
39321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39323         return ret_ref;
39324 }
39325
39326 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
39327         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
39328         int64_t ret_ref = 0;
39329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39331         return ret_ref;
39332 }
39333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39334         LDKChannelFeatures arg_conv;
39335         arg_conv.inner = untag_ptr(arg);
39336         arg_conv.is_owned = ptr_is_owned(arg);
39337         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39338         arg_conv.is_owned = false;
39339         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
39340         return ret_conv;
39341 }
39342
39343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39344         LDKChannelFeatures orig_conv;
39345         orig_conv.inner = untag_ptr(orig);
39346         orig_conv.is_owned = ptr_is_owned(orig);
39347         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39348         orig_conv.is_owned = false;
39349         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
39350         int64_t ret_ref = 0;
39351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39353         return ret_ref;
39354 }
39355
39356 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
39357         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
39358         int64_t ret_ref = 0;
39359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39361         return ret_ref;
39362 }
39363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39364         LDKInvoiceFeatures arg_conv;
39365         arg_conv.inner = untag_ptr(arg);
39366         arg_conv.is_owned = ptr_is_owned(arg);
39367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39368         arg_conv.is_owned = false;
39369         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
39370         return ret_conv;
39371 }
39372
39373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39374         LDKInvoiceFeatures orig_conv;
39375         orig_conv.inner = untag_ptr(orig);
39376         orig_conv.is_owned = ptr_is_owned(orig);
39377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39378         orig_conv.is_owned = false;
39379         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
39380         int64_t ret_ref = 0;
39381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39383         return ret_ref;
39384 }
39385
39386 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
39387         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
39388         int64_t ret_ref = 0;
39389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39391         return ret_ref;
39392 }
39393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39394         LDKChannelTypeFeatures arg_conv;
39395         arg_conv.inner = untag_ptr(arg);
39396         arg_conv.is_owned = ptr_is_owned(arg);
39397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39398         arg_conv.is_owned = false;
39399         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
39400         return ret_conv;
39401 }
39402
39403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39404         LDKChannelTypeFeatures orig_conv;
39405         orig_conv.inner = untag_ptr(orig);
39406         orig_conv.is_owned = ptr_is_owned(orig);
39407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39408         orig_conv.is_owned = false;
39409         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
39410         int64_t ret_ref = 0;
39411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39413         return ret_ref;
39414 }
39415
39416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39417         LDKInitFeatures this_obj_conv;
39418         this_obj_conv.inner = untag_ptr(this_obj);
39419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39421         InitFeatures_free(this_obj_conv);
39422 }
39423
39424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39425         LDKNodeFeatures this_obj_conv;
39426         this_obj_conv.inner = untag_ptr(this_obj);
39427         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39429         NodeFeatures_free(this_obj_conv);
39430 }
39431
39432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39433         LDKChannelFeatures this_obj_conv;
39434         this_obj_conv.inner = untag_ptr(this_obj);
39435         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39437         ChannelFeatures_free(this_obj_conv);
39438 }
39439
39440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39441         LDKInvoiceFeatures this_obj_conv;
39442         this_obj_conv.inner = untag_ptr(this_obj);
39443         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39445         InvoiceFeatures_free(this_obj_conv);
39446 }
39447
39448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39449         LDKChannelTypeFeatures this_obj_conv;
39450         this_obj_conv.inner = untag_ptr(this_obj);
39451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39453         ChannelTypeFeatures_free(this_obj_conv);
39454 }
39455
39456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
39457         LDKInitFeatures ret_var = InitFeatures_empty();
39458         int64_t ret_ref = 0;
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39461         return ret_ref;
39462 }
39463
39464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
39465         LDKInitFeatures ret_var = InitFeatures_known();
39466         int64_t ret_ref = 0;
39467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39469         return ret_ref;
39470 }
39471
39472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39473         LDKInitFeatures this_arg_conv;
39474         this_arg_conv.inner = untag_ptr(this_arg);
39475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39477         this_arg_conv.is_owned = false;
39478         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
39479         return ret_conv;
39480 }
39481
39482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
39483         LDKNodeFeatures ret_var = NodeFeatures_empty();
39484         int64_t ret_ref = 0;
39485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39487         return ret_ref;
39488 }
39489
39490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
39491         LDKNodeFeatures ret_var = NodeFeatures_known();
39492         int64_t ret_ref = 0;
39493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39495         return ret_ref;
39496 }
39497
39498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39499         LDKNodeFeatures this_arg_conv;
39500         this_arg_conv.inner = untag_ptr(this_arg);
39501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39503         this_arg_conv.is_owned = false;
39504         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
39505         return ret_conv;
39506 }
39507
39508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
39509         LDKChannelFeatures ret_var = ChannelFeatures_empty();
39510         int64_t ret_ref = 0;
39511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39513         return ret_ref;
39514 }
39515
39516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
39517         LDKChannelFeatures ret_var = ChannelFeatures_known();
39518         int64_t ret_ref = 0;
39519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39521         return ret_ref;
39522 }
39523
39524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39525         LDKChannelFeatures this_arg_conv;
39526         this_arg_conv.inner = untag_ptr(this_arg);
39527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39529         this_arg_conv.is_owned = false;
39530         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
39531         return ret_conv;
39532 }
39533
39534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
39535         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
39536         int64_t ret_ref = 0;
39537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39539         return ret_ref;
39540 }
39541
39542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
39543         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
39544         int64_t ret_ref = 0;
39545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39547         return ret_ref;
39548 }
39549
39550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39551         LDKInvoiceFeatures this_arg_conv;
39552         this_arg_conv.inner = untag_ptr(this_arg);
39553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39555         this_arg_conv.is_owned = false;
39556         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
39557         return ret_conv;
39558 }
39559
39560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
39561         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
39562         int64_t ret_ref = 0;
39563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39565         return ret_ref;
39566 }
39567
39568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
39569         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
39570         int64_t ret_ref = 0;
39571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39573         return ret_ref;
39574 }
39575
39576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39577         LDKChannelTypeFeatures this_arg_conv;
39578         this_arg_conv.inner = untag_ptr(this_arg);
39579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39581         this_arg_conv.is_owned = false;
39582         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
39583         return ret_conv;
39584 }
39585
39586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39587         LDKInitFeatures obj_conv;
39588         obj_conv.inner = untag_ptr(obj);
39589         obj_conv.is_owned = ptr_is_owned(obj);
39590         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39591         obj_conv.is_owned = false;
39592         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
39593         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39594         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39595         CVec_u8Z_free(ret_var);
39596         return ret_arr;
39597 }
39598
39599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39600         LDKu8slice ser_ref;
39601         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39602         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39603         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
39604         *ret_conv = InitFeatures_read(ser_ref);
39605         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39606         return tag_ptr(ret_conv, true);
39607 }
39608
39609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39610         LDKChannelFeatures obj_conv;
39611         obj_conv.inner = untag_ptr(obj);
39612         obj_conv.is_owned = ptr_is_owned(obj);
39613         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39614         obj_conv.is_owned = false;
39615         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
39616         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39617         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39618         CVec_u8Z_free(ret_var);
39619         return ret_arr;
39620 }
39621
39622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39623         LDKu8slice ser_ref;
39624         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39625         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39626         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
39627         *ret_conv = ChannelFeatures_read(ser_ref);
39628         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39629         return tag_ptr(ret_conv, true);
39630 }
39631
39632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39633         LDKNodeFeatures obj_conv;
39634         obj_conv.inner = untag_ptr(obj);
39635         obj_conv.is_owned = ptr_is_owned(obj);
39636         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39637         obj_conv.is_owned = false;
39638         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
39639         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39640         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39641         CVec_u8Z_free(ret_var);
39642         return ret_arr;
39643 }
39644
39645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39646         LDKu8slice ser_ref;
39647         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39648         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39649         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
39650         *ret_conv = NodeFeatures_read(ser_ref);
39651         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39652         return tag_ptr(ret_conv, true);
39653 }
39654
39655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39656         LDKInvoiceFeatures obj_conv;
39657         obj_conv.inner = untag_ptr(obj);
39658         obj_conv.is_owned = ptr_is_owned(obj);
39659         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39660         obj_conv.is_owned = false;
39661         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
39662         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39663         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39664         CVec_u8Z_free(ret_var);
39665         return ret_arr;
39666 }
39667
39668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39669         LDKu8slice ser_ref;
39670         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39671         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39672         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
39673         *ret_conv = InvoiceFeatures_read(ser_ref);
39674         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39675         return tag_ptr(ret_conv, true);
39676 }
39677
39678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39679         LDKChannelTypeFeatures obj_conv;
39680         obj_conv.inner = untag_ptr(obj);
39681         obj_conv.is_owned = ptr_is_owned(obj);
39682         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39683         obj_conv.is_owned = false;
39684         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
39685         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39686         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39687         CVec_u8Z_free(ret_var);
39688         return ret_arr;
39689 }
39690
39691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39692         LDKu8slice ser_ref;
39693         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39694         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39695         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
39696         *ret_conv = ChannelTypeFeatures_read(ser_ref);
39697         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39698         return tag_ptr(ret_conv, true);
39699 }
39700
39701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39702         LDKInitFeatures this_arg_conv;
39703         this_arg_conv.inner = untag_ptr(this_arg);
39704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39706         this_arg_conv.is_owned = false;
39707         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
39708 }
39709
39710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39711         LDKInitFeatures this_arg_conv;
39712         this_arg_conv.inner = untag_ptr(this_arg);
39713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39715         this_arg_conv.is_owned = false;
39716         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
39717 }
39718
39719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39720         LDKInitFeatures this_arg_conv;
39721         this_arg_conv.inner = untag_ptr(this_arg);
39722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39724         this_arg_conv.is_owned = false;
39725         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
39726         return ret_conv;
39727 }
39728
39729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39730         LDKNodeFeatures this_arg_conv;
39731         this_arg_conv.inner = untag_ptr(this_arg);
39732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39734         this_arg_conv.is_owned = false;
39735         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
39736 }
39737
39738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39739         LDKNodeFeatures this_arg_conv;
39740         this_arg_conv.inner = untag_ptr(this_arg);
39741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39743         this_arg_conv.is_owned = false;
39744         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
39745 }
39746
39747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39748         LDKNodeFeatures this_arg_conv;
39749         this_arg_conv.inner = untag_ptr(this_arg);
39750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39752         this_arg_conv.is_owned = false;
39753         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
39754         return ret_conv;
39755 }
39756
39757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39758         LDKInitFeatures this_arg_conv;
39759         this_arg_conv.inner = untag_ptr(this_arg);
39760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39762         this_arg_conv.is_owned = false;
39763         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
39764         return ret_conv;
39765 }
39766
39767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39768         LDKNodeFeatures this_arg_conv;
39769         this_arg_conv.inner = untag_ptr(this_arg);
39770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39772         this_arg_conv.is_owned = false;
39773         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
39774         return ret_conv;
39775 }
39776
39777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39778         LDKInitFeatures this_arg_conv;
39779         this_arg_conv.inner = untag_ptr(this_arg);
39780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39782         this_arg_conv.is_owned = false;
39783         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
39784 }
39785
39786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39787         LDKInitFeatures this_arg_conv;
39788         this_arg_conv.inner = untag_ptr(this_arg);
39789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39791         this_arg_conv.is_owned = false;
39792         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
39793 }
39794
39795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
39796         LDKInitFeatures this_arg_conv;
39797         this_arg_conv.inner = untag_ptr(this_arg);
39798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39800         this_arg_conv.is_owned = false;
39801         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
39802         return ret_conv;
39803 }
39804
39805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39806         LDKInitFeatures this_arg_conv;
39807         this_arg_conv.inner = untag_ptr(this_arg);
39808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39810         this_arg_conv.is_owned = false;
39811         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
39812 }
39813
39814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39815         LDKInitFeatures this_arg_conv;
39816         this_arg_conv.inner = untag_ptr(this_arg);
39817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39819         this_arg_conv.is_owned = false;
39820         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
39821 }
39822
39823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39824         LDKInitFeatures this_arg_conv;
39825         this_arg_conv.inner = untag_ptr(this_arg);
39826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39828         this_arg_conv.is_owned = false;
39829         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
39830         return ret_conv;
39831 }
39832
39833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39834         LDKNodeFeatures this_arg_conv;
39835         this_arg_conv.inner = untag_ptr(this_arg);
39836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39838         this_arg_conv.is_owned = false;
39839         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
39840 }
39841
39842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39843         LDKNodeFeatures this_arg_conv;
39844         this_arg_conv.inner = untag_ptr(this_arg);
39845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39847         this_arg_conv.is_owned = false;
39848         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
39849 }
39850
39851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39852         LDKNodeFeatures this_arg_conv;
39853         this_arg_conv.inner = untag_ptr(this_arg);
39854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39856         this_arg_conv.is_owned = false;
39857         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
39858         return ret_conv;
39859 }
39860
39861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39862         LDKInitFeatures this_arg_conv;
39863         this_arg_conv.inner = untag_ptr(this_arg);
39864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39866         this_arg_conv.is_owned = false;
39867         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
39868         return ret_conv;
39869 }
39870
39871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39872         LDKNodeFeatures this_arg_conv;
39873         this_arg_conv.inner = untag_ptr(this_arg);
39874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39876         this_arg_conv.is_owned = false;
39877         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
39878         return ret_conv;
39879 }
39880
39881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39882         LDKInitFeatures this_arg_conv;
39883         this_arg_conv.inner = untag_ptr(this_arg);
39884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39886         this_arg_conv.is_owned = false;
39887         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
39888 }
39889
39890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39891         LDKInitFeatures this_arg_conv;
39892         this_arg_conv.inner = untag_ptr(this_arg);
39893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39895         this_arg_conv.is_owned = false;
39896         InitFeatures_set_gossip_queries_required(&this_arg_conv);
39897 }
39898
39899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
39900         LDKInitFeatures this_arg_conv;
39901         this_arg_conv.inner = untag_ptr(this_arg);
39902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39904         this_arg_conv.is_owned = false;
39905         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
39906         return ret_conv;
39907 }
39908
39909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39910         LDKNodeFeatures this_arg_conv;
39911         this_arg_conv.inner = untag_ptr(this_arg);
39912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39914         this_arg_conv.is_owned = false;
39915         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
39916 }
39917
39918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39919         LDKNodeFeatures this_arg_conv;
39920         this_arg_conv.inner = untag_ptr(this_arg);
39921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39923         this_arg_conv.is_owned = false;
39924         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
39925 }
39926
39927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
39928         LDKNodeFeatures this_arg_conv;
39929         this_arg_conv.inner = untag_ptr(this_arg);
39930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39932         this_arg_conv.is_owned = false;
39933         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
39934         return ret_conv;
39935 }
39936
39937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
39938         LDKInitFeatures this_arg_conv;
39939         this_arg_conv.inner = untag_ptr(this_arg);
39940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39942         this_arg_conv.is_owned = false;
39943         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
39944         return ret_conv;
39945 }
39946
39947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
39948         LDKNodeFeatures this_arg_conv;
39949         this_arg_conv.inner = untag_ptr(this_arg);
39950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39952         this_arg_conv.is_owned = false;
39953         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
39954         return ret_conv;
39955 }
39956
39957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39958         LDKInitFeatures this_arg_conv;
39959         this_arg_conv.inner = untag_ptr(this_arg);
39960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39962         this_arg_conv.is_owned = false;
39963         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
39964 }
39965
39966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39967         LDKInitFeatures this_arg_conv;
39968         this_arg_conv.inner = untag_ptr(this_arg);
39969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39971         this_arg_conv.is_owned = false;
39972         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
39973 }
39974
39975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
39976         LDKInitFeatures this_arg_conv;
39977         this_arg_conv.inner = untag_ptr(this_arg);
39978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39980         this_arg_conv.is_owned = false;
39981         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
39982         return ret_conv;
39983 }
39984
39985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39986         LDKNodeFeatures this_arg_conv;
39987         this_arg_conv.inner = untag_ptr(this_arg);
39988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39990         this_arg_conv.is_owned = false;
39991         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
39992 }
39993
39994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39995         LDKNodeFeatures this_arg_conv;
39996         this_arg_conv.inner = untag_ptr(this_arg);
39997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39999         this_arg_conv.is_owned = false;
40000         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
40001 }
40002
40003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40004         LDKNodeFeatures this_arg_conv;
40005         this_arg_conv.inner = untag_ptr(this_arg);
40006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40008         this_arg_conv.is_owned = false;
40009         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
40010         return ret_conv;
40011 }
40012
40013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40014         LDKInvoiceFeatures this_arg_conv;
40015         this_arg_conv.inner = untag_ptr(this_arg);
40016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40018         this_arg_conv.is_owned = false;
40019         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
40020 }
40021
40022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40023         LDKInvoiceFeatures this_arg_conv;
40024         this_arg_conv.inner = untag_ptr(this_arg);
40025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40027         this_arg_conv.is_owned = false;
40028         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
40029 }
40030
40031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40032         LDKInvoiceFeatures this_arg_conv;
40033         this_arg_conv.inner = untag_ptr(this_arg);
40034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40036         this_arg_conv.is_owned = false;
40037         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
40038         return ret_conv;
40039 }
40040
40041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40042         LDKInitFeatures this_arg_conv;
40043         this_arg_conv.inner = untag_ptr(this_arg);
40044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40046         this_arg_conv.is_owned = false;
40047         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
40048         return ret_conv;
40049 }
40050
40051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40052         LDKNodeFeatures this_arg_conv;
40053         this_arg_conv.inner = untag_ptr(this_arg);
40054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40056         this_arg_conv.is_owned = false;
40057         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
40058         return ret_conv;
40059 }
40060
40061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40062         LDKInvoiceFeatures this_arg_conv;
40063         this_arg_conv.inner = untag_ptr(this_arg);
40064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40066         this_arg_conv.is_owned = false;
40067         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
40068         return ret_conv;
40069 }
40070
40071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40072         LDKInitFeatures this_arg_conv;
40073         this_arg_conv.inner = untag_ptr(this_arg);
40074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40076         this_arg_conv.is_owned = false;
40077         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
40078 }
40079
40080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40081         LDKInitFeatures this_arg_conv;
40082         this_arg_conv.inner = untag_ptr(this_arg);
40083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40085         this_arg_conv.is_owned = false;
40086         InitFeatures_set_static_remote_key_required(&this_arg_conv);
40087 }
40088
40089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40090         LDKInitFeatures this_arg_conv;
40091         this_arg_conv.inner = untag_ptr(this_arg);
40092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40094         this_arg_conv.is_owned = false;
40095         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
40096         return ret_conv;
40097 }
40098
40099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40100         LDKNodeFeatures this_arg_conv;
40101         this_arg_conv.inner = untag_ptr(this_arg);
40102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40104         this_arg_conv.is_owned = false;
40105         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
40106 }
40107
40108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40109         LDKNodeFeatures this_arg_conv;
40110         this_arg_conv.inner = untag_ptr(this_arg);
40111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40113         this_arg_conv.is_owned = false;
40114         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
40115 }
40116
40117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40118         LDKNodeFeatures this_arg_conv;
40119         this_arg_conv.inner = untag_ptr(this_arg);
40120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40122         this_arg_conv.is_owned = false;
40123         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
40124         return ret_conv;
40125 }
40126
40127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40128         LDKChannelTypeFeatures this_arg_conv;
40129         this_arg_conv.inner = untag_ptr(this_arg);
40130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40132         this_arg_conv.is_owned = false;
40133         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
40134 }
40135
40136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40137         LDKChannelTypeFeatures this_arg_conv;
40138         this_arg_conv.inner = untag_ptr(this_arg);
40139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40141         this_arg_conv.is_owned = false;
40142         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
40143 }
40144
40145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40146         LDKChannelTypeFeatures this_arg_conv;
40147         this_arg_conv.inner = untag_ptr(this_arg);
40148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40150         this_arg_conv.is_owned = false;
40151         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
40152         return ret_conv;
40153 }
40154
40155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40156         LDKInitFeatures this_arg_conv;
40157         this_arg_conv.inner = untag_ptr(this_arg);
40158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40160         this_arg_conv.is_owned = false;
40161         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
40162         return ret_conv;
40163 }
40164
40165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40166         LDKNodeFeatures this_arg_conv;
40167         this_arg_conv.inner = untag_ptr(this_arg);
40168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40170         this_arg_conv.is_owned = false;
40171         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
40172         return ret_conv;
40173 }
40174
40175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40176         LDKChannelTypeFeatures this_arg_conv;
40177         this_arg_conv.inner = untag_ptr(this_arg);
40178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40180         this_arg_conv.is_owned = false;
40181         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
40182         return ret_conv;
40183 }
40184
40185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40186         LDKInitFeatures this_arg_conv;
40187         this_arg_conv.inner = untag_ptr(this_arg);
40188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40190         this_arg_conv.is_owned = false;
40191         InitFeatures_set_payment_secret_optional(&this_arg_conv);
40192 }
40193
40194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40195         LDKInitFeatures this_arg_conv;
40196         this_arg_conv.inner = untag_ptr(this_arg);
40197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40199         this_arg_conv.is_owned = false;
40200         InitFeatures_set_payment_secret_required(&this_arg_conv);
40201 }
40202
40203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40204         LDKInitFeatures this_arg_conv;
40205         this_arg_conv.inner = untag_ptr(this_arg);
40206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40208         this_arg_conv.is_owned = false;
40209         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
40210         return ret_conv;
40211 }
40212
40213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40214         LDKNodeFeatures this_arg_conv;
40215         this_arg_conv.inner = untag_ptr(this_arg);
40216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40218         this_arg_conv.is_owned = false;
40219         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
40220 }
40221
40222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40223         LDKNodeFeatures this_arg_conv;
40224         this_arg_conv.inner = untag_ptr(this_arg);
40225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40227         this_arg_conv.is_owned = false;
40228         NodeFeatures_set_payment_secret_required(&this_arg_conv);
40229 }
40230
40231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40232         LDKNodeFeatures this_arg_conv;
40233         this_arg_conv.inner = untag_ptr(this_arg);
40234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40236         this_arg_conv.is_owned = false;
40237         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
40238         return ret_conv;
40239 }
40240
40241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40242         LDKInvoiceFeatures this_arg_conv;
40243         this_arg_conv.inner = untag_ptr(this_arg);
40244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40246         this_arg_conv.is_owned = false;
40247         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
40248 }
40249
40250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40251         LDKInvoiceFeatures this_arg_conv;
40252         this_arg_conv.inner = untag_ptr(this_arg);
40253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40255         this_arg_conv.is_owned = false;
40256         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
40257 }
40258
40259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40260         LDKInvoiceFeatures this_arg_conv;
40261         this_arg_conv.inner = untag_ptr(this_arg);
40262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40264         this_arg_conv.is_owned = false;
40265         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
40266         return ret_conv;
40267 }
40268
40269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40270         LDKInitFeatures this_arg_conv;
40271         this_arg_conv.inner = untag_ptr(this_arg);
40272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40274         this_arg_conv.is_owned = false;
40275         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
40276         return ret_conv;
40277 }
40278
40279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40280         LDKNodeFeatures this_arg_conv;
40281         this_arg_conv.inner = untag_ptr(this_arg);
40282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40284         this_arg_conv.is_owned = false;
40285         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
40286         return ret_conv;
40287 }
40288
40289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40290         LDKInvoiceFeatures this_arg_conv;
40291         this_arg_conv.inner = untag_ptr(this_arg);
40292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40294         this_arg_conv.is_owned = false;
40295         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
40296         return ret_conv;
40297 }
40298
40299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40300         LDKInitFeatures this_arg_conv;
40301         this_arg_conv.inner = untag_ptr(this_arg);
40302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40304         this_arg_conv.is_owned = false;
40305         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
40306 }
40307
40308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40309         LDKInitFeatures this_arg_conv;
40310         this_arg_conv.inner = untag_ptr(this_arg);
40311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40313         this_arg_conv.is_owned = false;
40314         InitFeatures_set_basic_mpp_required(&this_arg_conv);
40315 }
40316
40317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40318         LDKInitFeatures this_arg_conv;
40319         this_arg_conv.inner = untag_ptr(this_arg);
40320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40322         this_arg_conv.is_owned = false;
40323         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
40324         return ret_conv;
40325 }
40326
40327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40328         LDKNodeFeatures this_arg_conv;
40329         this_arg_conv.inner = untag_ptr(this_arg);
40330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40332         this_arg_conv.is_owned = false;
40333         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
40334 }
40335
40336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40337         LDKNodeFeatures this_arg_conv;
40338         this_arg_conv.inner = untag_ptr(this_arg);
40339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40341         this_arg_conv.is_owned = false;
40342         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
40343 }
40344
40345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40346         LDKNodeFeatures this_arg_conv;
40347         this_arg_conv.inner = untag_ptr(this_arg);
40348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40350         this_arg_conv.is_owned = false;
40351         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
40352         return ret_conv;
40353 }
40354
40355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40356         LDKInvoiceFeatures this_arg_conv;
40357         this_arg_conv.inner = untag_ptr(this_arg);
40358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40360         this_arg_conv.is_owned = false;
40361         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
40362 }
40363
40364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40365         LDKInvoiceFeatures this_arg_conv;
40366         this_arg_conv.inner = untag_ptr(this_arg);
40367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40369         this_arg_conv.is_owned = false;
40370         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
40371 }
40372
40373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40374         LDKInvoiceFeatures this_arg_conv;
40375         this_arg_conv.inner = untag_ptr(this_arg);
40376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40378         this_arg_conv.is_owned = false;
40379         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
40380         return ret_conv;
40381 }
40382
40383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40384         LDKInitFeatures this_arg_conv;
40385         this_arg_conv.inner = untag_ptr(this_arg);
40386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40388         this_arg_conv.is_owned = false;
40389         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
40390         return ret_conv;
40391 }
40392
40393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40394         LDKNodeFeatures this_arg_conv;
40395         this_arg_conv.inner = untag_ptr(this_arg);
40396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40398         this_arg_conv.is_owned = false;
40399         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
40400         return ret_conv;
40401 }
40402
40403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40404         LDKInvoiceFeatures this_arg_conv;
40405         this_arg_conv.inner = untag_ptr(this_arg);
40406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40408         this_arg_conv.is_owned = false;
40409         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
40410         return ret_conv;
40411 }
40412
40413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40414         LDKInitFeatures this_arg_conv;
40415         this_arg_conv.inner = untag_ptr(this_arg);
40416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40418         this_arg_conv.is_owned = false;
40419         InitFeatures_set_wumbo_optional(&this_arg_conv);
40420 }
40421
40422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40423         LDKInitFeatures this_arg_conv;
40424         this_arg_conv.inner = untag_ptr(this_arg);
40425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40427         this_arg_conv.is_owned = false;
40428         InitFeatures_set_wumbo_required(&this_arg_conv);
40429 }
40430
40431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40432         LDKInitFeatures this_arg_conv;
40433         this_arg_conv.inner = untag_ptr(this_arg);
40434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40436         this_arg_conv.is_owned = false;
40437         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
40438         return ret_conv;
40439 }
40440
40441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40442         LDKNodeFeatures this_arg_conv;
40443         this_arg_conv.inner = untag_ptr(this_arg);
40444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40446         this_arg_conv.is_owned = false;
40447         NodeFeatures_set_wumbo_optional(&this_arg_conv);
40448 }
40449
40450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40451         LDKNodeFeatures this_arg_conv;
40452         this_arg_conv.inner = untag_ptr(this_arg);
40453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40455         this_arg_conv.is_owned = false;
40456         NodeFeatures_set_wumbo_required(&this_arg_conv);
40457 }
40458
40459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40460         LDKNodeFeatures this_arg_conv;
40461         this_arg_conv.inner = untag_ptr(this_arg);
40462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40464         this_arg_conv.is_owned = false;
40465         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
40466         return ret_conv;
40467 }
40468
40469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40470         LDKInitFeatures this_arg_conv;
40471         this_arg_conv.inner = untag_ptr(this_arg);
40472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40474         this_arg_conv.is_owned = false;
40475         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
40476         return ret_conv;
40477 }
40478
40479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40480         LDKNodeFeatures this_arg_conv;
40481         this_arg_conv.inner = untag_ptr(this_arg);
40482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40484         this_arg_conv.is_owned = false;
40485         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
40486         return ret_conv;
40487 }
40488
40489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40490         LDKInitFeatures this_arg_conv;
40491         this_arg_conv.inner = untag_ptr(this_arg);
40492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40494         this_arg_conv.is_owned = false;
40495         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40496 }
40497
40498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40499         LDKInitFeatures this_arg_conv;
40500         this_arg_conv.inner = untag_ptr(this_arg);
40501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40503         this_arg_conv.is_owned = false;
40504         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40505 }
40506
40507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40508         LDKInitFeatures this_arg_conv;
40509         this_arg_conv.inner = untag_ptr(this_arg);
40510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40512         this_arg_conv.is_owned = false;
40513         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40514         return ret_conv;
40515 }
40516
40517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40518         LDKNodeFeatures this_arg_conv;
40519         this_arg_conv.inner = untag_ptr(this_arg);
40520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40522         this_arg_conv.is_owned = false;
40523         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40524 }
40525
40526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40527         LDKNodeFeatures this_arg_conv;
40528         this_arg_conv.inner = untag_ptr(this_arg);
40529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40531         this_arg_conv.is_owned = false;
40532         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40533 }
40534
40535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40536         LDKNodeFeatures this_arg_conv;
40537         this_arg_conv.inner = untag_ptr(this_arg);
40538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40540         this_arg_conv.is_owned = false;
40541         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40542         return ret_conv;
40543 }
40544
40545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40546         LDKInitFeatures this_arg_conv;
40547         this_arg_conv.inner = untag_ptr(this_arg);
40548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40550         this_arg_conv.is_owned = false;
40551         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40552         return ret_conv;
40553 }
40554
40555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40556         LDKNodeFeatures this_arg_conv;
40557         this_arg_conv.inner = untag_ptr(this_arg);
40558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40560         this_arg_conv.is_owned = false;
40561         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40562         return ret_conv;
40563 }
40564
40565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40566         LDKInitFeatures this_arg_conv;
40567         this_arg_conv.inner = untag_ptr(this_arg);
40568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40570         this_arg_conv.is_owned = false;
40571         InitFeatures_set_channel_type_optional(&this_arg_conv);
40572 }
40573
40574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40575         LDKInitFeatures this_arg_conv;
40576         this_arg_conv.inner = untag_ptr(this_arg);
40577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40579         this_arg_conv.is_owned = false;
40580         InitFeatures_set_channel_type_required(&this_arg_conv);
40581 }
40582
40583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40584         LDKInitFeatures this_arg_conv;
40585         this_arg_conv.inner = untag_ptr(this_arg);
40586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40588         this_arg_conv.is_owned = false;
40589         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
40590         return ret_conv;
40591 }
40592
40593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40594         LDKNodeFeatures this_arg_conv;
40595         this_arg_conv.inner = untag_ptr(this_arg);
40596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40598         this_arg_conv.is_owned = false;
40599         NodeFeatures_set_channel_type_optional(&this_arg_conv);
40600 }
40601
40602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40603         LDKNodeFeatures this_arg_conv;
40604         this_arg_conv.inner = untag_ptr(this_arg);
40605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40607         this_arg_conv.is_owned = false;
40608         NodeFeatures_set_channel_type_required(&this_arg_conv);
40609 }
40610
40611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40612         LDKNodeFeatures this_arg_conv;
40613         this_arg_conv.inner = untag_ptr(this_arg);
40614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40616         this_arg_conv.is_owned = false;
40617         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
40618         return ret_conv;
40619 }
40620
40621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40622         LDKInitFeatures this_arg_conv;
40623         this_arg_conv.inner = untag_ptr(this_arg);
40624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40626         this_arg_conv.is_owned = false;
40627         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
40628         return ret_conv;
40629 }
40630
40631 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40632         LDKNodeFeatures this_arg_conv;
40633         this_arg_conv.inner = untag_ptr(this_arg);
40634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40636         this_arg_conv.is_owned = false;
40637         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
40638         return ret_conv;
40639 }
40640
40641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40642         LDKInitFeatures this_arg_conv;
40643         this_arg_conv.inner = untag_ptr(this_arg);
40644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40646         this_arg_conv.is_owned = false;
40647         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
40648 }
40649
40650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40651         LDKInitFeatures this_arg_conv;
40652         this_arg_conv.inner = untag_ptr(this_arg);
40653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40655         this_arg_conv.is_owned = false;
40656         InitFeatures_set_scid_privacy_required(&this_arg_conv);
40657 }
40658
40659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40660         LDKInitFeatures this_arg_conv;
40661         this_arg_conv.inner = untag_ptr(this_arg);
40662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40664         this_arg_conv.is_owned = false;
40665         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
40666         return ret_conv;
40667 }
40668
40669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40670         LDKNodeFeatures this_arg_conv;
40671         this_arg_conv.inner = untag_ptr(this_arg);
40672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40674         this_arg_conv.is_owned = false;
40675         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
40676 }
40677
40678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40679         LDKNodeFeatures this_arg_conv;
40680         this_arg_conv.inner = untag_ptr(this_arg);
40681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40683         this_arg_conv.is_owned = false;
40684         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
40685 }
40686
40687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40688         LDKNodeFeatures this_arg_conv;
40689         this_arg_conv.inner = untag_ptr(this_arg);
40690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40692         this_arg_conv.is_owned = false;
40693         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
40694         return ret_conv;
40695 }
40696
40697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40698         LDKChannelTypeFeatures this_arg_conv;
40699         this_arg_conv.inner = untag_ptr(this_arg);
40700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40702         this_arg_conv.is_owned = false;
40703         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
40704 }
40705
40706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40707         LDKChannelTypeFeatures this_arg_conv;
40708         this_arg_conv.inner = untag_ptr(this_arg);
40709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40711         this_arg_conv.is_owned = false;
40712         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
40713 }
40714
40715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40716         LDKChannelTypeFeatures this_arg_conv;
40717         this_arg_conv.inner = untag_ptr(this_arg);
40718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40720         this_arg_conv.is_owned = false;
40721         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
40722         return ret_conv;
40723 }
40724
40725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40726         LDKInitFeatures this_arg_conv;
40727         this_arg_conv.inner = untag_ptr(this_arg);
40728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40730         this_arg_conv.is_owned = false;
40731         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
40732         return ret_conv;
40733 }
40734
40735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40736         LDKNodeFeatures this_arg_conv;
40737         this_arg_conv.inner = untag_ptr(this_arg);
40738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40740         this_arg_conv.is_owned = false;
40741         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
40742         return ret_conv;
40743 }
40744
40745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40746         LDKChannelTypeFeatures this_arg_conv;
40747         this_arg_conv.inner = untag_ptr(this_arg);
40748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40750         this_arg_conv.is_owned = false;
40751         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
40752         return ret_conv;
40753 }
40754
40755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40756         LDKInitFeatures this_arg_conv;
40757         this_arg_conv.inner = untag_ptr(this_arg);
40758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40760         this_arg_conv.is_owned = false;
40761         InitFeatures_set_zero_conf_optional(&this_arg_conv);
40762 }
40763
40764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40765         LDKInitFeatures this_arg_conv;
40766         this_arg_conv.inner = untag_ptr(this_arg);
40767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40769         this_arg_conv.is_owned = false;
40770         InitFeatures_set_zero_conf_required(&this_arg_conv);
40771 }
40772
40773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40774         LDKInitFeatures this_arg_conv;
40775         this_arg_conv.inner = untag_ptr(this_arg);
40776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40778         this_arg_conv.is_owned = false;
40779         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
40780         return ret_conv;
40781 }
40782
40783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40784         LDKNodeFeatures this_arg_conv;
40785         this_arg_conv.inner = untag_ptr(this_arg);
40786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40788         this_arg_conv.is_owned = false;
40789         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
40790 }
40791
40792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40793         LDKNodeFeatures this_arg_conv;
40794         this_arg_conv.inner = untag_ptr(this_arg);
40795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40797         this_arg_conv.is_owned = false;
40798         NodeFeatures_set_zero_conf_required(&this_arg_conv);
40799 }
40800
40801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40802         LDKNodeFeatures this_arg_conv;
40803         this_arg_conv.inner = untag_ptr(this_arg);
40804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40806         this_arg_conv.is_owned = false;
40807         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
40808         return ret_conv;
40809 }
40810
40811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40812         LDKChannelTypeFeatures this_arg_conv;
40813         this_arg_conv.inner = untag_ptr(this_arg);
40814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40816         this_arg_conv.is_owned = false;
40817         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
40818 }
40819
40820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40821         LDKChannelTypeFeatures this_arg_conv;
40822         this_arg_conv.inner = untag_ptr(this_arg);
40823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40825         this_arg_conv.is_owned = false;
40826         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
40827 }
40828
40829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40830         LDKChannelTypeFeatures this_arg_conv;
40831         this_arg_conv.inner = untag_ptr(this_arg);
40832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40834         this_arg_conv.is_owned = false;
40835         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
40836         return ret_conv;
40837 }
40838
40839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40840         LDKInitFeatures this_arg_conv;
40841         this_arg_conv.inner = untag_ptr(this_arg);
40842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40844         this_arg_conv.is_owned = false;
40845         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
40846         return ret_conv;
40847 }
40848
40849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40850         LDKNodeFeatures this_arg_conv;
40851         this_arg_conv.inner = untag_ptr(this_arg);
40852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40854         this_arg_conv.is_owned = false;
40855         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
40856         return ret_conv;
40857 }
40858
40859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40860         LDKChannelTypeFeatures this_arg_conv;
40861         this_arg_conv.inner = untag_ptr(this_arg);
40862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40864         this_arg_conv.is_owned = false;
40865         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
40866         return ret_conv;
40867 }
40868
40869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40870         LDKNodeFeatures this_arg_conv;
40871         this_arg_conv.inner = untag_ptr(this_arg);
40872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40874         this_arg_conv.is_owned = false;
40875         NodeFeatures_set_keysend_optional(&this_arg_conv);
40876 }
40877
40878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40879         LDKNodeFeatures this_arg_conv;
40880         this_arg_conv.inner = untag_ptr(this_arg);
40881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40883         this_arg_conv.is_owned = false;
40884         NodeFeatures_set_keysend_required(&this_arg_conv);
40885 }
40886
40887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
40888         LDKNodeFeatures this_arg_conv;
40889         this_arg_conv.inner = untag_ptr(this_arg);
40890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40892         this_arg_conv.is_owned = false;
40893         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
40894         return ret_conv;
40895 }
40896
40897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
40898         LDKNodeFeatures this_arg_conv;
40899         this_arg_conv.inner = untag_ptr(this_arg);
40900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40902         this_arg_conv.is_owned = false;
40903         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
40904         return ret_conv;
40905 }
40906
40907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40908         LDKShutdownScript this_obj_conv;
40909         this_obj_conv.inner = untag_ptr(this_obj);
40910         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40912         ShutdownScript_free(this_obj_conv);
40913 }
40914
40915 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
40916         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
40917         int64_t ret_ref = 0;
40918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40920         return ret_ref;
40921 }
40922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40923         LDKShutdownScript arg_conv;
40924         arg_conv.inner = untag_ptr(arg);
40925         arg_conv.is_owned = ptr_is_owned(arg);
40926         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40927         arg_conv.is_owned = false;
40928         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
40929         return ret_conv;
40930 }
40931
40932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40933         LDKShutdownScript orig_conv;
40934         orig_conv.inner = untag_ptr(orig);
40935         orig_conv.is_owned = ptr_is_owned(orig);
40936         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40937         orig_conv.is_owned = false;
40938         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
40939         int64_t ret_ref = 0;
40940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40942         return ret_ref;
40943 }
40944
40945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40946         LDKInvalidShutdownScript this_obj_conv;
40947         this_obj_conv.inner = untag_ptr(this_obj);
40948         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40950         InvalidShutdownScript_free(this_obj_conv);
40951 }
40952
40953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
40954         LDKInvalidShutdownScript this_ptr_conv;
40955         this_ptr_conv.inner = untag_ptr(this_ptr);
40956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40958         this_ptr_conv.is_owned = false;
40959         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
40960         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40961         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40962         return ret_arr;
40963 }
40964
40965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40966         LDKInvalidShutdownScript this_ptr_conv;
40967         this_ptr_conv.inner = untag_ptr(this_ptr);
40968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40970         this_ptr_conv.is_owned = false;
40971         LDKCVec_u8Z val_ref;
40972         val_ref.datalen = (*env)->GetArrayLength(env, val);
40973         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40974         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
40975         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
40976 }
40977
40978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
40979         LDKCVec_u8Z script_arg_ref;
40980         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
40981         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40982         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
40983         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
40984         int64_t ret_ref = 0;
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40987         return ret_ref;
40988 }
40989
40990 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
40991         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
40992         int64_t ret_ref = 0;
40993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40995         return ret_ref;
40996 }
40997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40998         LDKInvalidShutdownScript arg_conv;
40999         arg_conv.inner = untag_ptr(arg);
41000         arg_conv.is_owned = ptr_is_owned(arg);
41001         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41002         arg_conv.is_owned = false;
41003         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
41004         return ret_conv;
41005 }
41006
41007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41008         LDKInvalidShutdownScript orig_conv;
41009         orig_conv.inner = untag_ptr(orig);
41010         orig_conv.is_owned = ptr_is_owned(orig);
41011         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41012         orig_conv.is_owned = false;
41013         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
41014         int64_t ret_ref = 0;
41015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41017         return ret_ref;
41018 }
41019
41020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
41021         LDKShutdownScript obj_conv;
41022         obj_conv.inner = untag_ptr(obj);
41023         obj_conv.is_owned = ptr_is_owned(obj);
41024         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41025         obj_conv.is_owned = false;
41026         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
41027         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41028         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41029         CVec_u8Z_free(ret_var);
41030         return ret_arr;
41031 }
41032
41033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41034         LDKu8slice ser_ref;
41035         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41036         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41037         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
41038         *ret_conv = ShutdownScript_read(ser_ref);
41039         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41040         return tag_ptr(ret_conv, true);
41041 }
41042
41043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
41044         unsigned char pubkey_hash_arr[20];
41045         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
41046         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
41047         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
41048         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
41049         int64_t ret_ref = 0;
41050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41052         return ret_ref;
41053 }
41054
41055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
41056         unsigned char script_hash_arr[32];
41057         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
41058         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
41059         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
41060         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
41061         int64_t ret_ref = 0;
41062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41064         return ret_ref;
41065 }
41066
41067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
41068         
41069         LDKu8slice program_ref;
41070         program_ref.datalen = (*env)->GetArrayLength(env, program);
41071         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
41072         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
41073         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
41074         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
41075         return tag_ptr(ret_conv, true);
41076 }
41077
41078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
41079         LDKShutdownScript this_arg_conv;
41080         this_arg_conv.inner = untag_ptr(this_arg);
41081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41083         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
41084         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
41085         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41086         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41087         CVec_u8Z_free(ret_var);
41088         return ret_arr;
41089 }
41090
41091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
41092         LDKShutdownScript 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
41099         return ret_arr;
41100 }
41101
41102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
41103         LDKShutdownScript this_arg_conv;
41104         this_arg_conv.inner = untag_ptr(this_arg);
41105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41107         this_arg_conv.is_owned = false;
41108         LDKInitFeatures features_conv;
41109         features_conv.inner = untag_ptr(features);
41110         features_conv.is_owned = ptr_is_owned(features);
41111         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41112         features_conv.is_owned = false;
41113         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
41114         return ret_conv;
41115 }
41116
41117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41118         if (!ptr_is_owned(this_ptr)) return;
41119         void* this_ptr_ptr = untag_ptr(this_ptr);
41120         CHECK_ACCESS(this_ptr_ptr);
41121         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
41122         FREE(untag_ptr(this_ptr));
41123         CustomMessageReader_free(this_ptr_conv);
41124 }
41125
41126 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
41127         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41128         *ret_ret = Type_clone(arg);
41129         return tag_ptr(ret_ret, true);
41130 }
41131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41132         void* arg_ptr = untag_ptr(arg);
41133         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
41134         LDKType* arg_conv = (LDKType*)arg_ptr;
41135         int64_t ret_conv = Type_clone_ptr(arg_conv);
41136         return ret_conv;
41137 }
41138
41139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41140         void* orig_ptr = untag_ptr(orig);
41141         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
41142         LDKType* orig_conv = (LDKType*)orig_ptr;
41143         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41144         *ret_ret = Type_clone(orig_conv);
41145         return tag_ptr(ret_ret, true);
41146 }
41147
41148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41149         if (!ptr_is_owned(this_ptr)) return;
41150         void* this_ptr_ptr = untag_ptr(this_ptr);
41151         CHECK_ACCESS(this_ptr_ptr);
41152         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
41153         FREE(untag_ptr(this_ptr));
41154         Type_free(this_ptr_conv);
41155 }
41156
41157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41158         LDKNodeId this_obj_conv;
41159         this_obj_conv.inner = untag_ptr(this_obj);
41160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41162         NodeId_free(this_obj_conv);
41163 }
41164
41165 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
41166         LDKNodeId ret_var = NodeId_clone(arg);
41167         int64_t ret_ref = 0;
41168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41170         return ret_ref;
41171 }
41172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41173         LDKNodeId arg_conv;
41174         arg_conv.inner = untag_ptr(arg);
41175         arg_conv.is_owned = ptr_is_owned(arg);
41176         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41177         arg_conv.is_owned = false;
41178         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
41179         return ret_conv;
41180 }
41181
41182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41183         LDKNodeId orig_conv;
41184         orig_conv.inner = untag_ptr(orig);
41185         orig_conv.is_owned = ptr_is_owned(orig);
41186         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41187         orig_conv.is_owned = false;
41188         LDKNodeId ret_var = NodeId_clone(&orig_conv);
41189         int64_t ret_ref = 0;
41190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41192         return ret_ref;
41193 }
41194
41195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
41196         LDKPublicKey pubkey_ref;
41197         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
41198         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
41199         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
41200         int64_t ret_ref = 0;
41201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41203         return ret_ref;
41204 }
41205
41206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
41207         LDKNodeId this_arg_conv;
41208         this_arg_conv.inner = untag_ptr(this_arg);
41209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41211         this_arg_conv.is_owned = false;
41212         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
41213         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41214         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41215         return ret_arr;
41216 }
41217
41218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
41219         LDKNodeId o_conv;
41220         o_conv.inner = untag_ptr(o);
41221         o_conv.is_owned = ptr_is_owned(o);
41222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41223         o_conv.is_owned = false;
41224         int64_t ret_conv = NodeId_hash(&o_conv);
41225         return ret_conv;
41226 }
41227
41228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
41229         LDKNodeId obj_conv;
41230         obj_conv.inner = untag_ptr(obj);
41231         obj_conv.is_owned = ptr_is_owned(obj);
41232         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41233         obj_conv.is_owned = false;
41234         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
41235         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41236         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41237         CVec_u8Z_free(ret_var);
41238         return ret_arr;
41239 }
41240
41241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41242         LDKu8slice ser_ref;
41243         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41244         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41245         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
41246         *ret_conv = NodeId_read(ser_ref);
41247         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41248         return tag_ptr(ret_conv, true);
41249 }
41250
41251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41252         LDKNetworkGraph this_obj_conv;
41253         this_obj_conv.inner = untag_ptr(this_obj);
41254         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41256         NetworkGraph_free(this_obj_conv);
41257 }
41258
41259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41260         LDKReadOnlyNetworkGraph this_obj_conv;
41261         this_obj_conv.inner = untag_ptr(this_obj);
41262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41264         ReadOnlyNetworkGraph_free(this_obj_conv);
41265 }
41266
41267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41268         if (!ptr_is_owned(this_ptr)) return;
41269         void* this_ptr_ptr = untag_ptr(this_ptr);
41270         CHECK_ACCESS(this_ptr_ptr);
41271         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
41272         FREE(untag_ptr(this_ptr));
41273         NetworkUpdate_free(this_ptr_conv);
41274 }
41275
41276 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
41277         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41278         *ret_copy = NetworkUpdate_clone(arg);
41279         int64_t ret_ref = tag_ptr(ret_copy, true);
41280         return ret_ref;
41281 }
41282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41283         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
41284         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
41285         return ret_conv;
41286 }
41287
41288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41289         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
41290         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41291         *ret_copy = NetworkUpdate_clone(orig_conv);
41292         int64_t ret_ref = tag_ptr(ret_copy, true);
41293         return ret_ref;
41294 }
41295
41296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
41297         LDKChannelUpdate msg_conv;
41298         msg_conv.inner = untag_ptr(msg);
41299         msg_conv.is_owned = ptr_is_owned(msg);
41300         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41301         msg_conv = ChannelUpdate_clone(&msg_conv);
41302         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41303         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
41304         int64_t ret_ref = tag_ptr(ret_copy, true);
41305         return ret_ref;
41306 }
41307
41308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
41309         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41310         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
41311         int64_t ret_ref = tag_ptr(ret_copy, true);
41312         return ret_ref;
41313 }
41314
41315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
41316         LDKPublicKey node_id_ref;
41317         CHECK((*env)->GetArrayLength(env, node_id) == 33);
41318         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
41319         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41320         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
41321         int64_t ret_ref = tag_ptr(ret_copy, true);
41322         return ret_ref;
41323 }
41324
41325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
41326         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
41327         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
41328         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41329         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41330         CVec_u8Z_free(ret_var);
41331         return ret_arr;
41332 }
41333
41334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41335         LDKu8slice ser_ref;
41336         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41337         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41338         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
41339         *ret_conv = NetworkUpdate_read(ser_ref);
41340         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41341         return tag_ptr(ret_conv, true);
41342 }
41343
41344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41345         LDKP2PGossipSync this_obj_conv;
41346         this_obj_conv.inner = untag_ptr(this_obj);
41347         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41349         P2PGossipSync_free(this_obj_conv);
41350 }
41351
41352 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) {
41353         LDKNetworkGraph network_graph_conv;
41354         network_graph_conv.inner = untag_ptr(network_graph);
41355         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41356         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41357         network_graph_conv.is_owned = false;
41358         void* chain_access_ptr = untag_ptr(chain_access);
41359         CHECK_ACCESS(chain_access_ptr);
41360         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41361         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41362         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41363                 // Manually implement clone for Java trait instances
41364                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41365                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41366                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41367                 }
41368         }
41369         void* logger_ptr = untag_ptr(logger);
41370         CHECK_ACCESS(logger_ptr);
41371         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41372         if (logger_conv.free == LDKLogger_JCalls_free) {
41373                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41374                 LDKLogger_JCalls_cloned(&logger_conv);
41375         }
41376         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
41377         int64_t ret_ref = 0;
41378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41380         return ret_ref;
41381 }
41382
41383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
41384         LDKP2PGossipSync this_arg_conv;
41385         this_arg_conv.inner = untag_ptr(this_arg);
41386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41388         this_arg_conv.is_owned = false;
41389         void* chain_access_ptr = untag_ptr(chain_access);
41390         CHECK_ACCESS(chain_access_ptr);
41391         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41392         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41393         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41394                 // Manually implement clone for Java trait instances
41395                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41396                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41397                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41398                 }
41399         }
41400         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
41401 }
41402
41403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41404         LDKNetworkGraph this_arg_conv;
41405         this_arg_conv.inner = untag_ptr(this_arg);
41406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41408         this_arg_conv.is_owned = false;
41409         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
41410         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
41411         return tag_ptr(ret_ret, true);
41412 }
41413
41414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41415         LDKP2PGossipSync this_arg_conv;
41416         this_arg_conv.inner = untag_ptr(this_arg);
41417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41419         this_arg_conv.is_owned = false;
41420         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
41421         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
41422         return tag_ptr(ret_ret, true);
41423 }
41424
41425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41426         LDKP2PGossipSync this_arg_conv;
41427         this_arg_conv.inner = untag_ptr(this_arg);
41428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41430         this_arg_conv.is_owned = false;
41431         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41432         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
41433         return tag_ptr(ret_ret, true);
41434 }
41435
41436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41437         LDKChannelUpdateInfo this_obj_conv;
41438         this_obj_conv.inner = untag_ptr(this_obj);
41439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41441         ChannelUpdateInfo_free(this_obj_conv);
41442 }
41443
41444 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
41445         LDKChannelUpdateInfo this_ptr_conv;
41446         this_ptr_conv.inner = untag_ptr(this_ptr);
41447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41449         this_ptr_conv.is_owned = false;
41450         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
41451         return ret_conv;
41452 }
41453
41454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41455         LDKChannelUpdateInfo this_ptr_conv;
41456         this_ptr_conv.inner = untag_ptr(this_ptr);
41457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41459         this_ptr_conv.is_owned = false;
41460         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
41461 }
41462
41463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
41464         LDKChannelUpdateInfo this_ptr_conv;
41465         this_ptr_conv.inner = untag_ptr(this_ptr);
41466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41468         this_ptr_conv.is_owned = false;
41469         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
41470         return ret_conv;
41471 }
41472
41473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
41474         LDKChannelUpdateInfo this_ptr_conv;
41475         this_ptr_conv.inner = untag_ptr(this_ptr);
41476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41478         this_ptr_conv.is_owned = false;
41479         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
41480 }
41481
41482 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41483         LDKChannelUpdateInfo this_ptr_conv;
41484         this_ptr_conv.inner = untag_ptr(this_ptr);
41485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41487         this_ptr_conv.is_owned = false;
41488         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
41489         return ret_conv;
41490 }
41491
41492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41493         LDKChannelUpdateInfo this_ptr_conv;
41494         this_ptr_conv.inner = untag_ptr(this_ptr);
41495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41497         this_ptr_conv.is_owned = false;
41498         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
41499 }
41500
41501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41502         LDKChannelUpdateInfo this_ptr_conv;
41503         this_ptr_conv.inner = untag_ptr(this_ptr);
41504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41506         this_ptr_conv.is_owned = false;
41507         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
41508         return ret_conv;
41509 }
41510
41511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41512         LDKChannelUpdateInfo this_ptr_conv;
41513         this_ptr_conv.inner = untag_ptr(this_ptr);
41514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41516         this_ptr_conv.is_owned = false;
41517         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
41518 }
41519
41520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41521         LDKChannelUpdateInfo this_ptr_conv;
41522         this_ptr_conv.inner = untag_ptr(this_ptr);
41523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41525         this_ptr_conv.is_owned = false;
41526         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
41527         return ret_conv;
41528 }
41529
41530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41531         LDKChannelUpdateInfo this_ptr_conv;
41532         this_ptr_conv.inner = untag_ptr(this_ptr);
41533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41535         this_ptr_conv.is_owned = false;
41536         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
41537 }
41538
41539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
41540         LDKChannelUpdateInfo this_ptr_conv;
41541         this_ptr_conv.inner = untag_ptr(this_ptr);
41542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41544         this_ptr_conv.is_owned = false;
41545         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
41546         int64_t ret_ref = 0;
41547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41549         return ret_ref;
41550 }
41551
41552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41553         LDKChannelUpdateInfo this_ptr_conv;
41554         this_ptr_conv.inner = untag_ptr(this_ptr);
41555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41557         this_ptr_conv.is_owned = false;
41558         LDKRoutingFees val_conv;
41559         val_conv.inner = untag_ptr(val);
41560         val_conv.is_owned = ptr_is_owned(val);
41561         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41562         val_conv = RoutingFees_clone(&val_conv);
41563         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
41564 }
41565
41566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
41567         LDKChannelUpdateInfo this_ptr_conv;
41568         this_ptr_conv.inner = untag_ptr(this_ptr);
41569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41571         this_ptr_conv.is_owned = false;
41572         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
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 void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41580         LDKChannelUpdateInfo this_ptr_conv;
41581         this_ptr_conv.inner = untag_ptr(this_ptr);
41582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41584         this_ptr_conv.is_owned = false;
41585         LDKChannelUpdate val_conv;
41586         val_conv.inner = untag_ptr(val);
41587         val_conv.is_owned = ptr_is_owned(val);
41588         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41589         val_conv = ChannelUpdate_clone(&val_conv);
41590         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
41591 }
41592
41593 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) {
41594         LDKRoutingFees fees_arg_conv;
41595         fees_arg_conv.inner = untag_ptr(fees_arg);
41596         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
41597         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41598         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41599         LDKChannelUpdate last_update_message_arg_conv;
41600         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
41601         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
41602         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
41603         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
41604         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);
41605         int64_t ret_ref = 0;
41606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41608         return ret_ref;
41609 }
41610
41611 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
41612         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
41613         int64_t ret_ref = 0;
41614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41616         return ret_ref;
41617 }
41618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41619         LDKChannelUpdateInfo arg_conv;
41620         arg_conv.inner = untag_ptr(arg);
41621         arg_conv.is_owned = ptr_is_owned(arg);
41622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41623         arg_conv.is_owned = false;
41624         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
41625         return ret_conv;
41626 }
41627
41628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41629         LDKChannelUpdateInfo orig_conv;
41630         orig_conv.inner = untag_ptr(orig);
41631         orig_conv.is_owned = ptr_is_owned(orig);
41632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41633         orig_conv.is_owned = false;
41634         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
41635         int64_t ret_ref = 0;
41636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41638         return ret_ref;
41639 }
41640
41641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41642         LDKChannelUpdateInfo obj_conv;
41643         obj_conv.inner = untag_ptr(obj);
41644         obj_conv.is_owned = ptr_is_owned(obj);
41645         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41646         obj_conv.is_owned = false;
41647         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
41648         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41649         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41650         CVec_u8Z_free(ret_var);
41651         return ret_arr;
41652 }
41653
41654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41655         LDKu8slice ser_ref;
41656         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41657         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41658         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
41659         *ret_conv = ChannelUpdateInfo_read(ser_ref);
41660         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41661         return tag_ptr(ret_conv, true);
41662 }
41663
41664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41665         LDKChannelInfo this_obj_conv;
41666         this_obj_conv.inner = untag_ptr(this_obj);
41667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41669         ChannelInfo_free(this_obj_conv);
41670 }
41671
41672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41673         LDKChannelInfo this_ptr_conv;
41674         this_ptr_conv.inner = untag_ptr(this_ptr);
41675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41677         this_ptr_conv.is_owned = false;
41678         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
41679         int64_t ret_ref = 0;
41680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41682         return ret_ref;
41683 }
41684
41685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41686         LDKChannelInfo this_ptr_conv;
41687         this_ptr_conv.inner = untag_ptr(this_ptr);
41688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41690         this_ptr_conv.is_owned = false;
41691         LDKChannelFeatures val_conv;
41692         val_conv.inner = untag_ptr(val);
41693         val_conv.is_owned = ptr_is_owned(val);
41694         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41695         val_conv = ChannelFeatures_clone(&val_conv);
41696         ChannelInfo_set_features(&this_ptr_conv, val_conv);
41697 }
41698
41699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
41700         LDKChannelInfo this_ptr_conv;
41701         this_ptr_conv.inner = untag_ptr(this_ptr);
41702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41704         this_ptr_conv.is_owned = false;
41705         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
41706         int64_t ret_ref = 0;
41707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41709         return ret_ref;
41710 }
41711
41712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41713         LDKChannelInfo this_ptr_conv;
41714         this_ptr_conv.inner = untag_ptr(this_ptr);
41715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41717         this_ptr_conv.is_owned = false;
41718         LDKNodeId val_conv;
41719         val_conv.inner = untag_ptr(val);
41720         val_conv.is_owned = ptr_is_owned(val);
41721         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41722         val_conv = NodeId_clone(&val_conv);
41723         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
41724 }
41725
41726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
41727         LDKChannelInfo this_ptr_conv;
41728         this_ptr_conv.inner = untag_ptr(this_ptr);
41729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41731         this_ptr_conv.is_owned = false;
41732         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
41733         int64_t ret_ref = 0;
41734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41736         return ret_ref;
41737 }
41738
41739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41740         LDKChannelInfo this_ptr_conv;
41741         this_ptr_conv.inner = untag_ptr(this_ptr);
41742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41744         this_ptr_conv.is_owned = false;
41745         LDKChannelUpdateInfo val_conv;
41746         val_conv.inner = untag_ptr(val);
41747         val_conv.is_owned = ptr_is_owned(val);
41748         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41749         val_conv = ChannelUpdateInfo_clone(&val_conv);
41750         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
41751 }
41752
41753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
41754         LDKChannelInfo this_ptr_conv;
41755         this_ptr_conv.inner = untag_ptr(this_ptr);
41756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41758         this_ptr_conv.is_owned = false;
41759         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
41760         int64_t ret_ref = 0;
41761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41763         return ret_ref;
41764 }
41765
41766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41767         LDKChannelInfo this_ptr_conv;
41768         this_ptr_conv.inner = untag_ptr(this_ptr);
41769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41771         this_ptr_conv.is_owned = false;
41772         LDKNodeId val_conv;
41773         val_conv.inner = untag_ptr(val);
41774         val_conv.is_owned = ptr_is_owned(val);
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41776         val_conv = NodeId_clone(&val_conv);
41777         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
41778 }
41779
41780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
41781         LDKChannelInfo this_ptr_conv;
41782         this_ptr_conv.inner = untag_ptr(this_ptr);
41783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41785         this_ptr_conv.is_owned = false;
41786         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
41787         int64_t ret_ref = 0;
41788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41790         return ret_ref;
41791 }
41792
41793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41794         LDKChannelInfo this_ptr_conv;
41795         this_ptr_conv.inner = untag_ptr(this_ptr);
41796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41798         this_ptr_conv.is_owned = false;
41799         LDKChannelUpdateInfo val_conv;
41800         val_conv.inner = untag_ptr(val);
41801         val_conv.is_owned = ptr_is_owned(val);
41802         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41803         val_conv = ChannelUpdateInfo_clone(&val_conv);
41804         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
41805 }
41806
41807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
41808         LDKChannelInfo this_ptr_conv;
41809         this_ptr_conv.inner = untag_ptr(this_ptr);
41810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41812         this_ptr_conv.is_owned = false;
41813         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41814         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
41815         int64_t ret_ref = tag_ptr(ret_copy, true);
41816         return ret_ref;
41817 }
41818
41819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41820         LDKChannelInfo this_ptr_conv;
41821         this_ptr_conv.inner = untag_ptr(this_ptr);
41822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41824         this_ptr_conv.is_owned = false;
41825         void* val_ptr = untag_ptr(val);
41826         CHECK_ACCESS(val_ptr);
41827         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41828         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41829         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
41830 }
41831
41832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
41833         LDKChannelInfo this_ptr_conv;
41834         this_ptr_conv.inner = untag_ptr(this_ptr);
41835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41837         this_ptr_conv.is_owned = false;
41838         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
41839         int64_t ret_ref = 0;
41840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41842         return ret_ref;
41843 }
41844
41845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41846         LDKChannelInfo this_ptr_conv;
41847         this_ptr_conv.inner = untag_ptr(this_ptr);
41848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41850         this_ptr_conv.is_owned = false;
41851         LDKChannelAnnouncement val_conv;
41852         val_conv.inner = untag_ptr(val);
41853         val_conv.is_owned = ptr_is_owned(val);
41854         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41855         val_conv = ChannelAnnouncement_clone(&val_conv);
41856         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
41857 }
41858
41859 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
41860         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
41861         int64_t ret_ref = 0;
41862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41864         return ret_ref;
41865 }
41866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41867         LDKChannelInfo arg_conv;
41868         arg_conv.inner = untag_ptr(arg);
41869         arg_conv.is_owned = ptr_is_owned(arg);
41870         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41871         arg_conv.is_owned = false;
41872         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
41873         return ret_conv;
41874 }
41875
41876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41877         LDKChannelInfo orig_conv;
41878         orig_conv.inner = untag_ptr(orig);
41879         orig_conv.is_owned = ptr_is_owned(orig);
41880         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41881         orig_conv.is_owned = false;
41882         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
41883         int64_t ret_ref = 0;
41884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41886         return ret_ref;
41887 }
41888
41889 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) {
41890         LDKChannelInfo this_arg_conv;
41891         this_arg_conv.inner = untag_ptr(this_arg);
41892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41894         this_arg_conv.is_owned = false;
41895         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
41896         int64_t ret_ref = 0;
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41899         return ret_ref;
41900 }
41901
41902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41903         LDKChannelInfo obj_conv;
41904         obj_conv.inner = untag_ptr(obj);
41905         obj_conv.is_owned = ptr_is_owned(obj);
41906         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41907         obj_conv.is_owned = false;
41908         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
41909         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41910         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41911         CVec_u8Z_free(ret_var);
41912         return ret_arr;
41913 }
41914
41915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41916         LDKu8slice ser_ref;
41917         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41918         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41919         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
41920         *ret_conv = ChannelInfo_read(ser_ref);
41921         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41922         return tag_ptr(ret_conv, true);
41923 }
41924
41925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41926         LDKDirectedChannelInfo this_obj_conv;
41927         this_obj_conv.inner = untag_ptr(this_obj);
41928         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41930         DirectedChannelInfo_free(this_obj_conv);
41931 }
41932
41933 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
41934         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
41935         int64_t ret_ref = 0;
41936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41938         return ret_ref;
41939 }
41940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41941         LDKDirectedChannelInfo arg_conv;
41942         arg_conv.inner = untag_ptr(arg);
41943         arg_conv.is_owned = ptr_is_owned(arg);
41944         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41945         arg_conv.is_owned = false;
41946         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
41947         return ret_conv;
41948 }
41949
41950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41951         LDKDirectedChannelInfo orig_conv;
41952         orig_conv.inner = untag_ptr(orig);
41953         orig_conv.is_owned = ptr_is_owned(orig);
41954         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41955         orig_conv.is_owned = false;
41956         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
41957         int64_t ret_ref = 0;
41958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41960         return ret_ref;
41961 }
41962
41963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
41964         LDKDirectedChannelInfo this_arg_conv;
41965         this_arg_conv.inner = untag_ptr(this_arg);
41966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41968         this_arg_conv.is_owned = false;
41969         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
41970         int64_t ret_ref = 0;
41971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41973         return ret_ref;
41974 }
41975
41976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
41977         LDKDirectedChannelInfo this_arg_conv;
41978         this_arg_conv.inner = untag_ptr(this_arg);
41979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41981         this_arg_conv.is_owned = false;
41982         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
41983         int64_t ret_ref = 0;
41984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41986         return ret_ref;
41987 }
41988
41989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
41990         LDKDirectedChannelInfo this_arg_conv;
41991         this_arg_conv.inner = untag_ptr(this_arg);
41992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41994         this_arg_conv.is_owned = false;
41995         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
41996         return ret_conv;
41997 }
41998
41999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
42000         LDKDirectedChannelInfo 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         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42006         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
42007         int64_t ret_ref = tag_ptr(ret_copy, true);
42008         return ret_ref;
42009 }
42010
42011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42012         if (!ptr_is_owned(this_ptr)) return;
42013         void* this_ptr_ptr = untag_ptr(this_ptr);
42014         CHECK_ACCESS(this_ptr_ptr);
42015         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
42016         FREE(untag_ptr(this_ptr));
42017         EffectiveCapacity_free(this_ptr_conv);
42018 }
42019
42020 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
42021         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42022         *ret_copy = EffectiveCapacity_clone(arg);
42023         int64_t ret_ref = tag_ptr(ret_copy, true);
42024         return ret_ref;
42025 }
42026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42027         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
42028         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
42029         return ret_conv;
42030 }
42031
42032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42033         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
42034         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42035         *ret_copy = EffectiveCapacity_clone(orig_conv);
42036         int64_t ret_ref = tag_ptr(ret_copy, true);
42037         return ret_ref;
42038 }
42039
42040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
42041         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42042         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
42043         int64_t ret_ref = tag_ptr(ret_copy, true);
42044         return ret_ref;
42045 }
42046
42047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
42048         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42049         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
42050         int64_t ret_ref = tag_ptr(ret_copy, true);
42051         return ret_ref;
42052 }
42053
42054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
42055         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
42056         CHECK_ACCESS(htlc_maximum_msat_ptr);
42057         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
42058         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
42059         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42060         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
42061         int64_t ret_ref = tag_ptr(ret_copy, true);
42062         return ret_ref;
42063 }
42064
42065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
42066         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42067         *ret_copy = EffectiveCapacity_infinite();
42068         int64_t ret_ref = tag_ptr(ret_copy, true);
42069         return ret_ref;
42070 }
42071
42072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
42073         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42074         *ret_copy = EffectiveCapacity_unknown();
42075         int64_t ret_ref = tag_ptr(ret_copy, true);
42076         return ret_ref;
42077 }
42078
42079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42080         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
42081         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
42082         return ret_conv;
42083 }
42084
42085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42086         LDKRoutingFees this_obj_conv;
42087         this_obj_conv.inner = untag_ptr(this_obj);
42088         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42090         RoutingFees_free(this_obj_conv);
42091 }
42092
42093 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42094         LDKRoutingFees this_ptr_conv;
42095         this_ptr_conv.inner = untag_ptr(this_ptr);
42096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42098         this_ptr_conv.is_owned = false;
42099         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
42100         return ret_conv;
42101 }
42102
42103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42104         LDKRoutingFees this_ptr_conv;
42105         this_ptr_conv.inner = untag_ptr(this_ptr);
42106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42108         this_ptr_conv.is_owned = false;
42109         RoutingFees_set_base_msat(&this_ptr_conv, val);
42110 }
42111
42112 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42113         LDKRoutingFees this_ptr_conv;
42114         this_ptr_conv.inner = untag_ptr(this_ptr);
42115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42117         this_ptr_conv.is_owned = false;
42118         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
42119         return ret_conv;
42120 }
42121
42122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42123         LDKRoutingFees this_ptr_conv;
42124         this_ptr_conv.inner = untag_ptr(this_ptr);
42125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42127         this_ptr_conv.is_owned = false;
42128         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
42129 }
42130
42131 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) {
42132         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
42133         int64_t ret_ref = 0;
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42136         return ret_ref;
42137 }
42138
42139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42140         LDKRoutingFees a_conv;
42141         a_conv.inner = untag_ptr(a);
42142         a_conv.is_owned = ptr_is_owned(a);
42143         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42144         a_conv.is_owned = false;
42145         LDKRoutingFees b_conv;
42146         b_conv.inner = untag_ptr(b);
42147         b_conv.is_owned = ptr_is_owned(b);
42148         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42149         b_conv.is_owned = false;
42150         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
42151         return ret_conv;
42152 }
42153
42154 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
42155         LDKRoutingFees ret_var = RoutingFees_clone(arg);
42156         int64_t ret_ref = 0;
42157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42159         return ret_ref;
42160 }
42161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42162         LDKRoutingFees arg_conv;
42163         arg_conv.inner = untag_ptr(arg);
42164         arg_conv.is_owned = ptr_is_owned(arg);
42165         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42166         arg_conv.is_owned = false;
42167         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
42168         return ret_conv;
42169 }
42170
42171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42172         LDKRoutingFees orig_conv;
42173         orig_conv.inner = untag_ptr(orig);
42174         orig_conv.is_owned = ptr_is_owned(orig);
42175         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42176         orig_conv.is_owned = false;
42177         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
42178         int64_t ret_ref = 0;
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42181         return ret_ref;
42182 }
42183
42184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
42185         LDKRoutingFees o_conv;
42186         o_conv.inner = untag_ptr(o);
42187         o_conv.is_owned = ptr_is_owned(o);
42188         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42189         o_conv.is_owned = false;
42190         int64_t ret_conv = RoutingFees_hash(&o_conv);
42191         return ret_conv;
42192 }
42193
42194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
42195         LDKRoutingFees obj_conv;
42196         obj_conv.inner = untag_ptr(obj);
42197         obj_conv.is_owned = ptr_is_owned(obj);
42198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42199         obj_conv.is_owned = false;
42200         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
42201         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42202         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42203         CVec_u8Z_free(ret_var);
42204         return ret_arr;
42205 }
42206
42207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42208         LDKu8slice ser_ref;
42209         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42210         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42211         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
42212         *ret_conv = RoutingFees_read(ser_ref);
42213         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42214         return tag_ptr(ret_conv, true);
42215 }
42216
42217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42218         LDKNodeAnnouncementInfo this_obj_conv;
42219         this_obj_conv.inner = untag_ptr(this_obj);
42220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42222         NodeAnnouncementInfo_free(this_obj_conv);
42223 }
42224
42225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42226         LDKNodeAnnouncementInfo this_ptr_conv;
42227         this_ptr_conv.inner = untag_ptr(this_ptr);
42228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42230         this_ptr_conv.is_owned = false;
42231         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
42232         int64_t ret_ref = 0;
42233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42235         return ret_ref;
42236 }
42237
42238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42239         LDKNodeAnnouncementInfo this_ptr_conv;
42240         this_ptr_conv.inner = untag_ptr(this_ptr);
42241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42243         this_ptr_conv.is_owned = false;
42244         LDKNodeFeatures val_conv;
42245         val_conv.inner = untag_ptr(val);
42246         val_conv.is_owned = ptr_is_owned(val);
42247         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42248         val_conv = NodeFeatures_clone(&val_conv);
42249         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
42250 }
42251
42252 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
42253         LDKNodeAnnouncementInfo this_ptr_conv;
42254         this_ptr_conv.inner = untag_ptr(this_ptr);
42255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42257         this_ptr_conv.is_owned = false;
42258         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
42259         return ret_conv;
42260 }
42261
42262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42263         LDKNodeAnnouncementInfo this_ptr_conv;
42264         this_ptr_conv.inner = untag_ptr(this_ptr);
42265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42267         this_ptr_conv.is_owned = false;
42268         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
42269 }
42270
42271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
42272         LDKNodeAnnouncementInfo this_ptr_conv;
42273         this_ptr_conv.inner = untag_ptr(this_ptr);
42274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42276         this_ptr_conv.is_owned = false;
42277         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
42278         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
42279         return ret_arr;
42280 }
42281
42282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42283         LDKNodeAnnouncementInfo this_ptr_conv;
42284         this_ptr_conv.inner = untag_ptr(this_ptr);
42285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42287         this_ptr_conv.is_owned = false;
42288         LDKThreeBytes val_ref;
42289         CHECK((*env)->GetArrayLength(env, val) == 3);
42290         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
42291         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
42292 }
42293
42294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42295         LDKNodeAnnouncementInfo this_ptr_conv;
42296         this_ptr_conv.inner = untag_ptr(this_ptr);
42297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42299         this_ptr_conv.is_owned = false;
42300         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
42301         int64_t ret_ref = 0;
42302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42304         return ret_ref;
42305 }
42306
42307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42308         LDKNodeAnnouncementInfo this_ptr_conv;
42309         this_ptr_conv.inner = untag_ptr(this_ptr);
42310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42312         this_ptr_conv.is_owned = false;
42313         LDKNodeAlias val_conv;
42314         val_conv.inner = untag_ptr(val);
42315         val_conv.is_owned = ptr_is_owned(val);
42316         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42317         val_conv = NodeAlias_clone(&val_conv);
42318         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
42319 }
42320
42321 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
42322         LDKNodeAnnouncementInfo this_ptr_conv;
42323         this_ptr_conv.inner = untag_ptr(this_ptr);
42324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42326         this_ptr_conv.is_owned = false;
42327         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
42328         int64_tArray ret_arr = NULL;
42329         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42330         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42331         for (size_t m = 0; m < ret_var.datalen; m++) {
42332                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
42333                 *ret_conv_12_copy = ret_var.data[m];
42334                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
42335                 ret_arr_ptr[m] = ret_conv_12_ref;
42336         }
42337         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42338         FREE(ret_var.data);
42339         return ret_arr;
42340 }
42341
42342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42343         LDKNodeAnnouncementInfo this_ptr_conv;
42344         this_ptr_conv.inner = untag_ptr(this_ptr);
42345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42347         this_ptr_conv.is_owned = false;
42348         LDKCVec_NetAddressZ val_constr;
42349         val_constr.datalen = (*env)->GetArrayLength(env, val);
42350         if (val_constr.datalen > 0)
42351                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42352         else
42353                 val_constr.data = NULL;
42354         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42355         for (size_t m = 0; m < val_constr.datalen; m++) {
42356                 int64_t val_conv_12 = val_vals[m];
42357                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
42358                 CHECK_ACCESS(val_conv_12_ptr);
42359                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
42360                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
42361                 val_constr.data[m] = val_conv_12_conv;
42362         }
42363         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42364         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
42365 }
42366
42367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42368         LDKNodeAnnouncementInfo this_ptr_conv;
42369         this_ptr_conv.inner = untag_ptr(this_ptr);
42370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42372         this_ptr_conv.is_owned = false;
42373         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
42374         int64_t ret_ref = 0;
42375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42377         return ret_ref;
42378 }
42379
42380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42381         LDKNodeAnnouncementInfo this_ptr_conv;
42382         this_ptr_conv.inner = untag_ptr(this_ptr);
42383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42385         this_ptr_conv.is_owned = false;
42386         LDKNodeAnnouncement val_conv;
42387         val_conv.inner = untag_ptr(val);
42388         val_conv.is_owned = ptr_is_owned(val);
42389         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42390         val_conv = NodeAnnouncement_clone(&val_conv);
42391         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
42392 }
42393
42394 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) {
42395         LDKNodeFeatures features_arg_conv;
42396         features_arg_conv.inner = untag_ptr(features_arg);
42397         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42398         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42399         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
42400         LDKThreeBytes rgb_arg_ref;
42401         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
42402         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
42403         LDKNodeAlias alias_arg_conv;
42404         alias_arg_conv.inner = untag_ptr(alias_arg);
42405         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
42406         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
42407         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
42408         LDKCVec_NetAddressZ addresses_arg_constr;
42409         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
42410         if (addresses_arg_constr.datalen > 0)
42411                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42412         else
42413                 addresses_arg_constr.data = NULL;
42414         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
42415         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
42416                 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
42417                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
42418                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
42419                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
42420                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
42421         }
42422         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
42423         LDKNodeAnnouncement announcement_message_arg_conv;
42424         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
42425         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
42426         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
42427         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
42428         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
42429         int64_t ret_ref = 0;
42430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42432         return ret_ref;
42433 }
42434
42435 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
42436         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
42437         int64_t ret_ref = 0;
42438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42440         return ret_ref;
42441 }
42442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42443         LDKNodeAnnouncementInfo arg_conv;
42444         arg_conv.inner = untag_ptr(arg);
42445         arg_conv.is_owned = ptr_is_owned(arg);
42446         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42447         arg_conv.is_owned = false;
42448         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
42449         return ret_conv;
42450 }
42451
42452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42453         LDKNodeAnnouncementInfo orig_conv;
42454         orig_conv.inner = untag_ptr(orig);
42455         orig_conv.is_owned = ptr_is_owned(orig);
42456         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42457         orig_conv.is_owned = false;
42458         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
42459         int64_t ret_ref = 0;
42460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42462         return ret_ref;
42463 }
42464
42465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42466         LDKNodeAnnouncementInfo obj_conv;
42467         obj_conv.inner = untag_ptr(obj);
42468         obj_conv.is_owned = ptr_is_owned(obj);
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42470         obj_conv.is_owned = false;
42471         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
42472         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42473         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42474         CVec_u8Z_free(ret_var);
42475         return ret_arr;
42476 }
42477
42478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42479         LDKu8slice ser_ref;
42480         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42481         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42482         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
42483         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
42484         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42485         return tag_ptr(ret_conv, true);
42486 }
42487
42488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42489         LDKNodeAlias this_obj_conv;
42490         this_obj_conv.inner = untag_ptr(this_obj);
42491         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42493         NodeAlias_free(this_obj_conv);
42494 }
42495
42496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
42497         LDKNodeAlias this_ptr_conv;
42498         this_ptr_conv.inner = untag_ptr(this_ptr);
42499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42501         this_ptr_conv.is_owned = false;
42502         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42503         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
42504         return ret_arr;
42505 }
42506
42507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42508         LDKNodeAlias this_ptr_conv;
42509         this_ptr_conv.inner = untag_ptr(this_ptr);
42510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42512         this_ptr_conv.is_owned = false;
42513         LDKThirtyTwoBytes val_ref;
42514         CHECK((*env)->GetArrayLength(env, val) == 32);
42515         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42516         NodeAlias_set_a(&this_ptr_conv, val_ref);
42517 }
42518
42519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
42520         LDKThirtyTwoBytes a_arg_ref;
42521         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
42522         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
42523         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
42524         int64_t ret_ref = 0;
42525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42527         return ret_ref;
42528 }
42529
42530 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
42531         LDKNodeAlias ret_var = NodeAlias_clone(arg);
42532         int64_t ret_ref = 0;
42533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42535         return ret_ref;
42536 }
42537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42538         LDKNodeAlias arg_conv;
42539         arg_conv.inner = untag_ptr(arg);
42540         arg_conv.is_owned = ptr_is_owned(arg);
42541         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42542         arg_conv.is_owned = false;
42543         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
42544         return ret_conv;
42545 }
42546
42547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42548         LDKNodeAlias orig_conv;
42549         orig_conv.inner = untag_ptr(orig);
42550         orig_conv.is_owned = ptr_is_owned(orig);
42551         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42552         orig_conv.is_owned = false;
42553         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
42554         int64_t ret_ref = 0;
42555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42557         return ret_ref;
42558 }
42559
42560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
42561         LDKNodeAlias obj_conv;
42562         obj_conv.inner = untag_ptr(obj);
42563         obj_conv.is_owned = ptr_is_owned(obj);
42564         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42565         obj_conv.is_owned = false;
42566         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
42567         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42568         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42569         CVec_u8Z_free(ret_var);
42570         return ret_arr;
42571 }
42572
42573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42574         LDKu8slice ser_ref;
42575         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42576         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42577         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
42578         *ret_conv = NodeAlias_read(ser_ref);
42579         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42580         return tag_ptr(ret_conv, true);
42581 }
42582
42583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42584         LDKNodeInfo this_obj_conv;
42585         this_obj_conv.inner = untag_ptr(this_obj);
42586         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42588         NodeInfo_free(this_obj_conv);
42589 }
42590
42591 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
42592         LDKNodeInfo this_ptr_conv;
42593         this_ptr_conv.inner = untag_ptr(this_ptr);
42594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42596         this_ptr_conv.is_owned = false;
42597         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
42598         int64_tArray ret_arr = NULL;
42599         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42600         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42601         for (size_t g = 0; g < ret_var.datalen; g++) {
42602                 int64_t ret_conv_6_conv = ret_var.data[g];
42603                 ret_arr_ptr[g] = ret_conv_6_conv;
42604         }
42605         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42606         FREE(ret_var.data);
42607         return ret_arr;
42608 }
42609
42610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42611         LDKNodeInfo this_ptr_conv;
42612         this_ptr_conv.inner = untag_ptr(this_ptr);
42613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42615         this_ptr_conv.is_owned = false;
42616         LDKCVec_u64Z val_constr;
42617         val_constr.datalen = (*env)->GetArrayLength(env, val);
42618         if (val_constr.datalen > 0)
42619                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42620         else
42621                 val_constr.data = NULL;
42622         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42623         for (size_t g = 0; g < val_constr.datalen; g++) {
42624                 int64_t val_conv_6 = val_vals[g];
42625                 val_constr.data[g] = val_conv_6;
42626         }
42627         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42628         NodeInfo_set_channels(&this_ptr_conv, val_constr);
42629 }
42630
42631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
42632         LDKNodeInfo this_ptr_conv;
42633         this_ptr_conv.inner = untag_ptr(this_ptr);
42634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42636         this_ptr_conv.is_owned = false;
42637         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
42638         int64_t ret_ref = 0;
42639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42641         return ret_ref;
42642 }
42643
42644 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) {
42645         LDKNodeInfo this_ptr_conv;
42646         this_ptr_conv.inner = untag_ptr(this_ptr);
42647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42649         this_ptr_conv.is_owned = false;
42650         LDKRoutingFees val_conv;
42651         val_conv.inner = untag_ptr(val);
42652         val_conv.is_owned = ptr_is_owned(val);
42653         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42654         val_conv = RoutingFees_clone(&val_conv);
42655         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
42656 }
42657
42658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
42659         LDKNodeInfo this_ptr_conv;
42660         this_ptr_conv.inner = untag_ptr(this_ptr);
42661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42663         this_ptr_conv.is_owned = false;
42664         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
42665         int64_t ret_ref = 0;
42666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42668         return ret_ref;
42669 }
42670
42671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42672         LDKNodeInfo this_ptr_conv;
42673         this_ptr_conv.inner = untag_ptr(this_ptr);
42674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42676         this_ptr_conv.is_owned = false;
42677         LDKNodeAnnouncementInfo val_conv;
42678         val_conv.inner = untag_ptr(val);
42679         val_conv.is_owned = ptr_is_owned(val);
42680         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42681         val_conv = NodeAnnouncementInfo_clone(&val_conv);
42682         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
42683 }
42684
42685 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) {
42686         LDKCVec_u64Z channels_arg_constr;
42687         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
42688         if (channels_arg_constr.datalen > 0)
42689                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42690         else
42691                 channels_arg_constr.data = NULL;
42692         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
42693         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
42694                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
42695                 channels_arg_constr.data[g] = channels_arg_conv_6;
42696         }
42697         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
42698         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
42699         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
42700         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
42701         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
42702         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
42703         LDKNodeAnnouncementInfo announcement_info_arg_conv;
42704         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
42705         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
42706         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
42707         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
42708         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
42709         int64_t ret_ref = 0;
42710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42712         return ret_ref;
42713 }
42714
42715 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
42716         LDKNodeInfo ret_var = NodeInfo_clone(arg);
42717         int64_t ret_ref = 0;
42718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42720         return ret_ref;
42721 }
42722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42723         LDKNodeInfo arg_conv;
42724         arg_conv.inner = untag_ptr(arg);
42725         arg_conv.is_owned = ptr_is_owned(arg);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42727         arg_conv.is_owned = false;
42728         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
42729         return ret_conv;
42730 }
42731
42732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42733         LDKNodeInfo orig_conv;
42734         orig_conv.inner = untag_ptr(orig);
42735         orig_conv.is_owned = ptr_is_owned(orig);
42736         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42737         orig_conv.is_owned = false;
42738         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
42739         int64_t ret_ref = 0;
42740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42742         return ret_ref;
42743 }
42744
42745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42746         LDKNodeInfo obj_conv;
42747         obj_conv.inner = untag_ptr(obj);
42748         obj_conv.is_owned = ptr_is_owned(obj);
42749         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42750         obj_conv.is_owned = false;
42751         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
42752         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42753         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42754         CVec_u8Z_free(ret_var);
42755         return ret_arr;
42756 }
42757
42758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42759         LDKu8slice ser_ref;
42760         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42761         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42762         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
42763         *ret_conv = NodeInfo_read(ser_ref);
42764         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42765         return tag_ptr(ret_conv, true);
42766 }
42767
42768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
42769         LDKNetworkGraph obj_conv;
42770         obj_conv.inner = untag_ptr(obj);
42771         obj_conv.is_owned = ptr_is_owned(obj);
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42773         obj_conv.is_owned = false;
42774         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
42775         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42776         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42777         CVec_u8Z_free(ret_var);
42778         return ret_arr;
42779 }
42780
42781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
42782         LDKu8slice ser_ref;
42783         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42784         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42785         void* arg_ptr = untag_ptr(arg);
42786         CHECK_ACCESS(arg_ptr);
42787         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
42788         if (arg_conv.free == LDKLogger_JCalls_free) {
42789                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42790                 LDKLogger_JCalls_cloned(&arg_conv);
42791         }
42792         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
42793         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
42794         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42795         return tag_ptr(ret_conv, true);
42796 }
42797
42798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
42799         LDKThirtyTwoBytes genesis_hash_ref;
42800         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
42801         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
42802         void* logger_ptr = untag_ptr(logger);
42803         CHECK_ACCESS(logger_ptr);
42804         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42805         if (logger_conv.free == LDKLogger_JCalls_free) {
42806                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42807                 LDKLogger_JCalls_cloned(&logger_conv);
42808         }
42809         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
42810         int64_t ret_ref = 0;
42811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42813         return ret_ref;
42814 }
42815
42816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
42817         LDKNetworkGraph 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         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
42823         int64_t ret_ref = 0;
42824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42826         return ret_ref;
42827 }
42828
42829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
42830         LDKNetworkGraph this_arg_conv;
42831         this_arg_conv.inner = untag_ptr(this_arg);
42832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42834         this_arg_conv.is_owned = false;
42835         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
42836         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
42837         int64_t ret_ref = tag_ptr(ret_copy, true);
42838         return ret_ref;
42839 }
42840
42841 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) {
42842         LDKNetworkGraph this_arg_conv;
42843         this_arg_conv.inner = untag_ptr(this_arg);
42844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42846         this_arg_conv.is_owned = false;
42847         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
42848 }
42849
42850 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) {
42851         LDKNetworkGraph this_arg_conv;
42852         this_arg_conv.inner = untag_ptr(this_arg);
42853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42855         this_arg_conv.is_owned = false;
42856         LDKNodeAnnouncement msg_conv;
42857         msg_conv.inner = untag_ptr(msg);
42858         msg_conv.is_owned = ptr_is_owned(msg);
42859         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42860         msg_conv.is_owned = false;
42861         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42862         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
42863         return tag_ptr(ret_conv, true);
42864 }
42865
42866 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) {
42867         LDKNetworkGraph this_arg_conv;
42868         this_arg_conv.inner = untag_ptr(this_arg);
42869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42871         this_arg_conv.is_owned = false;
42872         LDKUnsignedNodeAnnouncement msg_conv;
42873         msg_conv.inner = untag_ptr(msg);
42874         msg_conv.is_owned = ptr_is_owned(msg);
42875         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42876         msg_conv.is_owned = false;
42877         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42878         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
42879         return tag_ptr(ret_conv, true);
42880 }
42881
42882 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) {
42883         LDKNetworkGraph 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         LDKChannelAnnouncement msg_conv;
42889         msg_conv.inner = untag_ptr(msg);
42890         msg_conv.is_owned = ptr_is_owned(msg);
42891         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42892         msg_conv.is_owned = false;
42893         void* chain_access_ptr = untag_ptr(chain_access);
42894         CHECK_ACCESS(chain_access_ptr);
42895         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
42896         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
42897         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
42898                 // Manually implement clone for Java trait instances
42899                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
42900                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42901                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
42902                 }
42903         }
42904         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42905         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
42906         return tag_ptr(ret_conv, true);
42907 }
42908
42909 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) {
42910         LDKNetworkGraph this_arg_conv;
42911         this_arg_conv.inner = untag_ptr(this_arg);
42912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42914         this_arg_conv.is_owned = false;
42915         LDKUnsignedChannelAnnouncement msg_conv;
42916         msg_conv.inner = untag_ptr(msg);
42917         msg_conv.is_owned = ptr_is_owned(msg);
42918         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42919         msg_conv.is_owned = false;
42920         void* chain_access_ptr = untag_ptr(chain_access);
42921         CHECK_ACCESS(chain_access_ptr);
42922         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
42923         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
42924         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
42925                 // Manually implement clone for Java trait instances
42926                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
42927                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42928                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
42929                 }
42930         }
42931         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42932         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
42933         return tag_ptr(ret_conv, true);
42934 }
42935
42936 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) {
42937         LDKNetworkGraph this_arg_conv;
42938         this_arg_conv.inner = untag_ptr(this_arg);
42939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42941         this_arg_conv.is_owned = false;
42942         LDKChannelFeatures features_conv;
42943         features_conv.inner = untag_ptr(features);
42944         features_conv.is_owned = ptr_is_owned(features);
42945         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
42946         features_conv = ChannelFeatures_clone(&features_conv);
42947         LDKPublicKey node_id_1_ref;
42948         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
42949         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
42950         LDKPublicKey node_id_2_ref;
42951         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
42952         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
42953         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
42954         *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);
42955         return tag_ptr(ret_conv, true);
42956 }
42957
42958 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) {
42959         LDKNetworkGraph 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         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
42965 }
42966
42967 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) {
42968         LDKNetworkGraph this_arg_conv;
42969         this_arg_conv.inner = untag_ptr(this_arg);
42970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42972         this_arg_conv.is_owned = false;
42973         LDKPublicKey _node_id_ref;
42974         CHECK((*env)->GetArrayLength(env, _node_id) == 33);
42975         (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
42976         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
42977 }
42978
42979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
42980         LDKNetworkGraph this_arg_conv;
42981         this_arg_conv.inner = untag_ptr(this_arg);
42982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42984         this_arg_conv.is_owned = false;
42985         NetworkGraph_remove_stale_channels(&this_arg_conv);
42986 }
42987
42988 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) {
42989         LDKNetworkGraph this_arg_conv;
42990         this_arg_conv.inner = untag_ptr(this_arg);
42991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42993         this_arg_conv.is_owned = false;
42994         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
42995 }
42996
42997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
42998         LDKNetworkGraph this_arg_conv;
42999         this_arg_conv.inner = untag_ptr(this_arg);
43000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43002         this_arg_conv.is_owned = false;
43003         LDKChannelUpdate msg_conv;
43004         msg_conv.inner = untag_ptr(msg);
43005         msg_conv.is_owned = ptr_is_owned(msg);
43006         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43007         msg_conv.is_owned = false;
43008         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43009         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
43010         return tag_ptr(ret_conv, true);
43011 }
43012
43013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43014         LDKNetworkGraph this_arg_conv;
43015         this_arg_conv.inner = untag_ptr(this_arg);
43016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43018         this_arg_conv.is_owned = false;
43019         LDKUnsignedChannelUpdate msg_conv;
43020         msg_conv.inner = untag_ptr(msg);
43021         msg_conv.is_owned = ptr_is_owned(msg);
43022         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43023         msg_conv.is_owned = false;
43024         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43025         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
43026         return tag_ptr(ret_conv, true);
43027 }
43028
43029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
43030         LDKReadOnlyNetworkGraph this_arg_conv;
43031         this_arg_conv.inner = untag_ptr(this_arg);
43032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43034         this_arg_conv.is_owned = false;
43035         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
43036         int64_t ret_ref = 0;
43037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43039         return ret_ref;
43040 }
43041
43042 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43043         LDKReadOnlyNetworkGraph this_arg_conv;
43044         this_arg_conv.inner = untag_ptr(this_arg);
43045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43047         this_arg_conv.is_owned = false;
43048         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
43049         int64_tArray ret_arr = NULL;
43050         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43051         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43052         for (size_t g = 0; g < ret_var.datalen; g++) {
43053                 int64_t ret_conv_6_conv = ret_var.data[g];
43054                 ret_arr_ptr[g] = ret_conv_6_conv;
43055         }
43056         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43057         FREE(ret_var.data);
43058         return ret_arr;
43059 }
43060
43061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
43062         LDKReadOnlyNetworkGraph this_arg_conv;
43063         this_arg_conv.inner = untag_ptr(this_arg);
43064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43066         this_arg_conv.is_owned = false;
43067         LDKNodeId node_id_conv;
43068         node_id_conv.inner = untag_ptr(node_id);
43069         node_id_conv.is_owned = ptr_is_owned(node_id);
43070         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43071         node_id_conv.is_owned = false;
43072         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
43073         int64_t ret_ref = 0;
43074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43076         return ret_ref;
43077 }
43078
43079 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
43080         LDKReadOnlyNetworkGraph this_arg_conv;
43081         this_arg_conv.inner = untag_ptr(this_arg);
43082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43084         this_arg_conv.is_owned = false;
43085         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
43086         int64_tArray ret_arr = NULL;
43087         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43088         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43089         for (size_t i = 0; i < ret_var.datalen; i++) {
43090                 LDKNodeId ret_conv_8_var = ret_var.data[i];
43091                 int64_t ret_conv_8_ref = 0;
43092                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
43093                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
43094                 ret_arr_ptr[i] = ret_conv_8_ref;
43095         }
43096         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43097         FREE(ret_var.data);
43098         return ret_arr;
43099 }
43100
43101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
43102         LDKReadOnlyNetworkGraph this_arg_conv;
43103         this_arg_conv.inner = untag_ptr(this_arg);
43104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43106         this_arg_conv.is_owned = false;
43107         LDKPublicKey pubkey_ref;
43108         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
43109         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
43110         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
43111         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
43112         int64_t ret_ref = tag_ptr(ret_copy, true);
43113         return ret_ref;
43114 }
43115
43116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43117         LDKRouteHop this_obj_conv;
43118         this_obj_conv.inner = untag_ptr(this_obj);
43119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43121         RouteHop_free(this_obj_conv);
43122 }
43123
43124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43125         LDKRouteHop this_ptr_conv;
43126         this_ptr_conv.inner = untag_ptr(this_ptr);
43127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43129         this_ptr_conv.is_owned = false;
43130         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43131         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
43132         return ret_arr;
43133 }
43134
43135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43136         LDKRouteHop this_ptr_conv;
43137         this_ptr_conv.inner = untag_ptr(this_ptr);
43138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43140         this_ptr_conv.is_owned = false;
43141         LDKPublicKey val_ref;
43142         CHECK((*env)->GetArrayLength(env, val) == 33);
43143         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43144         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
43145 }
43146
43147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43148         LDKRouteHop this_ptr_conv;
43149         this_ptr_conv.inner = untag_ptr(this_ptr);
43150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43152         this_ptr_conv.is_owned = false;
43153         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
43154         int64_t ret_ref = 0;
43155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43157         return ret_ref;
43158 }
43159
43160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43161         LDKRouteHop this_ptr_conv;
43162         this_ptr_conv.inner = untag_ptr(this_ptr);
43163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43165         this_ptr_conv.is_owned = false;
43166         LDKNodeFeatures val_conv;
43167         val_conv.inner = untag_ptr(val);
43168         val_conv.is_owned = ptr_is_owned(val);
43169         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43170         val_conv = NodeFeatures_clone(&val_conv);
43171         RouteHop_set_node_features(&this_ptr_conv, val_conv);
43172 }
43173
43174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43175         LDKRouteHop this_ptr_conv;
43176         this_ptr_conv.inner = untag_ptr(this_ptr);
43177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43179         this_ptr_conv.is_owned = false;
43180         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
43181         return ret_conv;
43182 }
43183
43184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43185         LDKRouteHop this_ptr_conv;
43186         this_ptr_conv.inner = untag_ptr(this_ptr);
43187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43189         this_ptr_conv.is_owned = false;
43190         RouteHop_set_short_channel_id(&this_ptr_conv, val);
43191 }
43192
43193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43194         LDKRouteHop this_ptr_conv;
43195         this_ptr_conv.inner = untag_ptr(this_ptr);
43196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43198         this_ptr_conv.is_owned = false;
43199         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
43200         int64_t ret_ref = 0;
43201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43203         return ret_ref;
43204 }
43205
43206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43207         LDKRouteHop this_ptr_conv;
43208         this_ptr_conv.inner = untag_ptr(this_ptr);
43209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43211         this_ptr_conv.is_owned = false;
43212         LDKChannelFeatures val_conv;
43213         val_conv.inner = untag_ptr(val);
43214         val_conv.is_owned = ptr_is_owned(val);
43215         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43216         val_conv = ChannelFeatures_clone(&val_conv);
43217         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
43218 }
43219
43220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43221         LDKRouteHop this_ptr_conv;
43222         this_ptr_conv.inner = untag_ptr(this_ptr);
43223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43225         this_ptr_conv.is_owned = false;
43226         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
43227         return ret_conv;
43228 }
43229
43230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43231         LDKRouteHop this_ptr_conv;
43232         this_ptr_conv.inner = untag_ptr(this_ptr);
43233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43235         this_ptr_conv.is_owned = false;
43236         RouteHop_set_fee_msat(&this_ptr_conv, val);
43237 }
43238
43239 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43240         LDKRouteHop this_ptr_conv;
43241         this_ptr_conv.inner = untag_ptr(this_ptr);
43242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43244         this_ptr_conv.is_owned = false;
43245         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
43246         return ret_conv;
43247 }
43248
43249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43250         LDKRouteHop this_ptr_conv;
43251         this_ptr_conv.inner = untag_ptr(this_ptr);
43252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43254         this_ptr_conv.is_owned = false;
43255         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43256 }
43257
43258 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) {
43259         LDKPublicKey pubkey_arg_ref;
43260         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
43261         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
43262         LDKNodeFeatures node_features_arg_conv;
43263         node_features_arg_conv.inner = untag_ptr(node_features_arg);
43264         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
43266         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
43267         LDKChannelFeatures channel_features_arg_conv;
43268         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
43269         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
43270         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
43271         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
43272         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);
43273         int64_t ret_ref = 0;
43274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43276         return ret_ref;
43277 }
43278
43279 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
43280         LDKRouteHop ret_var = RouteHop_clone(arg);
43281         int64_t ret_ref = 0;
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43284         return ret_ref;
43285 }
43286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43287         LDKRouteHop arg_conv;
43288         arg_conv.inner = untag_ptr(arg);
43289         arg_conv.is_owned = ptr_is_owned(arg);
43290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43291         arg_conv.is_owned = false;
43292         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
43293         return ret_conv;
43294 }
43295
43296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43297         LDKRouteHop orig_conv;
43298         orig_conv.inner = untag_ptr(orig);
43299         orig_conv.is_owned = ptr_is_owned(orig);
43300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43301         orig_conv.is_owned = false;
43302         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
43303         int64_t ret_ref = 0;
43304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43306         return ret_ref;
43307 }
43308
43309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
43310         LDKRouteHop o_conv;
43311         o_conv.inner = untag_ptr(o);
43312         o_conv.is_owned = ptr_is_owned(o);
43313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43314         o_conv.is_owned = false;
43315         int64_t ret_conv = RouteHop_hash(&o_conv);
43316         return ret_conv;
43317 }
43318
43319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43320         LDKRouteHop a_conv;
43321         a_conv.inner = untag_ptr(a);
43322         a_conv.is_owned = ptr_is_owned(a);
43323         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43324         a_conv.is_owned = false;
43325         LDKRouteHop b_conv;
43326         b_conv.inner = untag_ptr(b);
43327         b_conv.is_owned = ptr_is_owned(b);
43328         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43329         b_conv.is_owned = false;
43330         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
43331         return ret_conv;
43332 }
43333
43334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
43335         LDKRouteHop obj_conv;
43336         obj_conv.inner = untag_ptr(obj);
43337         obj_conv.is_owned = ptr_is_owned(obj);
43338         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43339         obj_conv.is_owned = false;
43340         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
43341         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43342         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43343         CVec_u8Z_free(ret_var);
43344         return ret_arr;
43345 }
43346
43347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43348         LDKu8slice ser_ref;
43349         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43350         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43351         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
43352         *ret_conv = RouteHop_read(ser_ref);
43353         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43354         return tag_ptr(ret_conv, true);
43355 }
43356
43357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43358         LDKRoute this_obj_conv;
43359         this_obj_conv.inner = untag_ptr(this_obj);
43360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43362         Route_free(this_obj_conv);
43363 }
43364
43365 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43366         LDKRoute this_ptr_conv;
43367         this_ptr_conv.inner = untag_ptr(this_ptr);
43368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43370         this_ptr_conv.is_owned = false;
43371         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
43372         jobjectArray ret_arr = NULL;
43373         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
43374         ;
43375         for (size_t m = 0; m < ret_var.datalen; m++) {
43376                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
43377                 int64_tArray ret_conv_12_arr = NULL;
43378                 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
43379                 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
43380                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
43381                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
43382                         int64_t ret_conv_12_conv_10_ref = 0;
43383                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
43384                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
43385                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
43386                 }
43387                 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
43388                 FREE(ret_conv_12_var.data);
43389                 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
43390         }
43391         
43392         FREE(ret_var.data);
43393         return ret_arr;
43394 }
43395
43396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
43397         LDKRoute this_ptr_conv;
43398         this_ptr_conv.inner = untag_ptr(this_ptr);
43399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43401         this_ptr_conv.is_owned = false;
43402         LDKCVec_CVec_RouteHopZZ val_constr;
43403         val_constr.datalen = (*env)->GetArrayLength(env, val);
43404         if (val_constr.datalen > 0)
43405                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43406         else
43407                 val_constr.data = NULL;
43408         for (size_t m = 0; m < val_constr.datalen; m++) {
43409                 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
43410                 LDKCVec_RouteHopZ val_conv_12_constr;
43411                 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
43412                 if (val_conv_12_constr.datalen > 0)
43413                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43414                 else
43415                         val_conv_12_constr.data = NULL;
43416                 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
43417                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
43418                         int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
43419                         LDKRouteHop val_conv_12_conv_10_conv;
43420                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
43421                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
43422                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
43423                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
43424                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
43425                 }
43426                 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
43427                 val_constr.data[m] = val_conv_12_constr;
43428         }
43429         Route_set_paths(&this_ptr_conv, val_constr);
43430 }
43431
43432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43433         LDKRoute this_ptr_conv;
43434         this_ptr_conv.inner = untag_ptr(this_ptr);
43435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43437         this_ptr_conv.is_owned = false;
43438         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
43439         int64_t ret_ref = 0;
43440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43442         return ret_ref;
43443 }
43444
43445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43446         LDKRoute this_ptr_conv;
43447         this_ptr_conv.inner = untag_ptr(this_ptr);
43448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43450         this_ptr_conv.is_owned = false;
43451         LDKPaymentParameters val_conv;
43452         val_conv.inner = untag_ptr(val);
43453         val_conv.is_owned = ptr_is_owned(val);
43454         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43455         val_conv = PaymentParameters_clone(&val_conv);
43456         Route_set_payment_params(&this_ptr_conv, val_conv);
43457 }
43458
43459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
43460         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
43461         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
43462         if (paths_arg_constr.datalen > 0)
43463                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43464         else
43465                 paths_arg_constr.data = NULL;
43466         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
43467                 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
43468                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
43469                 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
43470                 if (paths_arg_conv_12_constr.datalen > 0)
43471                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43472                 else
43473                         paths_arg_conv_12_constr.data = NULL;
43474                 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
43475                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
43476                         int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
43477                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
43478                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
43479                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
43480                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
43481                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
43482                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
43483                 }
43484                 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
43485                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
43486         }
43487         LDKPaymentParameters payment_params_arg_conv;
43488         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
43489         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
43490         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
43491         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
43492         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
43493         int64_t ret_ref = 0;
43494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43496         return ret_ref;
43497 }
43498
43499 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
43500         LDKRoute ret_var = Route_clone(arg);
43501         int64_t ret_ref = 0;
43502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43504         return ret_ref;
43505 }
43506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43507         LDKRoute arg_conv;
43508         arg_conv.inner = untag_ptr(arg);
43509         arg_conv.is_owned = ptr_is_owned(arg);
43510         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43511         arg_conv.is_owned = false;
43512         int64_t ret_conv = Route_clone_ptr(&arg_conv);
43513         return ret_conv;
43514 }
43515
43516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43517         LDKRoute orig_conv;
43518         orig_conv.inner = untag_ptr(orig);
43519         orig_conv.is_owned = ptr_is_owned(orig);
43520         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43521         orig_conv.is_owned = false;
43522         LDKRoute ret_var = Route_clone(&orig_conv);
43523         int64_t ret_ref = 0;
43524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43526         return ret_ref;
43527 }
43528
43529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
43530         LDKRoute o_conv;
43531         o_conv.inner = untag_ptr(o);
43532         o_conv.is_owned = ptr_is_owned(o);
43533         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43534         o_conv.is_owned = false;
43535         int64_t ret_conv = Route_hash(&o_conv);
43536         return ret_conv;
43537 }
43538
43539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43540         LDKRoute a_conv;
43541         a_conv.inner = untag_ptr(a);
43542         a_conv.is_owned = ptr_is_owned(a);
43543         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43544         a_conv.is_owned = false;
43545         LDKRoute b_conv;
43546         b_conv.inner = untag_ptr(b);
43547         b_conv.is_owned = ptr_is_owned(b);
43548         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43549         b_conv.is_owned = false;
43550         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
43551         return ret_conv;
43552 }
43553
43554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
43555         LDKRoute this_arg_conv;
43556         this_arg_conv.inner = untag_ptr(this_arg);
43557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43559         this_arg_conv.is_owned = false;
43560         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
43561         return ret_conv;
43562 }
43563
43564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
43565         LDKRoute this_arg_conv;
43566         this_arg_conv.inner = untag_ptr(this_arg);
43567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43569         this_arg_conv.is_owned = false;
43570         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
43571         return ret_conv;
43572 }
43573
43574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
43575         LDKRoute obj_conv;
43576         obj_conv.inner = untag_ptr(obj);
43577         obj_conv.is_owned = ptr_is_owned(obj);
43578         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43579         obj_conv.is_owned = false;
43580         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
43581         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43582         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43583         CVec_u8Z_free(ret_var);
43584         return ret_arr;
43585 }
43586
43587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43588         LDKu8slice ser_ref;
43589         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43590         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43591         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
43592         *ret_conv = Route_read(ser_ref);
43593         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43594         return tag_ptr(ret_conv, true);
43595 }
43596
43597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43598         LDKRouteParameters this_obj_conv;
43599         this_obj_conv.inner = untag_ptr(this_obj);
43600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43602         RouteParameters_free(this_obj_conv);
43603 }
43604
43605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43606         LDKRouteParameters this_ptr_conv;
43607         this_ptr_conv.inner = untag_ptr(this_ptr);
43608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43610         this_ptr_conv.is_owned = false;
43611         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
43612         int64_t ret_ref = 0;
43613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43615         return ret_ref;
43616 }
43617
43618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43619         LDKRouteParameters this_ptr_conv;
43620         this_ptr_conv.inner = untag_ptr(this_ptr);
43621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43623         this_ptr_conv.is_owned = false;
43624         LDKPaymentParameters val_conv;
43625         val_conv.inner = untag_ptr(val);
43626         val_conv.is_owned = ptr_is_owned(val);
43627         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43628         val_conv = PaymentParameters_clone(&val_conv);
43629         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
43630 }
43631
43632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43633         LDKRouteParameters this_ptr_conv;
43634         this_ptr_conv.inner = untag_ptr(this_ptr);
43635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43637         this_ptr_conv.is_owned = false;
43638         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
43639         return ret_conv;
43640 }
43641
43642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43643         LDKRouteParameters this_ptr_conv;
43644         this_ptr_conv.inner = untag_ptr(this_ptr);
43645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43647         this_ptr_conv.is_owned = false;
43648         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
43649 }
43650
43651 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43652         LDKRouteParameters this_ptr_conv;
43653         this_ptr_conv.inner = untag_ptr(this_ptr);
43654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43656         this_ptr_conv.is_owned = false;
43657         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
43658         return ret_conv;
43659 }
43660
43661 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) {
43662         LDKRouteParameters this_ptr_conv;
43663         this_ptr_conv.inner = untag_ptr(this_ptr);
43664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43666         this_ptr_conv.is_owned = false;
43667         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
43668 }
43669
43670 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) {
43671         LDKPaymentParameters payment_params_arg_conv;
43672         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
43673         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
43674         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
43675         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
43676         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
43677         int64_t ret_ref = 0;
43678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43680         return ret_ref;
43681 }
43682
43683 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
43684         LDKRouteParameters ret_var = RouteParameters_clone(arg);
43685         int64_t ret_ref = 0;
43686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43688         return ret_ref;
43689 }
43690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43691         LDKRouteParameters arg_conv;
43692         arg_conv.inner = untag_ptr(arg);
43693         arg_conv.is_owned = ptr_is_owned(arg);
43694         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43695         arg_conv.is_owned = false;
43696         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
43697         return ret_conv;
43698 }
43699
43700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43701         LDKRouteParameters orig_conv;
43702         orig_conv.inner = untag_ptr(orig);
43703         orig_conv.is_owned = ptr_is_owned(orig);
43704         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43705         orig_conv.is_owned = false;
43706         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
43707         int64_t ret_ref = 0;
43708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43710         return ret_ref;
43711 }
43712
43713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
43714         LDKRouteParameters obj_conv;
43715         obj_conv.inner = untag_ptr(obj);
43716         obj_conv.is_owned = ptr_is_owned(obj);
43717         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43718         obj_conv.is_owned = false;
43719         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
43720         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43721         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43722         CVec_u8Z_free(ret_var);
43723         return ret_arr;
43724 }
43725
43726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43727         LDKu8slice ser_ref;
43728         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43729         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43730         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
43731         *ret_conv = RouteParameters_read(ser_ref);
43732         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43733         return tag_ptr(ret_conv, true);
43734 }
43735
43736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43737         LDKPaymentParameters this_obj_conv;
43738         this_obj_conv.inner = untag_ptr(this_obj);
43739         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43741         PaymentParameters_free(this_obj_conv);
43742 }
43743
43744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43745         LDKPaymentParameters this_ptr_conv;
43746         this_ptr_conv.inner = untag_ptr(this_ptr);
43747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43749         this_ptr_conv.is_owned = false;
43750         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43751         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
43752         return ret_arr;
43753 }
43754
43755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43756         LDKPaymentParameters this_ptr_conv;
43757         this_ptr_conv.inner = untag_ptr(this_ptr);
43758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43760         this_ptr_conv.is_owned = false;
43761         LDKPublicKey val_ref;
43762         CHECK((*env)->GetArrayLength(env, val) == 33);
43763         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43764         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
43765 }
43766
43767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43768         LDKPaymentParameters this_ptr_conv;
43769         this_ptr_conv.inner = untag_ptr(this_ptr);
43770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43772         this_ptr_conv.is_owned = false;
43773         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
43774         int64_t ret_ref = 0;
43775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43777         return ret_ref;
43778 }
43779
43780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43781         LDKPaymentParameters this_ptr_conv;
43782         this_ptr_conv.inner = untag_ptr(this_ptr);
43783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43785         this_ptr_conv.is_owned = false;
43786         LDKInvoiceFeatures val_conv;
43787         val_conv.inner = untag_ptr(val);
43788         val_conv.is_owned = ptr_is_owned(val);
43789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43790         val_conv = InvoiceFeatures_clone(&val_conv);
43791         PaymentParameters_set_features(&this_ptr_conv, val_conv);
43792 }
43793
43794 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
43795         LDKPaymentParameters this_ptr_conv;
43796         this_ptr_conv.inner = untag_ptr(this_ptr);
43797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43799         this_ptr_conv.is_owned = false;
43800         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
43801         int64_tArray ret_arr = NULL;
43802         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43803         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43804         for (size_t l = 0; l < ret_var.datalen; l++) {
43805                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
43806                 int64_t ret_conv_11_ref = 0;
43807                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
43808                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
43809                 ret_arr_ptr[l] = ret_conv_11_ref;
43810         }
43811         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43812         FREE(ret_var.data);
43813         return ret_arr;
43814 }
43815
43816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
43817         LDKPaymentParameters this_ptr_conv;
43818         this_ptr_conv.inner = untag_ptr(this_ptr);
43819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43821         this_ptr_conv.is_owned = false;
43822         LDKCVec_RouteHintZ val_constr;
43823         val_constr.datalen = (*env)->GetArrayLength(env, val);
43824         if (val_constr.datalen > 0)
43825                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
43826         else
43827                 val_constr.data = NULL;
43828         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
43829         for (size_t l = 0; l < val_constr.datalen; l++) {
43830                 int64_t val_conv_11 = val_vals[l];
43831                 LDKRouteHint val_conv_11_conv;
43832                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
43833                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
43834                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
43835                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
43836                 val_constr.data[l] = val_conv_11_conv;
43837         }
43838         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
43839         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
43840 }
43841
43842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
43843         LDKPaymentParameters 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43849         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
43850         int64_t ret_ref = tag_ptr(ret_copy, true);
43851         return ret_ref;
43852 }
43853
43854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43855         LDKPaymentParameters this_ptr_conv;
43856         this_ptr_conv.inner = untag_ptr(this_ptr);
43857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43859         this_ptr_conv.is_owned = false;
43860         void* val_ptr = untag_ptr(val);
43861         CHECK_ACCESS(val_ptr);
43862         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43863         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43864         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
43865 }
43866
43867 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43868         LDKPaymentParameters this_ptr_conv;
43869         this_ptr_conv.inner = untag_ptr(this_ptr);
43870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43872         this_ptr_conv.is_owned = false;
43873         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
43874         return ret_conv;
43875 }
43876
43877 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) {
43878         LDKPaymentParameters this_ptr_conv;
43879         this_ptr_conv.inner = untag_ptr(this_ptr);
43880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43882         this_ptr_conv.is_owned = false;
43883         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
43884 }
43885
43886 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
43887         LDKPaymentParameters this_ptr_conv;
43888         this_ptr_conv.inner = untag_ptr(this_ptr);
43889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43891         this_ptr_conv.is_owned = false;
43892         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
43893         return ret_conv;
43894 }
43895
43896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
43897         LDKPaymentParameters 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         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
43903 }
43904
43905 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) {
43906         LDKPaymentParameters this_ptr_conv;
43907         this_ptr_conv.inner = untag_ptr(this_ptr);
43908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43910         this_ptr_conv.is_owned = false;
43911         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
43912         return ret_conv;
43913 }
43914
43915 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) {
43916         LDKPaymentParameters this_ptr_conv;
43917         this_ptr_conv.inner = untag_ptr(this_ptr);
43918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43920         this_ptr_conv.is_owned = false;
43921         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
43922 }
43923
43924 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43925         LDKPaymentParameters this_ptr_conv;
43926         this_ptr_conv.inner = untag_ptr(this_ptr);
43927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43929         this_ptr_conv.is_owned = false;
43930         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
43931         int64_tArray ret_arr = NULL;
43932         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43933         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43934         for (size_t g = 0; g < ret_var.datalen; g++) {
43935                 int64_t ret_conv_6_conv = ret_var.data[g];
43936                 ret_arr_ptr[g] = ret_conv_6_conv;
43937         }
43938         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43939         FREE(ret_var.data);
43940         return ret_arr;
43941 }
43942
43943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
43944         LDKPaymentParameters this_ptr_conv;
43945         this_ptr_conv.inner = untag_ptr(this_ptr);
43946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43948         this_ptr_conv.is_owned = false;
43949         LDKCVec_u64Z val_constr;
43950         val_constr.datalen = (*env)->GetArrayLength(env, val);
43951         if (val_constr.datalen > 0)
43952                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43953         else
43954                 val_constr.data = NULL;
43955         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
43956         for (size_t g = 0; g < val_constr.datalen; g++) {
43957                 int64_t val_conv_6 = val_vals[g];
43958                 val_constr.data[g] = val_conv_6;
43959         }
43960         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
43961         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
43962 }
43963
43964 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) {
43965         LDKPublicKey payee_pubkey_arg_ref;
43966         CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
43967         (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
43968         LDKInvoiceFeatures features_arg_conv;
43969         features_arg_conv.inner = untag_ptr(features_arg);
43970         features_arg_conv.is_owned = ptr_is_owned(features_arg);
43971         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
43972         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
43973         LDKCVec_RouteHintZ route_hints_arg_constr;
43974         route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
43975         if (route_hints_arg_constr.datalen > 0)
43976                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
43977         else
43978                 route_hints_arg_constr.data = NULL;
43979         int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
43980         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
43981                 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
43982                 LDKRouteHint route_hints_arg_conv_11_conv;
43983                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
43984                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
43985                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
43986                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
43987                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
43988         }
43989         (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
43990         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
43991         CHECK_ACCESS(expiry_time_arg_ptr);
43992         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
43993         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
43994         LDKCVec_u64Z previously_failed_channels_arg_constr;
43995         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
43996         if (previously_failed_channels_arg_constr.datalen > 0)
43997                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43998         else
43999                 previously_failed_channels_arg_constr.data = NULL;
44000         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
44001         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
44002                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
44003                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
44004         }
44005         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
44006         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);
44007         int64_t ret_ref = 0;
44008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44010         return ret_ref;
44011 }
44012
44013 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
44014         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
44015         int64_t ret_ref = 0;
44016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44018         return ret_ref;
44019 }
44020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44021         LDKPaymentParameters arg_conv;
44022         arg_conv.inner = untag_ptr(arg);
44023         arg_conv.is_owned = ptr_is_owned(arg);
44024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44025         arg_conv.is_owned = false;
44026         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
44027         return ret_conv;
44028 }
44029
44030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44031         LDKPaymentParameters orig_conv;
44032         orig_conv.inner = untag_ptr(orig);
44033         orig_conv.is_owned = ptr_is_owned(orig);
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44035         orig_conv.is_owned = false;
44036         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
44037         int64_t ret_ref = 0;
44038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44040         return ret_ref;
44041 }
44042
44043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
44044         LDKPaymentParameters o_conv;
44045         o_conv.inner = untag_ptr(o);
44046         o_conv.is_owned = ptr_is_owned(o);
44047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44048         o_conv.is_owned = false;
44049         int64_t ret_conv = PaymentParameters_hash(&o_conv);
44050         return ret_conv;
44051 }
44052
44053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44054         LDKPaymentParameters a_conv;
44055         a_conv.inner = untag_ptr(a);
44056         a_conv.is_owned = ptr_is_owned(a);
44057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44058         a_conv.is_owned = false;
44059         LDKPaymentParameters b_conv;
44060         b_conv.inner = untag_ptr(b);
44061         b_conv.is_owned = ptr_is_owned(b);
44062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44063         b_conv.is_owned = false;
44064         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
44065         return ret_conv;
44066 }
44067
44068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
44069         LDKPaymentParameters obj_conv;
44070         obj_conv.inner = untag_ptr(obj);
44071         obj_conv.is_owned = ptr_is_owned(obj);
44072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44073         obj_conv.is_owned = false;
44074         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
44075         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44076         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44077         CVec_u8Z_free(ret_var);
44078         return ret_arr;
44079 }
44080
44081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44082         LDKu8slice ser_ref;
44083         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44084         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44085         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
44086         *ret_conv = PaymentParameters_read(ser_ref);
44087         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44088         return tag_ptr(ret_conv, true);
44089 }
44090
44091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44092         LDKPublicKey payee_pubkey_ref;
44093         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44094         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44095         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
44096         int64_t ret_ref = 0;
44097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44099         return ret_ref;
44100 }
44101
44102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44103         LDKPublicKey payee_pubkey_ref;
44104         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44105         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44106         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
44107         int64_t ret_ref = 0;
44108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44110         return ret_ref;
44111 }
44112
44113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44114         LDKRouteHint this_obj_conv;
44115         this_obj_conv.inner = untag_ptr(this_obj);
44116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44118         RouteHint_free(this_obj_conv);
44119 }
44120
44121 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44122         LDKRouteHint this_ptr_conv;
44123         this_ptr_conv.inner = untag_ptr(this_ptr);
44124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44126         this_ptr_conv.is_owned = false;
44127         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
44128         int64_tArray ret_arr = NULL;
44129         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44130         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44131         for (size_t o = 0; o < ret_var.datalen; o++) {
44132                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
44133                 int64_t ret_conv_14_ref = 0;
44134                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44135                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
44136                 ret_arr_ptr[o] = ret_conv_14_ref;
44137         }
44138         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44139         FREE(ret_var.data);
44140         return ret_arr;
44141 }
44142
44143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44144         LDKRouteHint this_ptr_conv;
44145         this_ptr_conv.inner = untag_ptr(this_ptr);
44146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44148         this_ptr_conv.is_owned = false;
44149         LDKCVec_RouteHintHopZ val_constr;
44150         val_constr.datalen = (*env)->GetArrayLength(env, val);
44151         if (val_constr.datalen > 0)
44152                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44153         else
44154                 val_constr.data = NULL;
44155         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44156         for (size_t o = 0; o < val_constr.datalen; o++) {
44157                 int64_t val_conv_14 = val_vals[o];
44158                 LDKRouteHintHop val_conv_14_conv;
44159                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
44160                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
44161                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
44162                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
44163                 val_constr.data[o] = val_conv_14_conv;
44164         }
44165         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44166         RouteHint_set_a(&this_ptr_conv, val_constr);
44167 }
44168
44169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
44170         LDKCVec_RouteHintHopZ a_arg_constr;
44171         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
44172         if (a_arg_constr.datalen > 0)
44173                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44174         else
44175                 a_arg_constr.data = NULL;
44176         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
44177         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
44178                 int64_t a_arg_conv_14 = a_arg_vals[o];
44179                 LDKRouteHintHop a_arg_conv_14_conv;
44180                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
44181                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
44182                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
44183                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
44184                 a_arg_constr.data[o] = a_arg_conv_14_conv;
44185         }
44186         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
44187         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
44188         int64_t ret_ref = 0;
44189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44191         return ret_ref;
44192 }
44193
44194 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
44195         LDKRouteHint ret_var = RouteHint_clone(arg);
44196         int64_t ret_ref = 0;
44197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44199         return ret_ref;
44200 }
44201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44202         LDKRouteHint arg_conv;
44203         arg_conv.inner = untag_ptr(arg);
44204         arg_conv.is_owned = ptr_is_owned(arg);
44205         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44206         arg_conv.is_owned = false;
44207         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
44208         return ret_conv;
44209 }
44210
44211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44212         LDKRouteHint orig_conv;
44213         orig_conv.inner = untag_ptr(orig);
44214         orig_conv.is_owned = ptr_is_owned(orig);
44215         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44216         orig_conv.is_owned = false;
44217         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
44218         int64_t ret_ref = 0;
44219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44221         return ret_ref;
44222 }
44223
44224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
44225         LDKRouteHint o_conv;
44226         o_conv.inner = untag_ptr(o);
44227         o_conv.is_owned = ptr_is_owned(o);
44228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44229         o_conv.is_owned = false;
44230         int64_t ret_conv = RouteHint_hash(&o_conv);
44231         return ret_conv;
44232 }
44233
44234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44235         LDKRouteHint a_conv;
44236         a_conv.inner = untag_ptr(a);
44237         a_conv.is_owned = ptr_is_owned(a);
44238         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44239         a_conv.is_owned = false;
44240         LDKRouteHint b_conv;
44241         b_conv.inner = untag_ptr(b);
44242         b_conv.is_owned = ptr_is_owned(b);
44243         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44244         b_conv.is_owned = false;
44245         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
44246         return ret_conv;
44247 }
44248
44249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
44250         LDKRouteHint obj_conv;
44251         obj_conv.inner = untag_ptr(obj);
44252         obj_conv.is_owned = ptr_is_owned(obj);
44253         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44254         obj_conv.is_owned = false;
44255         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
44256         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44257         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44258         CVec_u8Z_free(ret_var);
44259         return ret_arr;
44260 }
44261
44262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44263         LDKu8slice ser_ref;
44264         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44265         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44266         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
44267         *ret_conv = RouteHint_read(ser_ref);
44268         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44269         return tag_ptr(ret_conv, true);
44270 }
44271
44272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44273         LDKRouteHintHop this_obj_conv;
44274         this_obj_conv.inner = untag_ptr(this_obj);
44275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44277         RouteHintHop_free(this_obj_conv);
44278 }
44279
44280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44281         LDKRouteHintHop this_ptr_conv;
44282         this_ptr_conv.inner = untag_ptr(this_ptr);
44283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44285         this_ptr_conv.is_owned = false;
44286         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44287         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
44288         return ret_arr;
44289 }
44290
44291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44292         LDKRouteHintHop this_ptr_conv;
44293         this_ptr_conv.inner = untag_ptr(this_ptr);
44294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44296         this_ptr_conv.is_owned = false;
44297         LDKPublicKey val_ref;
44298         CHECK((*env)->GetArrayLength(env, val) == 33);
44299         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44300         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
44301 }
44302
44303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44304         LDKRouteHintHop this_ptr_conv;
44305         this_ptr_conv.inner = untag_ptr(this_ptr);
44306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44308         this_ptr_conv.is_owned = false;
44309         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
44310         return ret_conv;
44311 }
44312
44313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44314         LDKRouteHintHop this_ptr_conv;
44315         this_ptr_conv.inner = untag_ptr(this_ptr);
44316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44318         this_ptr_conv.is_owned = false;
44319         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
44320 }
44321
44322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
44323         LDKRouteHintHop this_ptr_conv;
44324         this_ptr_conv.inner = untag_ptr(this_ptr);
44325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44327         this_ptr_conv.is_owned = false;
44328         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
44329         int64_t ret_ref = 0;
44330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44332         return ret_ref;
44333 }
44334
44335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44336         LDKRouteHintHop this_ptr_conv;
44337         this_ptr_conv.inner = untag_ptr(this_ptr);
44338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44340         this_ptr_conv.is_owned = false;
44341         LDKRoutingFees val_conv;
44342         val_conv.inner = untag_ptr(val);
44343         val_conv.is_owned = ptr_is_owned(val);
44344         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44345         val_conv = RoutingFees_clone(&val_conv);
44346         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
44347 }
44348
44349 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44350         LDKRouteHintHop this_ptr_conv;
44351         this_ptr_conv.inner = untag_ptr(this_ptr);
44352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44354         this_ptr_conv.is_owned = false;
44355         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
44356         return ret_conv;
44357 }
44358
44359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44360         LDKRouteHintHop this_ptr_conv;
44361         this_ptr_conv.inner = untag_ptr(this_ptr);
44362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44364         this_ptr_conv.is_owned = false;
44365         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
44366 }
44367
44368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44369         LDKRouteHintHop this_ptr_conv;
44370         this_ptr_conv.inner = untag_ptr(this_ptr);
44371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44373         this_ptr_conv.is_owned = false;
44374         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44375         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
44376         int64_t ret_ref = tag_ptr(ret_copy, true);
44377         return ret_ref;
44378 }
44379
44380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44381         LDKRouteHintHop this_ptr_conv;
44382         this_ptr_conv.inner = untag_ptr(this_ptr);
44383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44385         this_ptr_conv.is_owned = false;
44386         void* val_ptr = untag_ptr(val);
44387         CHECK_ACCESS(val_ptr);
44388         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44389         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44390         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
44391 }
44392
44393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44394         LDKRouteHintHop this_ptr_conv;
44395         this_ptr_conv.inner = untag_ptr(this_ptr);
44396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44398         this_ptr_conv.is_owned = false;
44399         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44400         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
44401         int64_t ret_ref = tag_ptr(ret_copy, true);
44402         return ret_ref;
44403 }
44404
44405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44406         LDKRouteHintHop this_ptr_conv;
44407         this_ptr_conv.inner = untag_ptr(this_ptr);
44408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44410         this_ptr_conv.is_owned = false;
44411         void* val_ptr = untag_ptr(val);
44412         CHECK_ACCESS(val_ptr);
44413         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44414         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44415         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
44416 }
44417
44418 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) {
44419         LDKPublicKey src_node_id_arg_ref;
44420         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
44421         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
44422         LDKRoutingFees fees_arg_conv;
44423         fees_arg_conv.inner = untag_ptr(fees_arg);
44424         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
44425         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44426         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44427         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
44428         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
44429         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
44430         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
44431         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
44432         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
44433         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
44434         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
44435         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);
44436         int64_t ret_ref = 0;
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44439         return ret_ref;
44440 }
44441
44442 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
44443         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
44444         int64_t ret_ref = 0;
44445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44447         return ret_ref;
44448 }
44449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44450         LDKRouteHintHop arg_conv;
44451         arg_conv.inner = untag_ptr(arg);
44452         arg_conv.is_owned = ptr_is_owned(arg);
44453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44454         arg_conv.is_owned = false;
44455         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
44456         return ret_conv;
44457 }
44458
44459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44460         LDKRouteHintHop orig_conv;
44461         orig_conv.inner = untag_ptr(orig);
44462         orig_conv.is_owned = ptr_is_owned(orig);
44463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44464         orig_conv.is_owned = false;
44465         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
44466         int64_t ret_ref = 0;
44467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44469         return ret_ref;
44470 }
44471
44472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
44473         LDKRouteHintHop o_conv;
44474         o_conv.inner = untag_ptr(o);
44475         o_conv.is_owned = ptr_is_owned(o);
44476         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44477         o_conv.is_owned = false;
44478         int64_t ret_conv = RouteHintHop_hash(&o_conv);
44479         return ret_conv;
44480 }
44481
44482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44483         LDKRouteHintHop a_conv;
44484         a_conv.inner = untag_ptr(a);
44485         a_conv.is_owned = ptr_is_owned(a);
44486         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44487         a_conv.is_owned = false;
44488         LDKRouteHintHop b_conv;
44489         b_conv.inner = untag_ptr(b);
44490         b_conv.is_owned = ptr_is_owned(b);
44491         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44492         b_conv.is_owned = false;
44493         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
44494         return ret_conv;
44495 }
44496
44497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
44498         LDKRouteHintHop obj_conv;
44499         obj_conv.inner = untag_ptr(obj);
44500         obj_conv.is_owned = ptr_is_owned(obj);
44501         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44502         obj_conv.is_owned = false;
44503         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
44504         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44505         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44506         CVec_u8Z_free(ret_var);
44507         return ret_arr;
44508 }
44509
44510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44511         LDKu8slice ser_ref;
44512         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44513         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44514         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
44515         *ret_conv = RouteHintHop_read(ser_ref);
44516         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44517         return tag_ptr(ret_conv, true);
44518 }
44519
44520 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) {
44521         LDKPublicKey our_node_pubkey_ref;
44522         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44523         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44524         LDKRouteParameters route_params_conv;
44525         route_params_conv.inner = untag_ptr(route_params);
44526         route_params_conv.is_owned = ptr_is_owned(route_params);
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44528         route_params_conv.is_owned = false;
44529         LDKNetworkGraph network_graph_conv;
44530         network_graph_conv.inner = untag_ptr(network_graph);
44531         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44532         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44533         network_graph_conv.is_owned = false;
44534         LDKCVec_ChannelDetailsZ first_hops_constr;
44535         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
44536         if (first_hops != NULL) {
44537                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
44538                 if (first_hops_constr.datalen > 0)
44539                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
44540                 else
44541                         first_hops_constr.data = NULL;
44542                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
44543                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
44544                         int64_t first_hops_conv_16 = first_hops_vals[q];
44545                         LDKChannelDetails first_hops_conv_16_conv;
44546                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
44547                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
44548                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
44549                         first_hops_conv_16_conv.is_owned = false;
44550                         first_hops_constr.data[q] = first_hops_conv_16_conv;
44551                 }
44552                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
44553                 first_hops_ptr = &first_hops_constr;
44554         }
44555         void* logger_ptr = untag_ptr(logger);
44556         CHECK_ACCESS(logger_ptr);
44557         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44558         if (logger_conv.free == LDKLogger_JCalls_free) {
44559                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44560                 LDKLogger_JCalls_cloned(&logger_conv);
44561         }
44562         void* scorer_ptr = untag_ptr(scorer);
44563         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
44564         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
44565         unsigned char random_seed_bytes_arr[32];
44566         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44567         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44568         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44569         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44570         *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);
44571         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
44572         return tag_ptr(ret_conv, true);
44573 }
44574
44575 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) {
44576         LDKPublicKey our_node_pubkey_ref;
44577         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44578         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44579         LDKCVec_PublicKeyZ hops_constr;
44580         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
44581         if (hops_constr.datalen > 0)
44582                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44583         else
44584                 hops_constr.data = NULL;
44585         for (size_t i = 0; i < hops_constr.datalen; i++) {
44586                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
44587                 LDKPublicKey hops_conv_8_ref;
44588                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
44589                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
44590                 hops_constr.data[i] = hops_conv_8_ref;
44591         }
44592         LDKRouteParameters route_params_conv;
44593         route_params_conv.inner = untag_ptr(route_params);
44594         route_params_conv.is_owned = ptr_is_owned(route_params);
44595         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44596         route_params_conv.is_owned = false;
44597         LDKNetworkGraph network_graph_conv;
44598         network_graph_conv.inner = untag_ptr(network_graph);
44599         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44600         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44601         network_graph_conv.is_owned = false;
44602         void* logger_ptr = untag_ptr(logger);
44603         CHECK_ACCESS(logger_ptr);
44604         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44605         if (logger_conv.free == LDKLogger_JCalls_free) {
44606                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44607                 LDKLogger_JCalls_cloned(&logger_conv);
44608         }
44609         unsigned char random_seed_bytes_arr[32];
44610         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44611         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44612         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44613         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44614         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
44615         return tag_ptr(ret_conv, true);
44616 }
44617
44618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44619         if (!ptr_is_owned(this_ptr)) return;
44620         void* this_ptr_ptr = untag_ptr(this_ptr);
44621         CHECK_ACCESS(this_ptr_ptr);
44622         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
44623         FREE(untag_ptr(this_ptr));
44624         Score_free(this_ptr_conv);
44625 }
44626
44627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44628         if (!ptr_is_owned(this_ptr)) return;
44629         void* this_ptr_ptr = untag_ptr(this_ptr);
44630         CHECK_ACCESS(this_ptr_ptr);
44631         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
44632         FREE(untag_ptr(this_ptr));
44633         LockableScore_free(this_ptr_conv);
44634 }
44635
44636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44637         LDKMultiThreadedLockableScore this_obj_conv;
44638         this_obj_conv.inner = untag_ptr(this_obj);
44639         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44641         MultiThreadedLockableScore_free(this_obj_conv);
44642 }
44643
44644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
44645         LDKMultiThreadedLockableScore obj_conv;
44646         obj_conv.inner = untag_ptr(obj);
44647         obj_conv.is_owned = ptr_is_owned(obj);
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44649         obj_conv.is_owned = false;
44650         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
44651         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44652         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44653         CVec_u8Z_free(ret_var);
44654         return ret_arr;
44655 }
44656
44657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
44658         void* score_ptr = untag_ptr(score);
44659         CHECK_ACCESS(score_ptr);
44660         LDKScore score_conv = *(LDKScore*)(score_ptr);
44661         if (score_conv.free == LDKScore_JCalls_free) {
44662                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44663                 LDKScore_JCalls_cloned(&score_conv);
44664         }
44665         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
44666         int64_t ret_ref = 0;
44667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44669         return ret_ref;
44670 }
44671
44672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44673         LDKChannelUsage this_obj_conv;
44674         this_obj_conv.inner = untag_ptr(this_obj);
44675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44677         ChannelUsage_free(this_obj_conv);
44678 }
44679
44680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44681         LDKChannelUsage this_ptr_conv;
44682         this_ptr_conv.inner = untag_ptr(this_ptr);
44683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44685         this_ptr_conv.is_owned = false;
44686         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
44687         return ret_conv;
44688 }
44689
44690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44691         LDKChannelUsage this_ptr_conv;
44692         this_ptr_conv.inner = untag_ptr(this_ptr);
44693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44695         this_ptr_conv.is_owned = false;
44696         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
44697 }
44698
44699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44700         LDKChannelUsage this_ptr_conv;
44701         this_ptr_conv.inner = untag_ptr(this_ptr);
44702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44704         this_ptr_conv.is_owned = false;
44705         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
44706         return ret_conv;
44707 }
44708
44709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44710         LDKChannelUsage this_ptr_conv;
44711         this_ptr_conv.inner = untag_ptr(this_ptr);
44712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44714         this_ptr_conv.is_owned = false;
44715         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
44716 }
44717
44718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
44719         LDKChannelUsage this_ptr_conv;
44720         this_ptr_conv.inner = untag_ptr(this_ptr);
44721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44723         this_ptr_conv.is_owned = false;
44724         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44725         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
44726         int64_t ret_ref = tag_ptr(ret_copy, true);
44727         return ret_ref;
44728 }
44729
44730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44731         LDKChannelUsage this_ptr_conv;
44732         this_ptr_conv.inner = untag_ptr(this_ptr);
44733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44735         this_ptr_conv.is_owned = false;
44736         void* val_ptr = untag_ptr(val);
44737         CHECK_ACCESS(val_ptr);
44738         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
44739         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
44740         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
44741 }
44742
44743 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) {
44744         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
44745         CHECK_ACCESS(effective_capacity_arg_ptr);
44746         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
44747         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
44748         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
44749         int64_t ret_ref = 0;
44750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44752         return ret_ref;
44753 }
44754
44755 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
44756         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
44757         int64_t ret_ref = 0;
44758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44760         return ret_ref;
44761 }
44762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44763         LDKChannelUsage arg_conv;
44764         arg_conv.inner = untag_ptr(arg);
44765         arg_conv.is_owned = ptr_is_owned(arg);
44766         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44767         arg_conv.is_owned = false;
44768         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
44769         return ret_conv;
44770 }
44771
44772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44773         LDKChannelUsage orig_conv;
44774         orig_conv.inner = untag_ptr(orig);
44775         orig_conv.is_owned = ptr_is_owned(orig);
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44777         orig_conv.is_owned = false;
44778         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
44779         int64_t ret_ref = 0;
44780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44782         return ret_ref;
44783 }
44784
44785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44786         LDKFixedPenaltyScorer this_obj_conv;
44787         this_obj_conv.inner = untag_ptr(this_obj);
44788         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44790         FixedPenaltyScorer_free(this_obj_conv);
44791 }
44792
44793 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
44794         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44801         LDKFixedPenaltyScorer arg_conv;
44802         arg_conv.inner = untag_ptr(arg);
44803         arg_conv.is_owned = ptr_is_owned(arg);
44804         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44805         arg_conv.is_owned = false;
44806         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
44807         return ret_conv;
44808 }
44809
44810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44811         LDKFixedPenaltyScorer orig_conv;
44812         orig_conv.inner = untag_ptr(orig);
44813         orig_conv.is_owned = ptr_is_owned(orig);
44814         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44815         orig_conv.is_owned = false;
44816         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
44817         int64_t ret_ref = 0;
44818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44820         return ret_ref;
44821 }
44822
44823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
44824         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
44825         int64_t ret_ref = 0;
44826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44828         return ret_ref;
44829 }
44830
44831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
44832         LDKFixedPenaltyScorer this_arg_conv;
44833         this_arg_conv.inner = untag_ptr(this_arg);
44834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44836         this_arg_conv.is_owned = false;
44837         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
44838         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
44839         return tag_ptr(ret_ret, true);
44840 }
44841
44842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
44843         LDKFixedPenaltyScorer obj_conv;
44844         obj_conv.inner = untag_ptr(obj);
44845         obj_conv.is_owned = ptr_is_owned(obj);
44846         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44847         obj_conv.is_owned = false;
44848         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
44849         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44850         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44851         CVec_u8Z_free(ret_var);
44852         return ret_arr;
44853 }
44854
44855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
44856         LDKu8slice ser_ref;
44857         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44858         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44859         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
44860         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
44861         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44862         return tag_ptr(ret_conv, true);
44863 }
44864
44865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44866         LDKProbabilisticScorer this_obj_conv;
44867         this_obj_conv.inner = untag_ptr(this_obj);
44868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44870         ProbabilisticScorer_free(this_obj_conv);
44871 }
44872
44873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44874         LDKProbabilisticScoringParameters this_obj_conv;
44875         this_obj_conv.inner = untag_ptr(this_obj);
44876         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44878         ProbabilisticScoringParameters_free(this_obj_conv);
44879 }
44880
44881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44882         LDKProbabilisticScoringParameters this_ptr_conv;
44883         this_ptr_conv.inner = untag_ptr(this_ptr);
44884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44886         this_ptr_conv.is_owned = false;
44887         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
44888         return ret_conv;
44889 }
44890
44891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44892         LDKProbabilisticScoringParameters this_ptr_conv;
44893         this_ptr_conv.inner = untag_ptr(this_ptr);
44894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44896         this_ptr_conv.is_owned = false;
44897         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
44898 }
44899
44900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44901         LDKProbabilisticScoringParameters this_ptr_conv;
44902         this_ptr_conv.inner = untag_ptr(this_ptr);
44903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44905         this_ptr_conv.is_owned = false;
44906         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
44907         return ret_conv;
44908 }
44909
44910 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) {
44911         LDKProbabilisticScoringParameters this_ptr_conv;
44912         this_ptr_conv.inner = untag_ptr(this_ptr);
44913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44915         this_ptr_conv.is_owned = false;
44916         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44917 }
44918
44919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44920         LDKProbabilisticScoringParameters this_ptr_conv;
44921         this_ptr_conv.inner = untag_ptr(this_ptr);
44922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44924         this_ptr_conv.is_owned = false;
44925         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
44926         return ret_conv;
44927 }
44928
44929 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) {
44930         LDKProbabilisticScoringParameters this_ptr_conv;
44931         this_ptr_conv.inner = untag_ptr(this_ptr);
44932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44934         this_ptr_conv.is_owned = false;
44935         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
44936 }
44937
44938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
44939         LDKProbabilisticScoringParameters this_ptr_conv;
44940         this_ptr_conv.inner = untag_ptr(this_ptr);
44941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44943         this_ptr_conv.is_owned = false;
44944         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
44945         return ret_conv;
44946 }
44947
44948 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) {
44949         LDKProbabilisticScoringParameters this_ptr_conv;
44950         this_ptr_conv.inner = untag_ptr(this_ptr);
44951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44953         this_ptr_conv.is_owned = false;
44954         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
44955 }
44956
44957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44958         LDKProbabilisticScoringParameters this_ptr_conv;
44959         this_ptr_conv.inner = untag_ptr(this_ptr);
44960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44962         this_ptr_conv.is_owned = false;
44963         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
44964         return ret_conv;
44965 }
44966
44967 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) {
44968         LDKProbabilisticScoringParameters this_ptr_conv;
44969         this_ptr_conv.inner = untag_ptr(this_ptr);
44970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44972         this_ptr_conv.is_owned = false;
44973         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
44974 }
44975
44976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44977         LDKProbabilisticScoringParameters this_ptr_conv;
44978         this_ptr_conv.inner = untag_ptr(this_ptr);
44979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44981         this_ptr_conv.is_owned = false;
44982         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
44983         return ret_conv;
44984 }
44985
44986 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) {
44987         LDKProbabilisticScoringParameters this_ptr_conv;
44988         this_ptr_conv.inner = untag_ptr(this_ptr);
44989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44991         this_ptr_conv.is_owned = false;
44992         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
44993 }
44994
44995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44996         LDKProbabilisticScoringParameters this_ptr_conv;
44997         this_ptr_conv.inner = untag_ptr(this_ptr);
44998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45000         this_ptr_conv.is_owned = false;
45001         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
45002         return ret_conv;
45003 }
45004
45005 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) {
45006         LDKProbabilisticScoringParameters this_ptr_conv;
45007         this_ptr_conv.inner = untag_ptr(this_ptr);
45008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45010         this_ptr_conv.is_owned = false;
45011         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
45012 }
45013
45014 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
45015         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
45016         int64_t ret_ref = 0;
45017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45019         return ret_ref;
45020 }
45021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45022         LDKProbabilisticScoringParameters arg_conv;
45023         arg_conv.inner = untag_ptr(arg);
45024         arg_conv.is_owned = ptr_is_owned(arg);
45025         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45026         arg_conv.is_owned = false;
45027         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
45028         return ret_conv;
45029 }
45030
45031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45032         LDKProbabilisticScoringParameters orig_conv;
45033         orig_conv.inner = untag_ptr(orig);
45034         orig_conv.is_owned = ptr_is_owned(orig);
45035         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45036         orig_conv.is_owned = false;
45037         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
45038         int64_t ret_ref = 0;
45039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45041         return ret_ref;
45042 }
45043
45044 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) {
45045         LDKProbabilisticScoringParameters params_conv;
45046         params_conv.inner = untag_ptr(params);
45047         params_conv.is_owned = ptr_is_owned(params);
45048         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
45049         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
45050         LDKNetworkGraph network_graph_conv;
45051         network_graph_conv.inner = untag_ptr(network_graph);
45052         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45053         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45054         network_graph_conv.is_owned = false;
45055         void* logger_ptr = untag_ptr(logger);
45056         CHECK_ACCESS(logger_ptr);
45057         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45058         if (logger_conv.free == LDKLogger_JCalls_free) {
45059                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45060                 LDKLogger_JCalls_cloned(&logger_conv);
45061         }
45062         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
45063         int64_t ret_ref = 0;
45064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45066         return ret_ref;
45067 }
45068
45069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
45070         LDKProbabilisticScorer this_arg_conv;
45071         this_arg_conv.inner = untag_ptr(this_arg);
45072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45074         this_arg_conv.is_owned = false;
45075         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
45076 }
45077
45078 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) {
45079         LDKProbabilisticScorer this_arg_conv;
45080         this_arg_conv.inner = untag_ptr(this_arg);
45081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45083         this_arg_conv.is_owned = false;
45084         LDKNodeId target_conv;
45085         target_conv.inner = untag_ptr(target);
45086         target_conv.is_owned = ptr_is_owned(target);
45087         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45088         target_conv.is_owned = false;
45089         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
45090         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
45091         int64_t ret_ref = tag_ptr(ret_copy, true);
45092         return ret_ref;
45093 }
45094
45095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45096         LDKProbabilisticScorer this_arg_conv;
45097         this_arg_conv.inner = untag_ptr(this_arg);
45098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45100         this_arg_conv.is_owned = false;
45101         LDKNodeId node_id_conv;
45102         node_id_conv.inner = untag_ptr(node_id);
45103         node_id_conv.is_owned = ptr_is_owned(node_id);
45104         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45105         node_id_conv.is_owned = false;
45106         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
45107 }
45108
45109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45110         LDKProbabilisticScorer this_arg_conv;
45111         this_arg_conv.inner = untag_ptr(this_arg);
45112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45114         this_arg_conv.is_owned = false;
45115         LDKNodeId node_id_conv;
45116         node_id_conv.inner = untag_ptr(node_id);
45117         node_id_conv.is_owned = ptr_is_owned(node_id);
45118         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45119         node_id_conv.is_owned = false;
45120         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
45121 }
45122
45123 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) {
45124         LDKProbabilisticScorer this_arg_conv;
45125         this_arg_conv.inner = untag_ptr(this_arg);
45126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45128         this_arg_conv.is_owned = false;
45129         LDKNodeId node_id_conv;
45130         node_id_conv.inner = untag_ptr(node_id);
45131         node_id_conv.is_owned = ptr_is_owned(node_id);
45132         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45133         node_id_conv.is_owned = false;
45134         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
45135 }
45136
45137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45138         LDKProbabilisticScorer this_arg_conv;
45139         this_arg_conv.inner = untag_ptr(this_arg);
45140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45142         this_arg_conv.is_owned = false;
45143         LDKNodeId node_id_conv;
45144         node_id_conv.inner = untag_ptr(node_id);
45145         node_id_conv.is_owned = ptr_is_owned(node_id);
45146         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45147         node_id_conv.is_owned = false;
45148         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
45149 }
45150
45151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
45152         LDKProbabilisticScorer this_arg_conv;
45153         this_arg_conv.inner = untag_ptr(this_arg);
45154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45156         this_arg_conv.is_owned = false;
45157         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
45158 }
45159
45160 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) {
45161         LDKProbabilisticScoringParameters this_arg_conv;
45162         this_arg_conv.inner = untag_ptr(this_arg);
45163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45165         this_arg_conv.is_owned = false;
45166         LDKCVec_NodeIdZ node_ids_constr;
45167         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
45168         if (node_ids_constr.datalen > 0)
45169                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
45170         else
45171                 node_ids_constr.data = NULL;
45172         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
45173         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
45174                 int64_t node_ids_conv_8 = node_ids_vals[i];
45175                 LDKNodeId node_ids_conv_8_conv;
45176                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
45177                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
45178                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
45179                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
45180                 node_ids_constr.data[i] = node_ids_conv_8_conv;
45181         }
45182         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
45183         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
45184 }
45185
45186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
45187         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
45188         int64_t ret_ref = 0;
45189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45191         return ret_ref;
45192 }
45193
45194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45195         LDKProbabilisticScorer this_arg_conv;
45196         this_arg_conv.inner = untag_ptr(this_arg);
45197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45199         this_arg_conv.is_owned = false;
45200         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45201         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
45202         return tag_ptr(ret_ret, true);
45203 }
45204
45205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45206         LDKProbabilisticScorer obj_conv;
45207         obj_conv.inner = untag_ptr(obj);
45208         obj_conv.is_owned = ptr_is_owned(obj);
45209         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45210         obj_conv.is_owned = false;
45211         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
45212         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45213         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45214         CVec_u8Z_free(ret_var);
45215         return ret_arr;
45216 }
45217
45218 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) {
45219         LDKu8slice ser_ref;
45220         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45221         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45222         LDKProbabilisticScoringParameters arg_a_conv;
45223         arg_a_conv.inner = untag_ptr(arg_a);
45224         arg_a_conv.is_owned = ptr_is_owned(arg_a);
45225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
45226         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
45227         LDKNetworkGraph arg_b_conv;
45228         arg_b_conv.inner = untag_ptr(arg_b);
45229         arg_b_conv.is_owned = ptr_is_owned(arg_b);
45230         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
45231         arg_b_conv.is_owned = false;
45232         void* arg_c_ptr = untag_ptr(arg_c);
45233         CHECK_ACCESS(arg_c_ptr);
45234         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
45235         if (arg_c_conv.free == LDKLogger_JCalls_free) {
45236                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45237                 LDKLogger_JCalls_cloned(&arg_c_conv);
45238         }
45239         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
45240         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
45241         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45242         return tag_ptr(ret_conv, true);
45243 }
45244
45245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45246         LDKFilesystemPersister this_obj_conv;
45247         this_obj_conv.inner = untag_ptr(this_obj);
45248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45250         FilesystemPersister_free(this_obj_conv);
45251 }
45252
45253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
45254         LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
45255         LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
45256         int64_t ret_ref = 0;
45257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45259         return ret_ref;
45260 }
45261
45262 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
45263         LDKFilesystemPersister this_arg_conv;
45264         this_arg_conv.inner = untag_ptr(this_arg);
45265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45267         this_arg_conv.is_owned = false;
45268         LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
45269         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45270         Str_free(ret_str);
45271         return ret_conv;
45272 }
45273
45274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
45275         LDKFilesystemPersister this_arg_conv;
45276         this_arg_conv.inner = untag_ptr(this_arg);
45277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45279         this_arg_conv.is_owned = false;
45280         void* keys_manager_ptr = untag_ptr(keys_manager);
45281         CHECK_ACCESS(keys_manager_ptr);
45282         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45283         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45284                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45285                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45286         }
45287         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
45288         *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
45289         return tag_ptr(ret_conv, true);
45290 }
45291
45292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45293         LDKBackgroundProcessor this_obj_conv;
45294         this_obj_conv.inner = untag_ptr(this_obj);
45295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45297         BackgroundProcessor_free(this_obj_conv);
45298 }
45299
45300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45301         if (!ptr_is_owned(this_ptr)) return;
45302         void* this_ptr_ptr = untag_ptr(this_ptr);
45303         CHECK_ACCESS(this_ptr_ptr);
45304         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
45305         FREE(untag_ptr(this_ptr));
45306         GossipSync_free(this_ptr_conv);
45307 }
45308
45309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
45310         LDKP2PGossipSync a_conv;
45311         a_conv.inner = untag_ptr(a);
45312         a_conv.is_owned = ptr_is_owned(a);
45313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45314         a_conv.is_owned = false;
45315         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45316         *ret_copy = GossipSync_p2_p(&a_conv);
45317         int64_t ret_ref = tag_ptr(ret_copy, true);
45318         return ret_ref;
45319 }
45320
45321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
45322         LDKRapidGossipSync a_conv;
45323         a_conv.inner = untag_ptr(a);
45324         a_conv.is_owned = ptr_is_owned(a);
45325         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45326         a_conv.is_owned = false;
45327         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45328         *ret_copy = GossipSync_rapid(&a_conv);
45329         int64_t ret_ref = tag_ptr(ret_copy, true);
45330         return ret_ref;
45331 }
45332
45333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
45334         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45335         *ret_copy = GossipSync_none();
45336         int64_t ret_ref = tag_ptr(ret_copy, true);
45337         return ret_ref;
45338 }
45339
45340 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) {
45341         void* persister_ptr = untag_ptr(persister);
45342         CHECK_ACCESS(persister_ptr);
45343         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
45344         if (persister_conv.free == LDKPersister_JCalls_free) {
45345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45346                 LDKPersister_JCalls_cloned(&persister_conv);
45347         }
45348         void* event_handler_ptr = untag_ptr(event_handler);
45349         CHECK_ACCESS(event_handler_ptr);
45350         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45351         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45352                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45353                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45354         }
45355         LDKChainMonitor chain_monitor_conv;
45356         chain_monitor_conv.inner = untag_ptr(chain_monitor);
45357         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
45358         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
45359         chain_monitor_conv.is_owned = false;
45360         LDKChannelManager channel_manager_conv;
45361         channel_manager_conv.inner = untag_ptr(channel_manager);
45362         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
45363         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
45364         channel_manager_conv.is_owned = false;
45365         void* gossip_sync_ptr = untag_ptr(gossip_sync);
45366         CHECK_ACCESS(gossip_sync_ptr);
45367         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
45368         // WARNING: we may need a move here but no clone is available for LDKGossipSync
45369         LDKPeerManager peer_manager_conv;
45370         peer_manager_conv.inner = untag_ptr(peer_manager);
45371         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
45372         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
45373         peer_manager_conv.is_owned = false;
45374         void* logger_ptr = untag_ptr(logger);
45375         CHECK_ACCESS(logger_ptr);
45376         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45377         if (logger_conv.free == LDKLogger_JCalls_free) {
45378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45379                 LDKLogger_JCalls_cloned(&logger_conv);
45380         }
45381         LDKMultiThreadedLockableScore scorer_conv;
45382         scorer_conv.inner = untag_ptr(scorer);
45383         scorer_conv.is_owned = ptr_is_owned(scorer);
45384         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45385         scorer_conv.is_owned = false;
45386         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);
45387         int64_t ret_ref = 0;
45388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45390         return ret_ref;
45391 }
45392
45393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
45394         LDKBackgroundProcessor this_arg_conv;
45395         this_arg_conv.inner = untag_ptr(this_arg);
45396         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45398         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45399         
45400         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45401         *ret_conv = BackgroundProcessor_join(this_arg_conv);
45402         return tag_ptr(ret_conv, true);
45403 }
45404
45405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
45406         LDKBackgroundProcessor this_arg_conv;
45407         this_arg_conv.inner = untag_ptr(this_arg);
45408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45410         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45411         
45412         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45413         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
45414         return tag_ptr(ret_conv, true);
45415 }
45416
45417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45418         if (!ptr_is_owned(this_ptr)) return;
45419         void* this_ptr_ptr = untag_ptr(this_ptr);
45420         CHECK_ACCESS(this_ptr_ptr);
45421         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
45422         FREE(untag_ptr(this_ptr));
45423         ParseError_free(this_ptr_conv);
45424 }
45425
45426 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
45427         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45428         *ret_copy = ParseError_clone(arg);
45429         int64_t ret_ref = tag_ptr(ret_copy, true);
45430         return ret_ref;
45431 }
45432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45433         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
45434         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
45435         return ret_conv;
45436 }
45437
45438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45439         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
45440         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45441         *ret_copy = ParseError_clone(orig_conv);
45442         int64_t ret_ref = tag_ptr(ret_copy, true);
45443         return ret_ref;
45444 }
45445
45446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
45447         void* a_ptr = untag_ptr(a);
45448         CHECK_ACCESS(a_ptr);
45449         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
45450         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
45451         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45452         *ret_copy = ParseError_bech32_error(a_conv);
45453         int64_t ret_ref = tag_ptr(ret_copy, true);
45454         return ret_ref;
45455 }
45456
45457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
45458         
45459         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45460         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
45461         int64_t ret_ref = tag_ptr(ret_copy, true);
45462         return ret_ref;
45463 }
45464
45465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
45466         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
45467         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45468         *ret_copy = ParseError_malformed_signature(a_conv);
45469         int64_t ret_ref = tag_ptr(ret_copy, true);
45470         return ret_ref;
45471 }
45472
45473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
45474         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45475         *ret_copy = ParseError_bad_prefix();
45476         int64_t ret_ref = tag_ptr(ret_copy, true);
45477         return ret_ref;
45478 }
45479
45480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
45481         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45482         *ret_copy = ParseError_unknown_currency();
45483         int64_t ret_ref = tag_ptr(ret_copy, true);
45484         return ret_ref;
45485 }
45486
45487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
45488         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45489         *ret_copy = ParseError_unknown_si_prefix();
45490         int64_t ret_ref = tag_ptr(ret_copy, true);
45491         return ret_ref;
45492 }
45493
45494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
45495         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45496         *ret_copy = ParseError_malformed_hrp();
45497         int64_t ret_ref = tag_ptr(ret_copy, true);
45498         return ret_ref;
45499 }
45500
45501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
45502         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45503         *ret_copy = ParseError_too_short_data_part();
45504         int64_t ret_ref = tag_ptr(ret_copy, true);
45505         return ret_ref;
45506 }
45507
45508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
45509         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45510         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
45511         int64_t ret_ref = tag_ptr(ret_copy, true);
45512         return ret_ref;
45513 }
45514
45515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
45516         
45517         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45518         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
45519         int64_t ret_ref = tag_ptr(ret_copy, true);
45520         return ret_ref;
45521 }
45522
45523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
45524         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45525         *ret_copy = ParseError_padding_error();
45526         int64_t ret_ref = tag_ptr(ret_copy, true);
45527         return ret_ref;
45528 }
45529
45530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
45531         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45532         *ret_copy = ParseError_integer_overflow_error();
45533         int64_t ret_ref = tag_ptr(ret_copy, true);
45534         return ret_ref;
45535 }
45536
45537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
45538         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45539         *ret_copy = ParseError_invalid_seg_wit_program_length();
45540         int64_t ret_ref = tag_ptr(ret_copy, true);
45541         return ret_ref;
45542 }
45543
45544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
45545         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45546         *ret_copy = ParseError_invalid_pub_key_hash_length();
45547         int64_t ret_ref = tag_ptr(ret_copy, true);
45548         return ret_ref;
45549 }
45550
45551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
45552         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45553         *ret_copy = ParseError_invalid_script_hash_length();
45554         int64_t ret_ref = tag_ptr(ret_copy, true);
45555         return ret_ref;
45556 }
45557
45558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
45559         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45560         *ret_copy = ParseError_invalid_recovery_id();
45561         int64_t ret_ref = tag_ptr(ret_copy, true);
45562         return ret_ref;
45563 }
45564
45565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
45566         LDKStr a_conv = java_to_owned_str(env, a);
45567         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45568         *ret_copy = ParseError_invalid_slice_length(a_conv);
45569         int64_t ret_ref = tag_ptr(ret_copy, true);
45570         return ret_ref;
45571 }
45572
45573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
45574         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45575         *ret_copy = ParseError_skip();
45576         int64_t ret_ref = tag_ptr(ret_copy, true);
45577         return ret_ref;
45578 }
45579
45580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45581         if (!ptr_is_owned(this_ptr)) return;
45582         void* this_ptr_ptr = untag_ptr(this_ptr);
45583         CHECK_ACCESS(this_ptr_ptr);
45584         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
45585         FREE(untag_ptr(this_ptr));
45586         ParseOrSemanticError_free(this_ptr_conv);
45587 }
45588
45589 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
45590         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45591         *ret_copy = ParseOrSemanticError_clone(arg);
45592         int64_t ret_ref = tag_ptr(ret_copy, true);
45593         return ret_ref;
45594 }
45595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45596         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
45597         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
45598         return ret_conv;
45599 }
45600
45601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45602         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
45603         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45604         *ret_copy = ParseOrSemanticError_clone(orig_conv);
45605         int64_t ret_ref = tag_ptr(ret_copy, true);
45606         return ret_ref;
45607 }
45608
45609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
45610         void* a_ptr = untag_ptr(a);
45611         CHECK_ACCESS(a_ptr);
45612         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
45613         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
45614         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45615         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
45616         int64_t ret_ref = tag_ptr(ret_copy, true);
45617         return ret_ref;
45618 }
45619
45620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
45621         LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
45622         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45623         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
45624         int64_t ret_ref = tag_ptr(ret_copy, true);
45625         return ret_ref;
45626 }
45627
45628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45629         LDKInvoice this_obj_conv;
45630         this_obj_conv.inner = untag_ptr(this_obj);
45631         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45633         Invoice_free(this_obj_conv);
45634 }
45635
45636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45637         LDKInvoice a_conv;
45638         a_conv.inner = untag_ptr(a);
45639         a_conv.is_owned = ptr_is_owned(a);
45640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45641         a_conv.is_owned = false;
45642         LDKInvoice b_conv;
45643         b_conv.inner = untag_ptr(b);
45644         b_conv.is_owned = ptr_is_owned(b);
45645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45646         b_conv.is_owned = false;
45647         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
45648         return ret_conv;
45649 }
45650
45651 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
45652         LDKInvoice ret_var = Invoice_clone(arg);
45653         int64_t ret_ref = 0;
45654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45656         return ret_ref;
45657 }
45658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45659         LDKInvoice arg_conv;
45660         arg_conv.inner = untag_ptr(arg);
45661         arg_conv.is_owned = ptr_is_owned(arg);
45662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45663         arg_conv.is_owned = false;
45664         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
45665         return ret_conv;
45666 }
45667
45668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45669         LDKInvoice orig_conv;
45670         orig_conv.inner = untag_ptr(orig);
45671         orig_conv.is_owned = ptr_is_owned(orig);
45672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45673         orig_conv.is_owned = false;
45674         LDKInvoice ret_var = Invoice_clone(&orig_conv);
45675         int64_t ret_ref = 0;
45676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45678         return ret_ref;
45679 }
45680
45681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45682         LDKSignedRawInvoice this_obj_conv;
45683         this_obj_conv.inner = untag_ptr(this_obj);
45684         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45686         SignedRawInvoice_free(this_obj_conv);
45687 }
45688
45689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45690         LDKSignedRawInvoice a_conv;
45691         a_conv.inner = untag_ptr(a);
45692         a_conv.is_owned = ptr_is_owned(a);
45693         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45694         a_conv.is_owned = false;
45695         LDKSignedRawInvoice b_conv;
45696         b_conv.inner = untag_ptr(b);
45697         b_conv.is_owned = ptr_is_owned(b);
45698         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45699         b_conv.is_owned = false;
45700         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
45701         return ret_conv;
45702 }
45703
45704 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
45705         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
45706         int64_t ret_ref = 0;
45707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45709         return ret_ref;
45710 }
45711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45712         LDKSignedRawInvoice arg_conv;
45713         arg_conv.inner = untag_ptr(arg);
45714         arg_conv.is_owned = ptr_is_owned(arg);
45715         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45716         arg_conv.is_owned = false;
45717         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
45718         return ret_conv;
45719 }
45720
45721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45722         LDKSignedRawInvoice orig_conv;
45723         orig_conv.inner = untag_ptr(orig);
45724         orig_conv.is_owned = ptr_is_owned(orig);
45725         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45726         orig_conv.is_owned = false;
45727         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
45728         int64_t ret_ref = 0;
45729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45731         return ret_ref;
45732 }
45733
45734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45735         LDKRawInvoice this_obj_conv;
45736         this_obj_conv.inner = untag_ptr(this_obj);
45737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45739         RawInvoice_free(this_obj_conv);
45740 }
45741
45742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45743         LDKRawInvoice this_ptr_conv;
45744         this_ptr_conv.inner = untag_ptr(this_ptr);
45745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45747         this_ptr_conv.is_owned = false;
45748         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
45749         int64_t ret_ref = 0;
45750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45752         return ret_ref;
45753 }
45754
45755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45756         LDKRawInvoice this_ptr_conv;
45757         this_ptr_conv.inner = untag_ptr(this_ptr);
45758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45760         this_ptr_conv.is_owned = false;
45761         LDKRawDataPart val_conv;
45762         val_conv.inner = untag_ptr(val);
45763         val_conv.is_owned = ptr_is_owned(val);
45764         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45765         val_conv = RawDataPart_clone(&val_conv);
45766         RawInvoice_set_data(&this_ptr_conv, val_conv);
45767 }
45768
45769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45770         LDKRawInvoice a_conv;
45771         a_conv.inner = untag_ptr(a);
45772         a_conv.is_owned = ptr_is_owned(a);
45773         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45774         a_conv.is_owned = false;
45775         LDKRawInvoice b_conv;
45776         b_conv.inner = untag_ptr(b);
45777         b_conv.is_owned = ptr_is_owned(b);
45778         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45779         b_conv.is_owned = false;
45780         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
45781         return ret_conv;
45782 }
45783
45784 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
45785         LDKRawInvoice ret_var = RawInvoice_clone(arg);
45786         int64_t ret_ref = 0;
45787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45789         return ret_ref;
45790 }
45791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45792         LDKRawInvoice arg_conv;
45793         arg_conv.inner = untag_ptr(arg);
45794         arg_conv.is_owned = ptr_is_owned(arg);
45795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45796         arg_conv.is_owned = false;
45797         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
45798         return ret_conv;
45799 }
45800
45801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45802         LDKRawInvoice orig_conv;
45803         orig_conv.inner = untag_ptr(orig);
45804         orig_conv.is_owned = ptr_is_owned(orig);
45805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45806         orig_conv.is_owned = false;
45807         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
45808         int64_t ret_ref = 0;
45809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45811         return ret_ref;
45812 }
45813
45814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45815         LDKRawDataPart this_obj_conv;
45816         this_obj_conv.inner = untag_ptr(this_obj);
45817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45819         RawDataPart_free(this_obj_conv);
45820 }
45821
45822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
45823         LDKRawDataPart this_ptr_conv;
45824         this_ptr_conv.inner = untag_ptr(this_ptr);
45825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45827         this_ptr_conv.is_owned = false;
45828         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
45829         int64_t ret_ref = 0;
45830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45832         return ret_ref;
45833 }
45834
45835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45836         LDKRawDataPart this_ptr_conv;
45837         this_ptr_conv.inner = untag_ptr(this_ptr);
45838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45840         this_ptr_conv.is_owned = false;
45841         LDKPositiveTimestamp val_conv;
45842         val_conv.inner = untag_ptr(val);
45843         val_conv.is_owned = ptr_is_owned(val);
45844         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45845         val_conv = PositiveTimestamp_clone(&val_conv);
45846         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
45847 }
45848
45849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45850         LDKRawDataPart a_conv;
45851         a_conv.inner = untag_ptr(a);
45852         a_conv.is_owned = ptr_is_owned(a);
45853         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45854         a_conv.is_owned = false;
45855         LDKRawDataPart b_conv;
45856         b_conv.inner = untag_ptr(b);
45857         b_conv.is_owned = ptr_is_owned(b);
45858         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45859         b_conv.is_owned = false;
45860         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
45861         return ret_conv;
45862 }
45863
45864 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
45865         LDKRawDataPart ret_var = RawDataPart_clone(arg);
45866         int64_t ret_ref = 0;
45867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45869         return ret_ref;
45870 }
45871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45872         LDKRawDataPart arg_conv;
45873         arg_conv.inner = untag_ptr(arg);
45874         arg_conv.is_owned = ptr_is_owned(arg);
45875         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45876         arg_conv.is_owned = false;
45877         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
45878         return ret_conv;
45879 }
45880
45881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45882         LDKRawDataPart orig_conv;
45883         orig_conv.inner = untag_ptr(orig);
45884         orig_conv.is_owned = ptr_is_owned(orig);
45885         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45886         orig_conv.is_owned = false;
45887         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
45888         int64_t ret_ref = 0;
45889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45891         return ret_ref;
45892 }
45893
45894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45895         LDKPositiveTimestamp this_obj_conv;
45896         this_obj_conv.inner = untag_ptr(this_obj);
45897         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45899         PositiveTimestamp_free(this_obj_conv);
45900 }
45901
45902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45903         LDKPositiveTimestamp a_conv;
45904         a_conv.inner = untag_ptr(a);
45905         a_conv.is_owned = ptr_is_owned(a);
45906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45907         a_conv.is_owned = false;
45908         LDKPositiveTimestamp b_conv;
45909         b_conv.inner = untag_ptr(b);
45910         b_conv.is_owned = ptr_is_owned(b);
45911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45912         b_conv.is_owned = false;
45913         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
45914         return ret_conv;
45915 }
45916
45917 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
45918         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
45919         int64_t ret_ref = 0;
45920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45922         return ret_ref;
45923 }
45924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45925         LDKPositiveTimestamp arg_conv;
45926         arg_conv.inner = untag_ptr(arg);
45927         arg_conv.is_owned = ptr_is_owned(arg);
45928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45929         arg_conv.is_owned = false;
45930         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
45931         return ret_conv;
45932 }
45933
45934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45935         LDKPositiveTimestamp orig_conv;
45936         orig_conv.inner = untag_ptr(orig);
45937         orig_conv.is_owned = ptr_is_owned(orig);
45938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45939         orig_conv.is_owned = false;
45940         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
45941         int64_t ret_ref = 0;
45942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45944         return ret_ref;
45945 }
45946
45947 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45948         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
45949         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
45950         return ret_conv;
45951 }
45952
45953 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
45954         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
45955         return ret_conv;
45956 }
45957
45958 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
45959         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
45960         return ret_conv;
45961 }
45962
45963 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
45964         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
45965         return ret_conv;
45966 }
45967
45968 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
45969         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
45970         return ret_conv;
45971 }
45972
45973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45974         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
45975         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
45976         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
45977         return ret_conv;
45978 }
45979
45980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
45981         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
45982         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
45983         return ret_conv;
45984 }
45985
45986 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45987         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
45988         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
45989         return ret_conv;
45990 }
45991
45992 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
45993         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
45994         return ret_conv;
45995 }
45996
45997 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
45998         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
45999         return ret_conv;
46000 }
46001
46002 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
46003         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
46004         return ret_conv;
46005 }
46006
46007 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
46008         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
46009         return ret_conv;
46010 }
46011
46012 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
46013         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
46014         return ret_conv;
46015 }
46016
46017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
46018         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
46019         int64_t ret_conv = Currency_hash(o_conv);
46020         return ret_conv;
46021 }
46022
46023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46024         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
46025         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
46026         jboolean ret_conv = Currency_eq(a_conv, b_conv);
46027         return ret_conv;
46028 }
46029
46030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46031         LDKSha256 this_obj_conv;
46032         this_obj_conv.inner = untag_ptr(this_obj);
46033         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46035         Sha256_free(this_obj_conv);
46036 }
46037
46038 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
46039         LDKSha256 ret_var = Sha256_clone(arg);
46040         int64_t ret_ref = 0;
46041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46043         return ret_ref;
46044 }
46045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46046         LDKSha256 arg_conv;
46047         arg_conv.inner = untag_ptr(arg);
46048         arg_conv.is_owned = ptr_is_owned(arg);
46049         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46050         arg_conv.is_owned = false;
46051         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
46052         return ret_conv;
46053 }
46054
46055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46056         LDKSha256 orig_conv;
46057         orig_conv.inner = untag_ptr(orig);
46058         orig_conv.is_owned = ptr_is_owned(orig);
46059         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46060         orig_conv.is_owned = false;
46061         LDKSha256 ret_var = Sha256_clone(&orig_conv);
46062         int64_t ret_ref = 0;
46063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46065         return ret_ref;
46066 }
46067
46068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
46069         LDKSha256 o_conv;
46070         o_conv.inner = untag_ptr(o);
46071         o_conv.is_owned = ptr_is_owned(o);
46072         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46073         o_conv.is_owned = false;
46074         int64_t ret_conv = Sha256_hash(&o_conv);
46075         return ret_conv;
46076 }
46077
46078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46079         LDKSha256 a_conv;
46080         a_conv.inner = untag_ptr(a);
46081         a_conv.is_owned = ptr_is_owned(a);
46082         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46083         a_conv.is_owned = false;
46084         LDKSha256 b_conv;
46085         b_conv.inner = untag_ptr(b);
46086         b_conv.is_owned = ptr_is_owned(b);
46087         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46088         b_conv.is_owned = false;
46089         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
46090         return ret_conv;
46091 }
46092
46093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46094         LDKDescription this_obj_conv;
46095         this_obj_conv.inner = untag_ptr(this_obj);
46096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46098         Description_free(this_obj_conv);
46099 }
46100
46101 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
46102         LDKDescription ret_var = Description_clone(arg);
46103         int64_t ret_ref = 0;
46104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46106         return ret_ref;
46107 }
46108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46109         LDKDescription arg_conv;
46110         arg_conv.inner = untag_ptr(arg);
46111         arg_conv.is_owned = ptr_is_owned(arg);
46112         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46113         arg_conv.is_owned = false;
46114         int64_t ret_conv = Description_clone_ptr(&arg_conv);
46115         return ret_conv;
46116 }
46117
46118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46119         LDKDescription orig_conv;
46120         orig_conv.inner = untag_ptr(orig);
46121         orig_conv.is_owned = ptr_is_owned(orig);
46122         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46123         orig_conv.is_owned = false;
46124         LDKDescription ret_var = Description_clone(&orig_conv);
46125         int64_t ret_ref = 0;
46126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46128         return ret_ref;
46129 }
46130
46131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
46132         LDKDescription o_conv;
46133         o_conv.inner = untag_ptr(o);
46134         o_conv.is_owned = ptr_is_owned(o);
46135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46136         o_conv.is_owned = false;
46137         int64_t ret_conv = Description_hash(&o_conv);
46138         return ret_conv;
46139 }
46140
46141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46142         LDKDescription a_conv;
46143         a_conv.inner = untag_ptr(a);
46144         a_conv.is_owned = ptr_is_owned(a);
46145         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46146         a_conv.is_owned = false;
46147         LDKDescription b_conv;
46148         b_conv.inner = untag_ptr(b);
46149         b_conv.is_owned = ptr_is_owned(b);
46150         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46151         b_conv.is_owned = false;
46152         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
46153         return ret_conv;
46154 }
46155
46156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46157         LDKPayeePubKey this_obj_conv;
46158         this_obj_conv.inner = untag_ptr(this_obj);
46159         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46161         PayeePubKey_free(this_obj_conv);
46162 }
46163
46164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46165         LDKPayeePubKey this_ptr_conv;
46166         this_ptr_conv.inner = untag_ptr(this_ptr);
46167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46169         this_ptr_conv.is_owned = false;
46170         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
46172         return ret_arr;
46173 }
46174
46175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46176         LDKPayeePubKey this_ptr_conv;
46177         this_ptr_conv.inner = untag_ptr(this_ptr);
46178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46180         this_ptr_conv.is_owned = false;
46181         LDKPublicKey val_ref;
46182         CHECK((*env)->GetArrayLength(env, val) == 33);
46183         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46184         PayeePubKey_set_a(&this_ptr_conv, val_ref);
46185 }
46186
46187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
46188         LDKPublicKey a_arg_ref;
46189         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
46190         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
46191         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
46192         int64_t ret_ref = 0;
46193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46195         return ret_ref;
46196 }
46197
46198 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
46199         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
46200         int64_t ret_ref = 0;
46201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46203         return ret_ref;
46204 }
46205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46206         LDKPayeePubKey arg_conv;
46207         arg_conv.inner = untag_ptr(arg);
46208         arg_conv.is_owned = ptr_is_owned(arg);
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46210         arg_conv.is_owned = false;
46211         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
46212         return ret_conv;
46213 }
46214
46215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46216         LDKPayeePubKey orig_conv;
46217         orig_conv.inner = untag_ptr(orig);
46218         orig_conv.is_owned = ptr_is_owned(orig);
46219         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46220         orig_conv.is_owned = false;
46221         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
46222         int64_t ret_ref = 0;
46223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46225         return ret_ref;
46226 }
46227
46228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
46229         LDKPayeePubKey o_conv;
46230         o_conv.inner = untag_ptr(o);
46231         o_conv.is_owned = ptr_is_owned(o);
46232         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46233         o_conv.is_owned = false;
46234         int64_t ret_conv = PayeePubKey_hash(&o_conv);
46235         return ret_conv;
46236 }
46237
46238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46239         LDKPayeePubKey a_conv;
46240         a_conv.inner = untag_ptr(a);
46241         a_conv.is_owned = ptr_is_owned(a);
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46243         a_conv.is_owned = false;
46244         LDKPayeePubKey b_conv;
46245         b_conv.inner = untag_ptr(b);
46246         b_conv.is_owned = ptr_is_owned(b);
46247         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46248         b_conv.is_owned = false;
46249         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
46250         return ret_conv;
46251 }
46252
46253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46254         LDKExpiryTime this_obj_conv;
46255         this_obj_conv.inner = untag_ptr(this_obj);
46256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46258         ExpiryTime_free(this_obj_conv);
46259 }
46260
46261 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
46262         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
46263         int64_t ret_ref = 0;
46264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46266         return ret_ref;
46267 }
46268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46269         LDKExpiryTime arg_conv;
46270         arg_conv.inner = untag_ptr(arg);
46271         arg_conv.is_owned = ptr_is_owned(arg);
46272         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46273         arg_conv.is_owned = false;
46274         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
46275         return ret_conv;
46276 }
46277
46278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46279         LDKExpiryTime orig_conv;
46280         orig_conv.inner = untag_ptr(orig);
46281         orig_conv.is_owned = ptr_is_owned(orig);
46282         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46283         orig_conv.is_owned = false;
46284         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
46285         int64_t ret_ref = 0;
46286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46288         return ret_ref;
46289 }
46290
46291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
46292         LDKExpiryTime o_conv;
46293         o_conv.inner = untag_ptr(o);
46294         o_conv.is_owned = ptr_is_owned(o);
46295         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46296         o_conv.is_owned = false;
46297         int64_t ret_conv = ExpiryTime_hash(&o_conv);
46298         return ret_conv;
46299 }
46300
46301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46302         LDKExpiryTime a_conv;
46303         a_conv.inner = untag_ptr(a);
46304         a_conv.is_owned = ptr_is_owned(a);
46305         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46306         a_conv.is_owned = false;
46307         LDKExpiryTime b_conv;
46308         b_conv.inner = untag_ptr(b);
46309         b_conv.is_owned = ptr_is_owned(b);
46310         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46311         b_conv.is_owned = false;
46312         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
46313         return ret_conv;
46314 }
46315
46316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46317         LDKMinFinalCltvExpiry this_obj_conv;
46318         this_obj_conv.inner = untag_ptr(this_obj);
46319         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46321         MinFinalCltvExpiry_free(this_obj_conv);
46322 }
46323
46324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46325         LDKMinFinalCltvExpiry this_ptr_conv;
46326         this_ptr_conv.inner = untag_ptr(this_ptr);
46327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46329         this_ptr_conv.is_owned = false;
46330         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
46331         return ret_conv;
46332 }
46333
46334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46335         LDKMinFinalCltvExpiry this_ptr_conv;
46336         this_ptr_conv.inner = untag_ptr(this_ptr);
46337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46339         this_ptr_conv.is_owned = false;
46340         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
46341 }
46342
46343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
46344         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
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 MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
46352         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_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_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46359         LDKMinFinalCltvExpiry 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 = MinFinalCltvExpiry_clone_ptr(&arg_conv);
46365         return ret_conv;
46366 }
46367
46368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46369         LDKMinFinalCltvExpiry 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         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_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_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
46382         LDKMinFinalCltvExpiry 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 = MinFinalCltvExpiry_hash(&o_conv);
46388         return ret_conv;
46389 }
46390
46391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46392         LDKMinFinalCltvExpiry 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         LDKMinFinalCltvExpiry 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 = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
46403         return ret_conv;
46404 }
46405
46406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46407         if (!ptr_is_owned(this_ptr)) return;
46408         void* this_ptr_ptr = untag_ptr(this_ptr);
46409         CHECK_ACCESS(this_ptr_ptr);
46410         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
46411         FREE(untag_ptr(this_ptr));
46412         Fallback_free(this_ptr_conv);
46413 }
46414
46415 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
46416         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46417         *ret_copy = Fallback_clone(arg);
46418         int64_t ret_ref = tag_ptr(ret_copy, true);
46419         return ret_ref;
46420 }
46421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46422         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
46423         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
46424         return ret_conv;
46425 }
46426
46427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46428         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
46429         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46430         *ret_copy = Fallback_clone(orig_conv);
46431         int64_t ret_ref = tag_ptr(ret_copy, true);
46432         return ret_ref;
46433 }
46434
46435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
46436         
46437         LDKCVec_u8Z program_ref;
46438         program_ref.datalen = (*env)->GetArrayLength(env, program);
46439         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
46440         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
46441         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46442         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
46443         int64_t ret_ref = tag_ptr(ret_copy, true);
46444         return ret_ref;
46445 }
46446
46447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46448         LDKTwentyBytes a_ref;
46449         CHECK((*env)->GetArrayLength(env, a) == 20);
46450         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46451         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46452         *ret_copy = Fallback_pub_key_hash(a_ref);
46453         int64_t ret_ref = tag_ptr(ret_copy, true);
46454         return ret_ref;
46455 }
46456
46457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46458         LDKTwentyBytes a_ref;
46459         CHECK((*env)->GetArrayLength(env, a) == 20);
46460         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46461         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46462         *ret_copy = Fallback_script_hash(a_ref);
46463         int64_t ret_ref = tag_ptr(ret_copy, true);
46464         return ret_ref;
46465 }
46466
46467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
46468         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
46469         int64_t ret_conv = Fallback_hash(o_conv);
46470         return ret_conv;
46471 }
46472
46473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46474         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
46475         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
46476         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
46477         return ret_conv;
46478 }
46479
46480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46481         LDKInvoiceSignature this_obj_conv;
46482         this_obj_conv.inner = untag_ptr(this_obj);
46483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46485         InvoiceSignature_free(this_obj_conv);
46486 }
46487
46488 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
46489         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
46490         int64_t ret_ref = 0;
46491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46493         return ret_ref;
46494 }
46495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46496         LDKInvoiceSignature arg_conv;
46497         arg_conv.inner = untag_ptr(arg);
46498         arg_conv.is_owned = ptr_is_owned(arg);
46499         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46500         arg_conv.is_owned = false;
46501         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
46502         return ret_conv;
46503 }
46504
46505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46506         LDKInvoiceSignature orig_conv;
46507         orig_conv.inner = untag_ptr(orig);
46508         orig_conv.is_owned = ptr_is_owned(orig);
46509         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46510         orig_conv.is_owned = false;
46511         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
46512         int64_t ret_ref = 0;
46513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46515         return ret_ref;
46516 }
46517
46518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46519         LDKInvoiceSignature a_conv;
46520         a_conv.inner = untag_ptr(a);
46521         a_conv.is_owned = ptr_is_owned(a);
46522         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46523         a_conv.is_owned = false;
46524         LDKInvoiceSignature b_conv;
46525         b_conv.inner = untag_ptr(b);
46526         b_conv.is_owned = ptr_is_owned(b);
46527         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46528         b_conv.is_owned = false;
46529         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
46530         return ret_conv;
46531 }
46532
46533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46534         LDKPrivateRoute this_obj_conv;
46535         this_obj_conv.inner = untag_ptr(this_obj);
46536         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46538         PrivateRoute_free(this_obj_conv);
46539 }
46540
46541 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
46542         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
46543         int64_t ret_ref = 0;
46544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46546         return ret_ref;
46547 }
46548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46549         LDKPrivateRoute arg_conv;
46550         arg_conv.inner = untag_ptr(arg);
46551         arg_conv.is_owned = ptr_is_owned(arg);
46552         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46553         arg_conv.is_owned = false;
46554         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
46555         return ret_conv;
46556 }
46557
46558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46559         LDKPrivateRoute orig_conv;
46560         orig_conv.inner = untag_ptr(orig);
46561         orig_conv.is_owned = ptr_is_owned(orig);
46562         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46563         orig_conv.is_owned = false;
46564         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
46565         int64_t ret_ref = 0;
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46568         return ret_ref;
46569 }
46570
46571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
46572         LDKPrivateRoute o_conv;
46573         o_conv.inner = untag_ptr(o);
46574         o_conv.is_owned = ptr_is_owned(o);
46575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46576         o_conv.is_owned = false;
46577         int64_t ret_conv = PrivateRoute_hash(&o_conv);
46578         return ret_conv;
46579 }
46580
46581 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46582         LDKPrivateRoute a_conv;
46583         a_conv.inner = untag_ptr(a);
46584         a_conv.is_owned = ptr_is_owned(a);
46585         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46586         a_conv.is_owned = false;
46587         LDKPrivateRoute b_conv;
46588         b_conv.inner = untag_ptr(b);
46589         b_conv.is_owned = ptr_is_owned(b);
46590         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46591         b_conv.is_owned = false;
46592         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
46593         return ret_conv;
46594 }
46595
46596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
46597         LDKSignedRawInvoice this_arg_conv;
46598         this_arg_conv.inner = untag_ptr(this_arg);
46599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46601         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
46602         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
46603         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
46604         return tag_ptr(ret_conv, true);
46605 }
46606
46607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
46608         LDKSignedRawInvoice this_arg_conv;
46609         this_arg_conv.inner = untag_ptr(this_arg);
46610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46612         this_arg_conv.is_owned = false;
46613         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
46614         int64_t ret_ref = 0;
46615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46617         return ret_ref;
46618 }
46619
46620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46621         LDKSignedRawInvoice this_arg_conv;
46622         this_arg_conv.inner = untag_ptr(this_arg);
46623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46625         this_arg_conv.is_owned = false;
46626         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46627         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
46628         return ret_arr;
46629 }
46630
46631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46632         LDKSignedRawInvoice this_arg_conv;
46633         this_arg_conv.inner = untag_ptr(this_arg);
46634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46636         this_arg_conv.is_owned = false;
46637         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
46638         int64_t ret_ref = 0;
46639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46641         return ret_ref;
46642 }
46643
46644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46645         LDKSignedRawInvoice this_arg_conv;
46646         this_arg_conv.inner = untag_ptr(this_arg);
46647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46649         this_arg_conv.is_owned = false;
46650         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
46651         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
46652         return tag_ptr(ret_conv, true);
46653 }
46654
46655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46656         LDKSignedRawInvoice this_arg_conv;
46657         this_arg_conv.inner = untag_ptr(this_arg);
46658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46660         this_arg_conv.is_owned = false;
46661         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
46662         return ret_conv;
46663 }
46664
46665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46666         LDKRawInvoice this_arg_conv;
46667         this_arg_conv.inner = untag_ptr(this_arg);
46668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46670         this_arg_conv.is_owned = false;
46671         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46672         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
46673         return ret_arr;
46674 }
46675
46676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46677         LDKRawInvoice this_arg_conv;
46678         this_arg_conv.inner = untag_ptr(this_arg);
46679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46681         this_arg_conv.is_owned = false;
46682         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
46683         int64_t ret_ref = 0;
46684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46686         return ret_ref;
46687 }
46688
46689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
46690         LDKRawInvoice this_arg_conv;
46691         this_arg_conv.inner = untag_ptr(this_arg);
46692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46694         this_arg_conv.is_owned = false;
46695         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
46696         int64_t ret_ref = 0;
46697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46699         return ret_ref;
46700 }
46701
46702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46703         LDKRawInvoice this_arg_conv;
46704         this_arg_conv.inner = untag_ptr(this_arg);
46705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46707         this_arg_conv.is_owned = false;
46708         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
46709         int64_t ret_ref = 0;
46710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46712         return ret_ref;
46713 }
46714
46715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46716         LDKRawInvoice this_arg_conv;
46717         this_arg_conv.inner = untag_ptr(this_arg);
46718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46720         this_arg_conv.is_owned = false;
46721         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
46722         int64_t ret_ref = 0;
46723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46725         return ret_ref;
46726 }
46727
46728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
46729         LDKRawInvoice this_arg_conv;
46730         this_arg_conv.inner = untag_ptr(this_arg);
46731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46733         this_arg_conv.is_owned = false;
46734         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
46735         int64_t ret_ref = 0;
46736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46738         return ret_ref;
46739 }
46740
46741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
46742         LDKRawInvoice this_arg_conv;
46743         this_arg_conv.inner = untag_ptr(this_arg);
46744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46746         this_arg_conv.is_owned = false;
46747         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
46748         int64_t ret_ref = 0;
46749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46751         return ret_ref;
46752 }
46753
46754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
46755         LDKRawInvoice this_arg_conv;
46756         this_arg_conv.inner = untag_ptr(this_arg);
46757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46759         this_arg_conv.is_owned = false;
46760         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46761         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
46762         return ret_arr;
46763 }
46764
46765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
46766         LDKRawInvoice this_arg_conv;
46767         this_arg_conv.inner = untag_ptr(this_arg);
46768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46770         this_arg_conv.is_owned = false;
46771         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
46772         int64_t ret_ref = 0;
46773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46775         return ret_ref;
46776 }
46777
46778 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
46779         LDKRawInvoice this_arg_conv;
46780         this_arg_conv.inner = untag_ptr(this_arg);
46781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46783         this_arg_conv.is_owned = false;
46784         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
46785         int64_tArray ret_arr = NULL;
46786         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46787         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46788         for (size_t o = 0; o < ret_var.datalen; o++) {
46789                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
46790                 int64_t ret_conv_14_ref = 0;
46791                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46792                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46793                 ret_arr_ptr[o] = ret_conv_14_ref;
46794         }
46795         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46796         FREE(ret_var.data);
46797         return ret_arr;
46798 }
46799
46800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
46801         LDKRawInvoice this_arg_conv;
46802         this_arg_conv.inner = untag_ptr(this_arg);
46803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46805         this_arg_conv.is_owned = false;
46806         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46807         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
46808         int64_t ret_ref = tag_ptr(ret_copy, true);
46809         return ret_ref;
46810 }
46811
46812 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
46813         LDKRawInvoice this_arg_conv;
46814         this_arg_conv.inner = untag_ptr(this_arg);
46815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46817         this_arg_conv.is_owned = false;
46818         jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
46819         return ret_conv;
46820 }
46821
46822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
46823         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
46824         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
46825         return tag_ptr(ret_conv, true);
46826 }
46827
46828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
46829         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
46830         *ret_conv = PositiveTimestamp_from_system_time(time);
46831         return tag_ptr(ret_conv, true);
46832 }
46833
46834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
46835         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
46836         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
46837         return tag_ptr(ret_conv, true);
46838 }
46839
46840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
46841         LDKPositiveTimestamp this_arg_conv;
46842         this_arg_conv.inner = untag_ptr(this_arg);
46843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46845         this_arg_conv.is_owned = false;
46846         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
46847         return ret_conv;
46848 }
46849
46850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
46851         LDKPositiveTimestamp this_arg_conv;
46852         this_arg_conv.inner = untag_ptr(this_arg);
46853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46855         this_arg_conv.is_owned = false;
46856         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
46857         return ret_conv;
46858 }
46859
46860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
46861         LDKPositiveTimestamp this_arg_conv;
46862         this_arg_conv.inner = untag_ptr(this_arg);
46863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46865         this_arg_conv.is_owned = false;
46866         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
46867         return ret_conv;
46868 }
46869
46870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
46871         LDKInvoice this_arg_conv;
46872         this_arg_conv.inner = untag_ptr(this_arg);
46873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46875         this_arg_conv = Invoice_clone(&this_arg_conv);
46876         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
46877         int64_t ret_ref = 0;
46878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46880         return ret_ref;
46881 }
46882
46883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46884         LDKInvoice this_arg_conv;
46885         this_arg_conv.inner = untag_ptr(this_arg);
46886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46888         this_arg_conv.is_owned = false;
46889         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
46890         *ret_conv = Invoice_check_signature(&this_arg_conv);
46891         return tag_ptr(ret_conv, true);
46892 }
46893
46894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
46895         LDKSignedRawInvoice signed_invoice_conv;
46896         signed_invoice_conv.inner = untag_ptr(signed_invoice);
46897         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
46898         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
46899         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
46900         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
46901         *ret_conv = Invoice_from_signed(signed_invoice_conv);
46902         return tag_ptr(ret_conv, true);
46903 }
46904
46905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
46906         LDKInvoice this_arg_conv;
46907         this_arg_conv.inner = untag_ptr(this_arg);
46908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46910         this_arg_conv.is_owned = false;
46911         int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
46912         return ret_conv;
46913 }
46914
46915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
46916         LDKInvoice this_arg_conv;
46917         this_arg_conv.inner = untag_ptr(this_arg);
46918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46920         this_arg_conv.is_owned = false;
46921         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
46922         return ret_conv;
46923 }
46924
46925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46926         LDKInvoice this_arg_conv;
46927         this_arg_conv.inner = untag_ptr(this_arg);
46928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46930         this_arg_conv.is_owned = false;
46931         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46932         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
46933         return ret_arr;
46934 }
46935
46936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46937         LDKInvoice this_arg_conv;
46938         this_arg_conv.inner = untag_ptr(this_arg);
46939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46941         this_arg_conv.is_owned = false;
46942         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46943         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
46944         return ret_arr;
46945 }
46946
46947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
46948         LDKInvoice this_arg_conv;
46949         this_arg_conv.inner = untag_ptr(this_arg);
46950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46952         this_arg_conv.is_owned = false;
46953         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46954         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
46955         return ret_arr;
46956 }
46957
46958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
46959         LDKInvoice this_arg_conv;
46960         this_arg_conv.inner = untag_ptr(this_arg);
46961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46963         this_arg_conv.is_owned = false;
46964         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
46965         int64_t ret_ref = 0;
46966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46968         return ret_ref;
46969 }
46970
46971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46972         LDKInvoice this_arg_conv;
46973         this_arg_conv.inner = untag_ptr(this_arg);
46974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46976         this_arg_conv.is_owned = false;
46977         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46978         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
46979         return ret_arr;
46980 }
46981
46982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
46983         LDKInvoice this_arg_conv;
46984         this_arg_conv.inner = untag_ptr(this_arg);
46985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46987         this_arg_conv.is_owned = false;
46988         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
46989         return ret_conv;
46990 }
46991
46992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
46993         LDKInvoice this_arg_conv;
46994         this_arg_conv.inner = untag_ptr(this_arg);
46995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46997         this_arg_conv.is_owned = false;
46998         jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
46999         return ret_conv;
47000 }
47001
47002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
47003         LDKInvoice this_arg_conv;
47004         this_arg_conv.inner = untag_ptr(this_arg);
47005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47007         this_arg_conv.is_owned = false;
47008         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
47009         return ret_conv;
47010 }
47011
47012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
47013         LDKInvoice this_arg_conv;
47014         this_arg_conv.inner = untag_ptr(this_arg);
47015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47017         this_arg_conv.is_owned = false;
47018         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
47019         return ret_conv;
47020 }
47021
47022 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
47023         LDKInvoice this_arg_conv;
47024         this_arg_conv.inner = untag_ptr(this_arg);
47025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47027         this_arg_conv.is_owned = false;
47028         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
47029         int64_tArray ret_arr = NULL;
47030         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47031         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47032         for (size_t o = 0; o < ret_var.datalen; o++) {
47033                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47034                 int64_t ret_conv_14_ref = 0;
47035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47036                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47037                 ret_arr_ptr[o] = ret_conv_14_ref;
47038         }
47039         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47040         FREE(ret_var.data);
47041         return ret_arr;
47042 }
47043
47044 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
47045         LDKInvoice this_arg_conv;
47046         this_arg_conv.inner = untag_ptr(this_arg);
47047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47049         this_arg_conv.is_owned = false;
47050         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
47051         int64_tArray ret_arr = NULL;
47052         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47053         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47054         for (size_t l = 0; l < ret_var.datalen; l++) {
47055                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
47056                 int64_t ret_conv_11_ref = 0;
47057                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
47058                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
47059                 ret_arr_ptr[l] = ret_conv_11_ref;
47060         }
47061         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47062         FREE(ret_var.data);
47063         return ret_arr;
47064 }
47065
47066 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47067         LDKInvoice this_arg_conv;
47068         this_arg_conv.inner = untag_ptr(this_arg);
47069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47071         this_arg_conv.is_owned = false;
47072         jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
47073         return ret_conv;
47074 }
47075
47076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
47077         LDKInvoice this_arg_conv;
47078         this_arg_conv.inner = untag_ptr(this_arg);
47079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47081         this_arg_conv.is_owned = false;
47082         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47083         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
47084         int64_t ret_ref = tag_ptr(ret_copy, true);
47085         return ret_ref;
47086 }
47087
47088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
47089         LDKStr description_conv = java_to_owned_str(env, description);
47090         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
47091         *ret_conv = Description_new(description_conv);
47092         return tag_ptr(ret_conv, true);
47093 }
47094
47095 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47096         LDKDescription this_arg_conv;
47097         this_arg_conv.inner = untag_ptr(this_arg);
47098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47100         this_arg_conv = Description_clone(&this_arg_conv);
47101         LDKStr ret_str = Description_into_inner(this_arg_conv);
47102         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47103         Str_free(ret_str);
47104         return ret_conv;
47105 }
47106
47107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
47108         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
47109         int64_t ret_ref = 0;
47110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47112         return ret_ref;
47113 }
47114
47115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
47116         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
47117         int64_t ret_ref = 0;
47118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47120         return ret_ref;
47121 }
47122
47123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
47124         LDKExpiryTime this_arg_conv;
47125         this_arg_conv.inner = untag_ptr(this_arg);
47126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47128         this_arg_conv.is_owned = false;
47129         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
47130         return ret_conv;
47131 }
47132
47133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
47134         LDKExpiryTime this_arg_conv;
47135         this_arg_conv.inner = untag_ptr(this_arg);
47136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47138         this_arg_conv.is_owned = false;
47139         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
47140         return ret_conv;
47141 }
47142
47143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
47144         LDKRouteHint hops_conv;
47145         hops_conv.inner = untag_ptr(hops);
47146         hops_conv.is_owned = ptr_is_owned(hops);
47147         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
47148         hops_conv = RouteHint_clone(&hops_conv);
47149         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
47150         *ret_conv = PrivateRoute_new(hops_conv);
47151         return tag_ptr(ret_conv, true);
47152 }
47153
47154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47155         LDKPrivateRoute this_arg_conv;
47156         this_arg_conv.inner = untag_ptr(this_arg);
47157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47159         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
47160         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
47161         int64_t ret_ref = 0;
47162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47164         return ret_ref;
47165 }
47166
47167 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47168         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
47169         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
47170         return ret_conv;
47171 }
47172
47173 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
47174         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
47175         return ret_conv;
47176 }
47177
47178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
47179         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
47180         return ret_conv;
47181 }
47182
47183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
47184         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
47185         return ret_conv;
47186 }
47187
47188 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
47189         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
47190         return ret_conv;
47191 }
47192
47193 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
47194         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
47195         return ret_conv;
47196 }
47197
47198 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47199         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
47200         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
47201         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
47202         return ret_conv;
47203 }
47204
47205 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47206         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
47207         LDKStr ret_str = CreationError_to_str(o_conv);
47208         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47209         Str_free(ret_str);
47210         return ret_conv;
47211 }
47212
47213 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47214         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
47215         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
47216         return ret_conv;
47217 }
47218
47219 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
47220         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
47221         return ret_conv;
47222 }
47223
47224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
47225         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
47226         return ret_conv;
47227 }
47228
47229 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
47230         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
47231         return ret_conv;
47232 }
47233
47234 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
47235         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
47236         return ret_conv;
47237 }
47238
47239 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
47240         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
47241         return ret_conv;
47242 }
47243
47244 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
47245         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
47246         return ret_conv;
47247 }
47248
47249 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
47250         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
47251         return ret_conv;
47252 }
47253
47254 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
47255         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
47256         return ret_conv;
47257 }
47258
47259 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
47260         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
47261         return ret_conv;
47262 }
47263
47264 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
47265         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
47266         return ret_conv;
47267 }
47268
47269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47270         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
47271         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
47272         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
47273         return ret_conv;
47274 }
47275
47276 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47277         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
47278         LDKStr ret_str = SemanticError_to_str(o_conv);
47279         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47280         Str_free(ret_str);
47281         return ret_conv;
47282 }
47283
47284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47285         if (!ptr_is_owned(this_ptr)) return;
47286         void* this_ptr_ptr = untag_ptr(this_ptr);
47287         CHECK_ACCESS(this_ptr_ptr);
47288         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
47289         FREE(untag_ptr(this_ptr));
47290         SignOrCreationError_free(this_ptr_conv);
47291 }
47292
47293 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
47294         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47295         *ret_copy = SignOrCreationError_clone(arg);
47296         int64_t ret_ref = tag_ptr(ret_copy, true);
47297         return ret_ref;
47298 }
47299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47300         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
47301         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
47302         return ret_conv;
47303 }
47304
47305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47306         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
47307         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47308         *ret_copy = SignOrCreationError_clone(orig_conv);
47309         int64_t ret_ref = tag_ptr(ret_copy, true);
47310         return ret_ref;
47311 }
47312
47313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
47314         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47315         *ret_copy = SignOrCreationError_sign_error();
47316         int64_t ret_ref = tag_ptr(ret_copy, true);
47317         return ret_ref;
47318 }
47319
47320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
47321         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
47322         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47323         *ret_copy = SignOrCreationError_creation_error(a_conv);
47324         int64_t ret_ref = tag_ptr(ret_copy, true);
47325         return ret_ref;
47326 }
47327
47328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47329         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
47330         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
47331         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
47332         return ret_conv;
47333 }
47334
47335 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47336         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
47337         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
47338         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47339         Str_free(ret_str);
47340         return ret_conv;
47341 }
47342
47343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47344         LDKInvoicePayer this_obj_conv;
47345         this_obj_conv.inner = untag_ptr(this_obj);
47346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47348         InvoicePayer_free(this_obj_conv);
47349 }
47350
47351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47352         if (!ptr_is_owned(this_ptr)) return;
47353         void* this_ptr_ptr = untag_ptr(this_ptr);
47354         CHECK_ACCESS(this_ptr_ptr);
47355         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
47356         FREE(untag_ptr(this_ptr));
47357         Payer_free(this_ptr_conv);
47358 }
47359
47360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47361         if (!ptr_is_owned(this_ptr)) return;
47362         void* this_ptr_ptr = untag_ptr(this_ptr);
47363         CHECK_ACCESS(this_ptr_ptr);
47364         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
47365         FREE(untag_ptr(this_ptr));
47366         Router_free(this_ptr_conv);
47367 }
47368
47369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47370         if (!ptr_is_owned(this_ptr)) return;
47371         void* this_ptr_ptr = untag_ptr(this_ptr);
47372         CHECK_ACCESS(this_ptr_ptr);
47373         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
47374         FREE(untag_ptr(this_ptr));
47375         Retry_free(this_ptr_conv);
47376 }
47377
47378 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
47379         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47380         *ret_copy = Retry_clone(arg);
47381         int64_t ret_ref = tag_ptr(ret_copy, true);
47382         return ret_ref;
47383 }
47384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47385         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
47386         int64_t ret_conv = Retry_clone_ptr(arg_conv);
47387         return ret_conv;
47388 }
47389
47390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47391         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
47392         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47393         *ret_copy = Retry_clone(orig_conv);
47394         int64_t ret_ref = tag_ptr(ret_copy, true);
47395         return ret_ref;
47396 }
47397
47398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
47399         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47400         *ret_copy = Retry_attempts(a);
47401         int64_t ret_ref = tag_ptr(ret_copy, true);
47402         return ret_ref;
47403 }
47404
47405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
47406         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47407         *ret_copy = Retry_timeout(a);
47408         int64_t ret_ref = tag_ptr(ret_copy, true);
47409         return ret_ref;
47410 }
47411
47412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47413         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
47414         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
47415         jboolean ret_conv = Retry_eq(a_conv, b_conv);
47416         return ret_conv;
47417 }
47418
47419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
47420         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
47421         int64_t ret_conv = Retry_hash(o_conv);
47422         return ret_conv;
47423 }
47424
47425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47426         if (!ptr_is_owned(this_ptr)) return;
47427         void* this_ptr_ptr = untag_ptr(this_ptr);
47428         CHECK_ACCESS(this_ptr_ptr);
47429         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
47430         FREE(untag_ptr(this_ptr));
47431         PaymentError_free(this_ptr_conv);
47432 }
47433
47434 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
47435         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47436         *ret_copy = PaymentError_clone(arg);
47437         int64_t ret_ref = tag_ptr(ret_copy, true);
47438         return ret_ref;
47439 }
47440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47441         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
47442         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
47443         return ret_conv;
47444 }
47445
47446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47447         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
47448         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47449         *ret_copy = PaymentError_clone(orig_conv);
47450         int64_t ret_ref = tag_ptr(ret_copy, true);
47451         return ret_ref;
47452 }
47453
47454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
47455         LDKStr a_conv = java_to_owned_str(env, a);
47456         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47457         *ret_copy = PaymentError_invoice(a_conv);
47458         int64_t ret_ref = tag_ptr(ret_copy, true);
47459         return ret_ref;
47460 }
47461
47462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
47463         LDKLightningError a_conv;
47464         a_conv.inner = untag_ptr(a);
47465         a_conv.is_owned = ptr_is_owned(a);
47466         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47467         a_conv = LightningError_clone(&a_conv);
47468         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47469         *ret_copy = PaymentError_routing(a_conv);
47470         int64_t ret_ref = tag_ptr(ret_copy, true);
47471         return ret_ref;
47472 }
47473
47474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
47475         void* a_ptr = untag_ptr(a);
47476         CHECK_ACCESS(a_ptr);
47477         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
47478         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
47479         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47480         *ret_copy = PaymentError_sending(a_conv);
47481         int64_t ret_ref = tag_ptr(ret_copy, true);
47482         return ret_ref;
47483 }
47484
47485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t scorer, int64_t logger, int64_t event_handler, int64_t retry) {
47486         void* payer_ptr = untag_ptr(payer);
47487         CHECK_ACCESS(payer_ptr);
47488         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
47489         if (payer_conv.free == LDKPayer_JCalls_free) {
47490                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47491                 LDKPayer_JCalls_cloned(&payer_conv);
47492         }
47493         void* router_ptr = untag_ptr(router);
47494         CHECK_ACCESS(router_ptr);
47495         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
47496         if (router_conv.free == LDKRouter_JCalls_free) {
47497                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47498                 LDKRouter_JCalls_cloned(&router_conv);
47499         }
47500         LDKMultiThreadedLockableScore scorer_conv;
47501         scorer_conv.inner = untag_ptr(scorer);
47502         scorer_conv.is_owned = ptr_is_owned(scorer);
47503         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
47504         scorer_conv.is_owned = false;
47505         void* logger_ptr = untag_ptr(logger);
47506         CHECK_ACCESS(logger_ptr);
47507         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47508         if (logger_conv.free == LDKLogger_JCalls_free) {
47509                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47510                 LDKLogger_JCalls_cloned(&logger_conv);
47511         }
47512         void* event_handler_ptr = untag_ptr(event_handler);
47513         CHECK_ACCESS(event_handler_ptr);
47514         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47515         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47516                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47517                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47518         }
47519         void* retry_ptr = untag_ptr(retry);
47520         CHECK_ACCESS(retry_ptr);
47521         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
47522         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
47523         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
47524         int64_t ret_ref = 0;
47525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47527         return ret_ref;
47528 }
47529
47530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
47531         LDKInvoicePayer this_arg_conv;
47532         this_arg_conv.inner = untag_ptr(this_arg);
47533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47535         this_arg_conv.is_owned = false;
47536         LDKInvoice invoice_conv;
47537         invoice_conv.inner = untag_ptr(invoice);
47538         invoice_conv.is_owned = ptr_is_owned(invoice);
47539         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47540         invoice_conv.is_owned = false;
47541         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47542         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
47543         return tag_ptr(ret_conv, true);
47544 }
47545
47546 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) {
47547         LDKInvoicePayer this_arg_conv;
47548         this_arg_conv.inner = untag_ptr(this_arg);
47549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47551         this_arg_conv.is_owned = false;
47552         LDKInvoice invoice_conv;
47553         invoice_conv.inner = untag_ptr(invoice);
47554         invoice_conv.is_owned = ptr_is_owned(invoice);
47555         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47556         invoice_conv.is_owned = false;
47557         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47558         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
47559         return tag_ptr(ret_conv, true);
47560 }
47561
47562 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) {
47563         LDKInvoicePayer this_arg_conv;
47564         this_arg_conv.inner = untag_ptr(this_arg);
47565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47567         this_arg_conv.is_owned = false;
47568         LDKPublicKey pubkey_ref;
47569         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
47570         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
47571         LDKThirtyTwoBytes payment_preimage_ref;
47572         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
47573         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
47574         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47575         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
47576         return tag_ptr(ret_conv, true);
47577 }
47578
47579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
47580         LDKInvoicePayer this_arg_conv;
47581         this_arg_conv.inner = untag_ptr(this_arg);
47582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47584         this_arg_conv.is_owned = false;
47585         unsigned char payment_hash_arr[32];
47586         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47587         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
47588         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
47589         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
47590 }
47591
47592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
47593         LDKInvoicePayer this_arg_conv;
47594         this_arg_conv.inner = untag_ptr(this_arg);
47595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47597         this_arg_conv.is_owned = false;
47598         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
47599         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
47600         return tag_ptr(ret_ret, true);
47601 }
47602
47603 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) {
47604         void* amt_msat_ptr = untag_ptr(amt_msat);
47605         CHECK_ACCESS(amt_msat_ptr);
47606         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47607         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47608         LDKThirtyTwoBytes payment_hash_ref;
47609         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47610         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47611         LDKStr description_conv = java_to_owned_str(env, description);
47612         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47613         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47614         if (phantom_route_hints_constr.datalen > 0)
47615                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47616         else
47617                 phantom_route_hints_constr.data = NULL;
47618         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47619         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47620                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47621                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47622                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
47623                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
47624                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47625                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47626                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47627         }
47628         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47629         void* keys_manager_ptr = untag_ptr(keys_manager);
47630         CHECK_ACCESS(keys_manager_ptr);
47631         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47632         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47633                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47634                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47635         }
47636         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47637         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47638         *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);
47639         return tag_ptr(ret_conv, true);
47640 }
47641
47642 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) {
47643         void* amt_msat_ptr = untag_ptr(amt_msat);
47644         CHECK_ACCESS(amt_msat_ptr);
47645         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47646         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47647         LDKThirtyTwoBytes payment_hash_ref;
47648         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47649         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47650         LDKSha256 description_hash_conv;
47651         description_hash_conv.inner = untag_ptr(description_hash);
47652         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47653         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47654         description_hash_conv = Sha256_clone(&description_hash_conv);
47655         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47656         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47657         if (phantom_route_hints_constr.datalen > 0)
47658                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47659         else
47660                 phantom_route_hints_constr.data = NULL;
47661         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47662         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47663                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47664                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47665                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
47666                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
47667                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47668                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47669                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47670         }
47671         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47672         void* keys_manager_ptr = untag_ptr(keys_manager);
47673         CHECK_ACCESS(keys_manager_ptr);
47674         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47675         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47676                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47677                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47678         }
47679         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47680         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47681         *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);
47682         return tag_ptr(ret_conv, true);
47683 }
47684
47685 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) {
47686         LDKChannelManager channelmanager_conv;
47687         channelmanager_conv.inner = untag_ptr(channelmanager);
47688         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47689         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47690         channelmanager_conv.is_owned = false;
47691         void* keys_manager_ptr = untag_ptr(keys_manager);
47692         CHECK_ACCESS(keys_manager_ptr);
47693         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47694         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47695                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47696                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47697         }
47698         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47699         void* amt_msat_ptr = untag_ptr(amt_msat);
47700         CHECK_ACCESS(amt_msat_ptr);
47701         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47702         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47703         LDKStr description_conv = java_to_owned_str(env, description);
47704         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47705         *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
47706         return tag_ptr(ret_conv, true);
47707 }
47708
47709 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) {
47710         LDKChannelManager channelmanager_conv;
47711         channelmanager_conv.inner = untag_ptr(channelmanager);
47712         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47713         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47714         channelmanager_conv.is_owned = false;
47715         void* keys_manager_ptr = untag_ptr(keys_manager);
47716         CHECK_ACCESS(keys_manager_ptr);
47717         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47718         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47719                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47720                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47721         }
47722         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47723         void* amt_msat_ptr = untag_ptr(amt_msat);
47724         CHECK_ACCESS(amt_msat_ptr);
47725         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47726         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47727         LDKSha256 description_hash_conv;
47728         description_hash_conv.inner = untag_ptr(description_hash);
47729         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47730         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47731         description_hash_conv = Sha256_clone(&description_hash_conv);
47732         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47733         *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);
47734         return tag_ptr(ret_conv, true);
47735 }
47736
47737 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) {
47738         LDKChannelManager channelmanager_conv;
47739         channelmanager_conv.inner = untag_ptr(channelmanager);
47740         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47741         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47742         channelmanager_conv.is_owned = false;
47743         void* keys_manager_ptr = untag_ptr(keys_manager);
47744         CHECK_ACCESS(keys_manager_ptr);
47745         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47746         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47748                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47749         }
47750         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47751         void* amt_msat_ptr = untag_ptr(amt_msat);
47752         CHECK_ACCESS(amt_msat_ptr);
47753         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47754         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47755         LDKSha256 description_hash_conv;
47756         description_hash_conv.inner = untag_ptr(description_hash);
47757         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47758         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47759         description_hash_conv = Sha256_clone(&description_hash_conv);
47760         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47761         *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);
47762         return tag_ptr(ret_conv, true);
47763 }
47764
47765 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) {
47766         LDKChannelManager channelmanager_conv;
47767         channelmanager_conv.inner = untag_ptr(channelmanager);
47768         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47769         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47770         channelmanager_conv.is_owned = false;
47771         void* keys_manager_ptr = untag_ptr(keys_manager);
47772         CHECK_ACCESS(keys_manager_ptr);
47773         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47774         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47775                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47776                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47777         }
47778         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47779         void* amt_msat_ptr = untag_ptr(amt_msat);
47780         CHECK_ACCESS(amt_msat_ptr);
47781         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47782         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47783         LDKStr description_conv = java_to_owned_str(env, description);
47784         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47785         *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);
47786         return tag_ptr(ret_conv, true);
47787 }
47788
47789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47790         LDKDefaultRouter this_obj_conv;
47791         this_obj_conv.inner = untag_ptr(this_obj);
47792         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47794         DefaultRouter_free(this_obj_conv);
47795 }
47796
47797 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) {
47798         LDKNetworkGraph network_graph_conv;
47799         network_graph_conv.inner = untag_ptr(network_graph);
47800         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47801         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47802         network_graph_conv.is_owned = false;
47803         void* logger_ptr = untag_ptr(logger);
47804         CHECK_ACCESS(logger_ptr);
47805         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47806         if (logger_conv.free == LDKLogger_JCalls_free) {
47807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47808                 LDKLogger_JCalls_cloned(&logger_conv);
47809         }
47810         LDKThirtyTwoBytes random_seed_bytes_ref;
47811         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
47812         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
47813         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
47814         int64_t ret_ref = 0;
47815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47817         return ret_ref;
47818 }
47819
47820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
47821         LDKDefaultRouter this_arg_conv;
47822         this_arg_conv.inner = untag_ptr(this_arg);
47823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47825         this_arg_conv.is_owned = false;
47826         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
47827         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
47828         return tag_ptr(ret_ret, true);
47829 }
47830
47831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
47832         LDKChannelManager this_arg_conv;
47833         this_arg_conv.inner = untag_ptr(this_arg);
47834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47836         this_arg_conv.is_owned = false;
47837         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
47838         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
47839         return tag_ptr(ret_ret, true);
47840 }
47841
47842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
47843         LDKStr s_conv = java_to_owned_str(env, s);
47844         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
47845         *ret_conv = SiPrefix_from_str(s_conv);
47846         return tag_ptr(ret_conv, true);
47847 }
47848
47849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
47850         LDKStr s_conv = java_to_owned_str(env, s);
47851         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
47852         *ret_conv = Invoice_from_str(s_conv);
47853         return tag_ptr(ret_conv, true);
47854 }
47855
47856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
47857         LDKStr s_conv = java_to_owned_str(env, s);
47858         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
47859         *ret_conv = SignedRawInvoice_from_str(s_conv);
47860         return tag_ptr(ret_conv, true);
47861 }
47862
47863 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47864         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
47865         LDKStr ret_str = ParseError_to_str(o_conv);
47866         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47867         Str_free(ret_str);
47868         return ret_conv;
47869 }
47870
47871 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47872         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
47873         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
47874         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47875         Str_free(ret_str);
47876         return ret_conv;
47877 }
47878
47879 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47880         LDKInvoice o_conv;
47881         o_conv.inner = untag_ptr(o);
47882         o_conv.is_owned = ptr_is_owned(o);
47883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47884         o_conv.is_owned = false;
47885         LDKStr ret_str = Invoice_to_str(&o_conv);
47886         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47887         Str_free(ret_str);
47888         return ret_conv;
47889 }
47890
47891 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47892         LDKSignedRawInvoice o_conv;
47893         o_conv.inner = untag_ptr(o);
47894         o_conv.is_owned = ptr_is_owned(o);
47895         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47896         o_conv.is_owned = false;
47897         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
47898         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47899         Str_free(ret_str);
47900         return ret_conv;
47901 }
47902
47903 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47904         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
47905         LDKStr ret_str = Currency_to_str(o_conv);
47906         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47907         Str_free(ret_str);
47908         return ret_conv;
47909 }
47910
47911 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47912         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
47913         LDKStr ret_str = SiPrefix_to_str(o_conv);
47914         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47915         Str_free(ret_str);
47916         return ret_conv;
47917 }
47918
47919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47920         LDKRapidGossipSync this_obj_conv;
47921         this_obj_conv.inner = untag_ptr(this_obj);
47922         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47924         RapidGossipSync_free(this_obj_conv);
47925 }
47926
47927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
47928         LDKNetworkGraph network_graph_conv;
47929         network_graph_conv.inner = untag_ptr(network_graph);
47930         network_graph_conv.is_owned = ptr_is_owned(network_graph);
47931         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
47932         network_graph_conv.is_owned = false;
47933         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
47934         int64_t ret_ref = 0;
47935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47937         return ret_ref;
47938 }
47939
47940 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) {
47941         LDKRapidGossipSync this_arg_conv;
47942         this_arg_conv.inner = untag_ptr(this_arg);
47943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47945         this_arg_conv.is_owned = false;
47946         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
47947         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
47948         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
47949         return tag_ptr(ret_conv, true);
47950 }
47951
47952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
47953         LDKRapidGossipSync this_arg_conv;
47954         this_arg_conv.inner = untag_ptr(this_arg);
47955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47957         this_arg_conv.is_owned = false;
47958         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
47959         return ret_conv;
47960 }
47961
47962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47963         if (!ptr_is_owned(this_ptr)) return;
47964         void* this_ptr_ptr = untag_ptr(this_ptr);
47965         CHECK_ACCESS(this_ptr_ptr);
47966         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
47967         FREE(untag_ptr(this_ptr));
47968         GraphSyncError_free(this_ptr_conv);
47969 }
47970
47971 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
47972         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
47973         *ret_copy = GraphSyncError_clone(arg);
47974         int64_t ret_ref = tag_ptr(ret_copy, true);
47975         return ret_ref;
47976 }
47977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47978         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
47979         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
47980         return ret_conv;
47981 }
47982
47983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47984         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
47985         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
47986         *ret_copy = GraphSyncError_clone(orig_conv);
47987         int64_t ret_ref = tag_ptr(ret_copy, true);
47988         return ret_ref;
47989 }
47990
47991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
47992         LDKDecodeError a_conv;
47993         a_conv.inner = untag_ptr(a);
47994         a_conv.is_owned = ptr_is_owned(a);
47995         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47996         a_conv = DecodeError_clone(&a_conv);
47997         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
47998         *ret_copy = GraphSyncError_decode_error(a_conv);
47999         int64_t ret_ref = tag_ptr(ret_copy, true);
48000         return ret_ref;
48001 }
48002
48003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
48004         LDKLightningError a_conv;
48005         a_conv.inner = untag_ptr(a);
48006         a_conv.is_owned = ptr_is_owned(a);
48007         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48008         a_conv = LightningError_clone(&a_conv);
48009         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48010         *ret_copy = GraphSyncError_lightning_error(a_conv);
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_RapidGossipSync_1update_1network_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data) {
48016         LDKRapidGossipSync this_arg_conv;
48017         this_arg_conv.inner = untag_ptr(this_arg);
48018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48020         this_arg_conv.is_owned = false;
48021         LDKu8slice update_data_ref;
48022         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
48023         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
48024         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48025         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
48026         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
48027         return tag_ptr(ret_conv, true);
48028 }
48029