]> git.bitcoin.ninja Git - ldk-java/blob - src/main/jni/bindings.c.body
0adbfe3a11ab5b8f3420d4116cbddba92a5987e3
[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         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
1062         ret.is_owned = false;
1063         return ret;
1064 }
1065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1066         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1067         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1068         int64_t ret_ref = 0;
1069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1071         return ret_ref;
1072 }
1073
1074 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1075         LDKDecodeError ret = *owner->contents.err;
1076         ret.is_owned = false;
1077         return ret;
1078 }
1079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1080         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1081         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1082         int64_t ret_ref = 0;
1083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1085         return ret_ref;
1086 }
1087
1088 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1089 CHECK(owner->result_ok);
1090         return *owner->contents.result;
1091 }
1092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1093         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1094         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1095         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1096         return ret_arr;
1097 }
1098
1099 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1100 CHECK(!owner->result_ok);
1101         return *owner->contents.err;
1102 }
1103 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1104         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
1105         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1106         return ret_conv;
1107 }
1108
1109 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1110 CHECK(owner->result_ok);
1111         return *owner->contents.result;
1112 }
1113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1114         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1115         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1116         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1117         return ret_arr;
1118 }
1119
1120 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1121 CHECK(!owner->result_ok);
1122         return *owner->contents.err;
1123 }
1124 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1125         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
1126         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1127         return ret_conv;
1128 }
1129
1130 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1131         LDKTxCreationKeys ret = *owner->contents.result;
1132         ret.is_owned = false;
1133         return ret;
1134 }
1135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1136         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1137         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1138         int64_t ret_ref = 0;
1139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1141         return ret_ref;
1142 }
1143
1144 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1145         LDKDecodeError ret = *owner->contents.err;
1146         ret.is_owned = false;
1147         return ret;
1148 }
1149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1150         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1151         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1152         int64_t ret_ref = 0;
1153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1155         return ret_ref;
1156 }
1157
1158 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1159         LDKChannelPublicKeys ret = *owner->contents.result;
1160         ret.is_owned = false;
1161         return ret;
1162 }
1163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1164         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1165         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1166         int64_t ret_ref = 0;
1167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1169         return ret_ref;
1170 }
1171
1172 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1173         LDKDecodeError ret = *owner->contents.err;
1174         ret.is_owned = false;
1175         return ret;
1176 }
1177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1178         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1179         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1180         int64_t ret_ref = 0;
1181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1183         return ret_ref;
1184 }
1185
1186 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1187         LDKTxCreationKeys ret = *owner->contents.result;
1188         ret.is_owned = false;
1189         return ret;
1190 }
1191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1192         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1193         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1194         int64_t ret_ref = 0;
1195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1197         return ret_ref;
1198 }
1199
1200 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1201 CHECK(!owner->result_ok);
1202         return *owner->contents.err;
1203 }
1204 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1205         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
1206         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1207         return ret_conv;
1208 }
1209
1210 static jclass LDKCOption_u32Z_Some_class = NULL;
1211 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1212 static jclass LDKCOption_u32Z_None_class = NULL;
1213 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1215         LDKCOption_u32Z_Some_class =
1216                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1217         CHECK(LDKCOption_u32Z_Some_class != NULL);
1218         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1219         CHECK(LDKCOption_u32Z_Some_meth != NULL);
1220         LDKCOption_u32Z_None_class =
1221                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1222         CHECK(LDKCOption_u32Z_None_class != NULL);
1223         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1224         CHECK(LDKCOption_u32Z_None_meth != NULL);
1225 }
1226 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1227         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1228         switch(obj->tag) {
1229                 case LDKCOption_u32Z_Some: {
1230                         int32_t some_conv = obj->some;
1231                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1232                 }
1233                 case LDKCOption_u32Z_None: {
1234                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1235                 }
1236                 default: abort();
1237         }
1238 }
1239 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1240         LDKHTLCOutputInCommitment ret = *owner->contents.result;
1241         ret.is_owned = false;
1242         return ret;
1243 }
1244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1245         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1246         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1247         int64_t ret_ref = 0;
1248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1250         return ret_ref;
1251 }
1252
1253 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1254         LDKDecodeError ret = *owner->contents.err;
1255         ret.is_owned = false;
1256         return ret;
1257 }
1258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1259         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1260         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1261         int64_t ret_ref = 0;
1262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1264         return ret_ref;
1265 }
1266
1267 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1268         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
1269         ret.is_owned = false;
1270         return ret;
1271 }
1272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1273         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1274         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1275         int64_t ret_ref = 0;
1276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1278         return ret_ref;
1279 }
1280
1281 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1282         LDKDecodeError ret = *owner->contents.err;
1283         ret.is_owned = false;
1284         return ret;
1285 }
1286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1287         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1288         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1289         int64_t ret_ref = 0;
1290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1292         return ret_ref;
1293 }
1294
1295 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1296         LDKChannelTransactionParameters ret = *owner->contents.result;
1297         ret.is_owned = false;
1298         return ret;
1299 }
1300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1301         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1302         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1303         int64_t ret_ref = 0;
1304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1306         return ret_ref;
1307 }
1308
1309 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1310         LDKDecodeError ret = *owner->contents.err;
1311         ret.is_owned = false;
1312         return ret;
1313 }
1314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1315         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1316         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(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 LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1324         LDKHolderCommitmentTransaction ret = *owner->contents.result;
1325         ret.is_owned = false;
1326         return ret;
1327 }
1328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1329         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1330         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1331         int64_t ret_ref = 0;
1332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1334         return ret_ref;
1335 }
1336
1337 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1338         LDKDecodeError ret = *owner->contents.err;
1339         ret.is_owned = false;
1340         return ret;
1341 }
1342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1343         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1344         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1345         int64_t ret_ref = 0;
1346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1348         return ret_ref;
1349 }
1350
1351 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1352         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
1353         ret.is_owned = false;
1354         return ret;
1355 }
1356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1357         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1358         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1359         int64_t ret_ref = 0;
1360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1362         return ret_ref;
1363 }
1364
1365 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1366         LDKDecodeError ret = *owner->contents.err;
1367         ret.is_owned = false;
1368         return ret;
1369 }
1370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1371         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1372         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1373         int64_t ret_ref = 0;
1374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1376         return ret_ref;
1377 }
1378
1379 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1380         LDKTrustedClosingTransaction ret = *owner->contents.result;
1381         ret.is_owned = false;
1382         return ret;
1383 }
1384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1385         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1386         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1387         int64_t ret_ref = 0;
1388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1390         return ret_ref;
1391 }
1392
1393 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1394 CHECK(!owner->result_ok);
1395         return *owner->contents.err;
1396 }
1397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1398         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1399         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1400 }
1401
1402 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1403         LDKCommitmentTransaction ret = *owner->contents.result;
1404         ret.is_owned = false;
1405         return ret;
1406 }
1407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1408         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1409         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1410         int64_t ret_ref = 0;
1411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1413         return ret_ref;
1414 }
1415
1416 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1417         LDKDecodeError ret = *owner->contents.err;
1418         ret.is_owned = false;
1419         return ret;
1420 }
1421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1422         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1423         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1424         int64_t ret_ref = 0;
1425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1427         return ret_ref;
1428 }
1429
1430 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1431         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1432         ret.is_owned = false;
1433         return ret;
1434 }
1435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1436         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1437         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1438         int64_t ret_ref = 0;
1439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1441         return ret_ref;
1442 }
1443
1444 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1445 CHECK(!owner->result_ok);
1446         return *owner->contents.err;
1447 }
1448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1449         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1450         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1451 }
1452
1453 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1454 CHECK(owner->result_ok);
1455         return *owner->contents.result;
1456 }
1457 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1458         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1459         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1460         jobjectArray ret_arr = NULL;
1461         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1462         ;
1463         for (size_t i = 0; i < ret_var.datalen; i++) {
1464                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1465                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1466                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1467         }
1468         
1469         return ret_arr;
1470 }
1471
1472 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1473 CHECK(!owner->result_ok);
1474         return *owner->contents.err;
1475 }
1476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1477         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1478         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1479 }
1480
1481 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1482         LDKShutdownScript ret = *owner->contents.result;
1483         ret.is_owned = false;
1484         return ret;
1485 }
1486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1487         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1488         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1489         int64_t ret_ref = 0;
1490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1492         return ret_ref;
1493 }
1494
1495 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1496         LDKDecodeError ret = *owner->contents.err;
1497         ret.is_owned = false;
1498         return ret;
1499 }
1500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1501         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1502         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1503         int64_t ret_ref = 0;
1504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1506         return ret_ref;
1507 }
1508
1509 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1510         LDKShutdownScript ret = *owner->contents.result;
1511         ret.is_owned = false;
1512         return ret;
1513 }
1514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1515         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1516         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1517         int64_t ret_ref = 0;
1518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1520         return ret_ref;
1521 }
1522
1523 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1524         LDKInvalidShutdownScript ret = *owner->contents.err;
1525         ret.is_owned = false;
1526         return ret;
1527 }
1528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1529         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1530         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1531         int64_t ret_ref = 0;
1532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1534         return ret_ref;
1535 }
1536
1537 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1538 CHECK(owner->result_ok);
1539         return *owner->contents.result;
1540 }
1541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1542         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
1543         CResult_NoneErrorZ_get_ok(owner_conv);
1544 }
1545
1546 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1547 CHECK(!owner->result_ok);
1548         return *owner->contents.err;
1549 }
1550 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1551         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
1552         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1553         return ret_conv;
1554 }
1555
1556 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1557         LDKRouteHop ret = *owner->contents.result;
1558         ret.is_owned = false;
1559         return ret;
1560 }
1561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1562         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1563         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1564         int64_t ret_ref = 0;
1565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1567         return ret_ref;
1568 }
1569
1570 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1571         LDKDecodeError ret = *owner->contents.err;
1572         ret.is_owned = false;
1573         return ret;
1574 }
1575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1576         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1577         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(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 LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1585         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1586         for (size_t i = 0; i < ret.datalen; i++) {
1587                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1588         }
1589         return ret;
1590 }
1591 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1592         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1593         for (size_t i = 0; i < ret.datalen; i++) {
1594                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1595         }
1596         return ret;
1597 }
1598 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1599         LDKRoute ret = *owner->contents.result;
1600         ret.is_owned = false;
1601         return ret;
1602 }
1603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1604         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1605         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1606         int64_t ret_ref = 0;
1607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1609         return ret_ref;
1610 }
1611
1612 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1613         LDKDecodeError ret = *owner->contents.err;
1614         ret.is_owned = false;
1615         return ret;
1616 }
1617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1618         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1619         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1620         int64_t ret_ref = 0;
1621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1623         return ret_ref;
1624 }
1625
1626 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1627         LDKRouteParameters ret = *owner->contents.result;
1628         ret.is_owned = false;
1629         return ret;
1630 }
1631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1632         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1633         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1634         int64_t ret_ref = 0;
1635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1637         return ret_ref;
1638 }
1639
1640 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1641         LDKDecodeError ret = *owner->contents.err;
1642         ret.is_owned = false;
1643         return ret;
1644 }
1645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1646         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1647         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1648         int64_t ret_ref = 0;
1649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1651         return ret_ref;
1652 }
1653
1654 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1655         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1656         for (size_t i = 0; i < ret.datalen; i++) {
1657                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1658         }
1659         return ret;
1660 }
1661 static jclass LDKCOption_u64Z_Some_class = NULL;
1662 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1663 static jclass LDKCOption_u64Z_None_class = NULL;
1664 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1666         LDKCOption_u64Z_Some_class =
1667                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1668         CHECK(LDKCOption_u64Z_Some_class != NULL);
1669         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1670         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1671         LDKCOption_u64Z_None_class =
1672                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1673         CHECK(LDKCOption_u64Z_None_class != NULL);
1674         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1675         CHECK(LDKCOption_u64Z_None_meth != NULL);
1676 }
1677 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1678         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1679         switch(obj->tag) {
1680                 case LDKCOption_u64Z_Some: {
1681                         int64_t some_conv = obj->some;
1682                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1683                 }
1684                 case LDKCOption_u64Z_None: {
1685                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1686                 }
1687                 default: abort();
1688         }
1689 }
1690 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1691         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1692         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1693         return ret;
1694 }
1695 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1696         LDKPaymentParameters ret = *owner->contents.result;
1697         ret.is_owned = false;
1698         return ret;
1699 }
1700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1701         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1702         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1703         int64_t ret_ref = 0;
1704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1706         return ret_ref;
1707 }
1708
1709 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1710         LDKDecodeError ret = *owner->contents.err;
1711         ret.is_owned = false;
1712         return ret;
1713 }
1714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1715         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1716         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_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 LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1724         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1725         for (size_t i = 0; i < ret.datalen; i++) {
1726                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1727         }
1728         return ret;
1729 }
1730 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1731         LDKRouteHint ret = *owner->contents.result;
1732         ret.is_owned = false;
1733         return ret;
1734 }
1735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1736         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1737         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1738         int64_t ret_ref = 0;
1739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1741         return ret_ref;
1742 }
1743
1744 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1745         LDKDecodeError ret = *owner->contents.err;
1746         ret.is_owned = false;
1747         return ret;
1748 }
1749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1750         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1751         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1752         int64_t ret_ref = 0;
1753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1755         return ret_ref;
1756 }
1757
1758 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1759         LDKRouteHintHop ret = *owner->contents.result;
1760         ret.is_owned = false;
1761         return ret;
1762 }
1763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1764         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1765         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1766         int64_t ret_ref = 0;
1767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1769         return ret_ref;
1770 }
1771
1772 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1773         LDKDecodeError ret = *owner->contents.err;
1774         ret.is_owned = false;
1775         return ret;
1776 }
1777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1778         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1779         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1780         int64_t ret_ref = 0;
1781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1783         return ret_ref;
1784 }
1785
1786 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1787         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1788         for (size_t i = 0; i < ret.datalen; i++) {
1789                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1790         }
1791         return ret;
1792 }
1793 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1794         LDKRoute ret = *owner->contents.result;
1795         ret.is_owned = false;
1796         return ret;
1797 }
1798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1799         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1800         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1801         int64_t ret_ref = 0;
1802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1804         return ret_ref;
1805 }
1806
1807 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1808         LDKLightningError ret = *owner->contents.err;
1809         ret.is_owned = false;
1810         return ret;
1811 }
1812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1813         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1814         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1815         int64_t ret_ref = 0;
1816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1818         return ret_ref;
1819 }
1820
1821 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
1822 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
1823 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
1824 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
1825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
1826         LDKPaymentPurpose_InvoicePayment_class =
1827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
1828         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
1829         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
1830         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
1831         LDKPaymentPurpose_SpontaneousPayment_class =
1832                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
1833         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
1834         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
1835         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
1836 }
1837 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1838         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1839         switch(obj->tag) {
1840                 case LDKPaymentPurpose_InvoicePayment: {
1841                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1842                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
1843                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1844                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
1845                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
1846                 }
1847                 case LDKPaymentPurpose_SpontaneousPayment: {
1848                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
1849                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
1850                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
1851                 }
1852                 default: abort();
1853         }
1854 }
1855 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1856 CHECK(owner->result_ok);
1857         return PaymentPurpose_clone(&*owner->contents.result);
1858 }
1859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1860         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1861         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1862         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1863         int64_t ret_ref = tag_ptr(ret_copy, true);
1864         return ret_ref;
1865 }
1866
1867 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1868         LDKDecodeError ret = *owner->contents.err;
1869         ret.is_owned = false;
1870         return ret;
1871 }
1872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1873         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1874         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1875         int64_t ret_ref = 0;
1876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1878         return ret_ref;
1879 }
1880
1881 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1882 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1883 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1884 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1885 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1886 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1887 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1888 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1889 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1890 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1891 static jclass LDKClosureReason_ProcessingError_class = NULL;
1892 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1893 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1894 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1895 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1896 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1898         LDKClosureReason_CounterpartyForceClosed_class =
1899                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
1900         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
1901         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
1902         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
1903         LDKClosureReason_HolderForceClosed_class =
1904                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
1905         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
1906         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
1907         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
1908         LDKClosureReason_CooperativeClosure_class =
1909                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
1910         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
1911         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
1912         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
1913         LDKClosureReason_CommitmentTxConfirmed_class =
1914                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
1915         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
1916         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
1917         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
1918         LDKClosureReason_FundingTimedOut_class =
1919                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
1920         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
1921         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
1922         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
1923         LDKClosureReason_ProcessingError_class =
1924                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
1925         CHECK(LDKClosureReason_ProcessingError_class != NULL);
1926         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
1927         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
1928         LDKClosureReason_DisconnectedPeer_class =
1929                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
1930         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
1931         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
1932         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
1933         LDKClosureReason_OutdatedChannelManager_class =
1934                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
1935         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
1936         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
1937         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
1938 }
1939 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1940         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1941         switch(obj->tag) {
1942                 case LDKClosureReason_CounterpartyForceClosed: {
1943                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1944                         jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
1945                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
1946                 }
1947                 case LDKClosureReason_HolderForceClosed: {
1948                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
1949                 }
1950                 case LDKClosureReason_CooperativeClosure: {
1951                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
1952                 }
1953                 case LDKClosureReason_CommitmentTxConfirmed: {
1954                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
1955                 }
1956                 case LDKClosureReason_FundingTimedOut: {
1957                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
1958                 }
1959                 case LDKClosureReason_ProcessingError: {
1960                         LDKStr err_str = obj->processing_error.err;
1961                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1962                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
1963                 }
1964                 case LDKClosureReason_DisconnectedPeer: {
1965                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
1966                 }
1967                 case LDKClosureReason_OutdatedChannelManager: {
1968                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
1969                 }
1970                 default: abort();
1971         }
1972 }
1973 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
1974 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
1975 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
1976 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
1977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
1978         LDKCOption_ClosureReasonZ_Some_class =
1979                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
1980         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
1981         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
1982         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
1983         LDKCOption_ClosureReasonZ_None_class =
1984                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
1985         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
1986         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
1987         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
1988 }
1989 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1990         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1991         switch(obj->tag) {
1992                 case LDKCOption_ClosureReasonZ_Some: {
1993                         int64_t some_ref = tag_ptr(&obj->some, false);
1994                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
1995                 }
1996                 case LDKCOption_ClosureReasonZ_None: {
1997                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
1998                 }
1999                 default: abort();
2000         }
2001 }
2002 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2003 CHECK(owner->result_ok);
2004         return COption_ClosureReasonZ_clone(&*owner->contents.result);
2005 }
2006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2007         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2008         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2009         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2010         int64_t ret_ref = tag_ptr(ret_copy, true);
2011         return ret_ref;
2012 }
2013
2014 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2015         LDKDecodeError ret = *owner->contents.err;
2016         ret.is_owned = false;
2017         return ret;
2018 }
2019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2020         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
2021         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2022         int64_t ret_ref = 0;
2023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2025         return ret_ref;
2026 }
2027
2028 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
2029 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
2030 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
2031 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
2032 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
2033 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
2034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
2035         LDKHTLCDestination_NextHopChannel_class =
2036                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
2037         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
2038         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
2039         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
2040         LDKHTLCDestination_UnknownNextHop_class =
2041                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
2042         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
2043         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
2044         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
2045         LDKHTLCDestination_FailedPayment_class =
2046                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
2047         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
2048         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
2049         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
2050 }
2051 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2052         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
2053         switch(obj->tag) {
2054                 case LDKHTLCDestination_NextHopChannel: {
2055                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2056                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
2057                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2058                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
2059                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
2060                 }
2061                 case LDKHTLCDestination_UnknownNextHop: {
2062                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
2063                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
2064                 }
2065                 case LDKHTLCDestination_FailedPayment: {
2066                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2067                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
2068                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
2069                 }
2070                 default: abort();
2071         }
2072 }
2073 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
2074 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
2075 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
2076 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
2077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
2078         LDKCOption_HTLCDestinationZ_Some_class =
2079                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
2080         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
2081         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
2082         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
2083         LDKCOption_HTLCDestinationZ_None_class =
2084                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
2085         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
2086         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
2087         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
2088 }
2089 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2090         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
2091         switch(obj->tag) {
2092                 case LDKCOption_HTLCDestinationZ_Some: {
2093                         int64_t some_ref = tag_ptr(&obj->some, false);
2094                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
2095                 }
2096                 case LDKCOption_HTLCDestinationZ_None: {
2097                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
2098                 }
2099                 default: abort();
2100         }
2101 }
2102 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2103 CHECK(owner->result_ok);
2104         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
2105 }
2106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2107         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2108         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
2109         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
2110         int64_t ret_ref = tag_ptr(ret_copy, true);
2111         return ret_ref;
2112 }
2113
2114 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
2115         LDKDecodeError ret = *owner->contents.err;
2116         ret.is_owned = false;
2117         return ret;
2118 }
2119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2120         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
2121         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
2122         int64_t ret_ref = 0;
2123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2125         return ret_ref;
2126 }
2127
2128 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2129 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2130 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
2131 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
2132 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2133 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2135         LDKNetworkUpdate_ChannelUpdateMessage_class =
2136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2137         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2138         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2139         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2140         LDKNetworkUpdate_ChannelFailure_class =
2141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
2142         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
2143         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
2144         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
2145         LDKNetworkUpdate_NodeFailure_class =
2146                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2147         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2148         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2149         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2150 }
2151 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2152         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
2153         switch(obj->tag) {
2154                 case LDKNetworkUpdate_ChannelUpdateMessage: {
2155                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2156                         int64_t msg_ref = 0;
2157                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2158                         msg_ref = tag_ptr(msg_var.inner, false);
2159                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2160                 }
2161                 case LDKNetworkUpdate_ChannelFailure: {
2162                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
2163                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
2164                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
2165                 }
2166                 case LDKNetworkUpdate_NodeFailure: {
2167                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2168                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2169                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
2170                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2171                 }
2172                 default: abort();
2173         }
2174 }
2175 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2176 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2177 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2178 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2180         LDKCOption_NetworkUpdateZ_Some_class =
2181                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2182         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2183         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2184         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2185         LDKCOption_NetworkUpdateZ_None_class =
2186                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2187         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2188         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2189         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2190 }
2191 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2192         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
2193         switch(obj->tag) {
2194                 case LDKCOption_NetworkUpdateZ_Some: {
2195                         int64_t some_ref = tag_ptr(&obj->some, false);
2196                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2197                 }
2198                 case LDKCOption_NetworkUpdateZ_None: {
2199                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2200                 }
2201                 default: abort();
2202         }
2203 }
2204 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2205 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2206 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2207 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2208 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2209 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2211         LDKSpendableOutputDescriptor_StaticOutput_class =
2212                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2213         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2214         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2215         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2216         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2217                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2218         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2219         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2220         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2221         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2222                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2223         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2224         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2225         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2226 }
2227 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2228         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2229         switch(obj->tag) {
2230                 case LDKSpendableOutputDescriptor_StaticOutput: {
2231                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2232                         int64_t outpoint_ref = 0;
2233                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2234                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2235                         LDKTxOut* output_ref = &obj->static_output.output;
2236                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
2237                 }
2238                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2239                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2240                         int64_t delayed_payment_output_ref = 0;
2241                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2242                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2243                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2244                 }
2245                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2246                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2247                         int64_t static_payment_output_ref = 0;
2248                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2249                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2250                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2251                 }
2252                 default: abort();
2253         }
2254 }
2255 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2256         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2257         for (size_t i = 0; i < ret.datalen; i++) {
2258                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2259         }
2260         return ret;
2261 }
2262 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2263 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2264 static jclass LDKEvent_PaymentReceived_class = NULL;
2265 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2266 static jclass LDKEvent_PaymentClaimed_class = NULL;
2267 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
2268 static jclass LDKEvent_PaymentSent_class = NULL;
2269 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2270 static jclass LDKEvent_PaymentFailed_class = NULL;
2271 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2272 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2273 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2274 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2275 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2276 static jclass LDKEvent_ProbeSuccessful_class = NULL;
2277 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
2278 static jclass LDKEvent_ProbeFailed_class = NULL;
2279 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
2280 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2281 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2282 static jclass LDKEvent_SpendableOutputs_class = NULL;
2283 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2284 static jclass LDKEvent_PaymentForwarded_class = NULL;
2285 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2286 static jclass LDKEvent_ChannelClosed_class = NULL;
2287 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2288 static jclass LDKEvent_DiscardFunding_class = NULL;
2289 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2290 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2291 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2292 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
2293 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
2294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2295         LDKEvent_FundingGenerationReady_class =
2296                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2297         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2298         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[BJ)V");
2299         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2300         LDKEvent_PaymentReceived_class =
2301                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2302         CHECK(LDKEvent_PaymentReceived_class != NULL);
2303         LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2304         CHECK(LDKEvent_PaymentReceived_meth != NULL);
2305         LDKEvent_PaymentClaimed_class =
2306                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
2307         CHECK(LDKEvent_PaymentClaimed_class != NULL);
2308         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([BJJ)V");
2309         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
2310         LDKEvent_PaymentSent_class =
2311                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2312         CHECK(LDKEvent_PaymentSent_class != NULL);
2313         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2314         CHECK(LDKEvent_PaymentSent_meth != NULL);
2315         LDKEvent_PaymentFailed_class =
2316                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2317         CHECK(LDKEvent_PaymentFailed_class != NULL);
2318         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2319         CHECK(LDKEvent_PaymentFailed_meth != NULL);
2320         LDKEvent_PaymentPathSuccessful_class =
2321                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2322         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2323         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2324         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2325         LDKEvent_PaymentPathFailed_class =
2326                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2327         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2328         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2329         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2330         LDKEvent_ProbeSuccessful_class =
2331                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
2332         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
2333         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[B[J)V");
2334         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
2335         LDKEvent_ProbeFailed_class =
2336                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
2337         CHECK(LDKEvent_ProbeFailed_class != NULL);
2338         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[B[JJ)V");
2339         CHECK(LDKEvent_ProbeFailed_meth != NULL);
2340         LDKEvent_PendingHTLCsForwardable_class =
2341                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2342         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2343         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2344         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2345         LDKEvent_SpendableOutputs_class =
2346                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2347         CHECK(LDKEvent_SpendableOutputs_class != NULL);
2348         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2349         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2350         LDKEvent_PaymentForwarded_class =
2351                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2352         CHECK(LDKEvent_PaymentForwarded_class != NULL);
2353         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZ)V");
2354         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2355         LDKEvent_ChannelClosed_class =
2356                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2357         CHECK(LDKEvent_ChannelClosed_class != NULL);
2358         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2359         CHECK(LDKEvent_ChannelClosed_meth != NULL);
2360         LDKEvent_DiscardFunding_class =
2361                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2362         CHECK(LDKEvent_DiscardFunding_class != NULL);
2363         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2364         CHECK(LDKEvent_DiscardFunding_meth != NULL);
2365         LDKEvent_OpenChannelRequest_class =
2366                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2367         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2368         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2369         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2370         LDKEvent_HTLCHandlingFailed_class =
2371                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
2372         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
2373         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
2374         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
2375 }
2376 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2377         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2378         switch(obj->tag) {
2379                 case LDKEvent_FundingGenerationReady: {
2380                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2381                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2382                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2383                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
2384                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2385                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2386                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2387                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2388                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
2389                         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);
2390                 }
2391                 case LDKEvent_PaymentReceived: {
2392                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2393                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2394                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
2395                         int64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
2396                         return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2397                 }
2398                 case LDKEvent_PaymentClaimed: {
2399                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2400                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
2401                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
2402                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
2403                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, payment_hash_arr, amount_msat_conv, purpose_ref);
2404                 }
2405                 case LDKEvent_PaymentSent: {
2406                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2407                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2408                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2409                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2410                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2411                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2412                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
2413                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2414                 }
2415                 case LDKEvent_PaymentFailed: {
2416                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2417                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2418                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2419                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2420                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2421                 }
2422                 case LDKEvent_PaymentPathSuccessful: {
2423                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2424                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2425                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2426                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2427                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2428                         int64_tArray path_arr = NULL;
2429                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2430                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2431                         for (size_t k = 0; k < path_var.datalen; k++) {
2432                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2433                                 int64_t path_conv_10_ref = 0;
2434                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2435                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2436                                 path_arr_ptr[k] = path_conv_10_ref;
2437                         }
2438                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2439                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2440                 }
2441                 case LDKEvent_PaymentPathFailed: {
2442                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2443                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2444                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2445                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2446                         jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
2447                         int64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
2448                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
2449                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2450                         int64_tArray path_arr = NULL;
2451                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2452                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2453                         for (size_t k = 0; k < path_var.datalen; k++) {
2454                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2455                                 int64_t path_conv_10_ref = 0;
2456                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2457                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2458                                 path_arr_ptr[k] = path_conv_10_ref;
2459                         }
2460                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2461                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
2462                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2463                         int64_t retry_ref = 0;
2464                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2465                         retry_ref = tag_ptr(retry_var.inner, false);
2466                         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);
2467                 }
2468                 case LDKEvent_ProbeSuccessful: {
2469                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2470                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
2471                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2472                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
2473                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
2474                         int64_tArray path_arr = NULL;
2475                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2476                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2477                         for (size_t k = 0; k < path_var.datalen; k++) {
2478                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2479                                 int64_t path_conv_10_ref = 0;
2480                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2481                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2482                                 path_arr_ptr[k] = path_conv_10_ref;
2483                         }
2484                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2485                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2486                 }
2487                 case LDKEvent_ProbeFailed: {
2488                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2489                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
2490                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2491                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
2492                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
2493                         int64_tArray path_arr = NULL;
2494                         path_arr = (*env)->NewLongArray(env, path_var.datalen);
2495                         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2496                         for (size_t k = 0; k < path_var.datalen; k++) {
2497                                 LDKRouteHop path_conv_10_var = path_var.data[k];
2498                                 int64_t path_conv_10_ref = 0;
2499                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2500                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
2501                                 path_arr_ptr[k] = path_conv_10_ref;
2502                         }
2503                         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2504                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
2505                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_arr, short_channel_id_ref);
2506                 }
2507                 case LDKEvent_PendingHTLCsForwardable: {
2508                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2509                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
2510                 }
2511                 case LDKEvent_SpendableOutputs: {
2512                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2513                         int64_tArray outputs_arr = NULL;
2514                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2515                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2516                         for (size_t b = 0; b < outputs_var.datalen; b++) {
2517                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
2518                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
2519                         }
2520                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2521                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2522                 }
2523                 case LDKEvent_PaymentForwarded: {
2524                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2525                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
2526                         int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
2527                         (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
2528                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2529                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2530                         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);
2531                 }
2532                 case LDKEvent_ChannelClosed: {
2533                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2534                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2535                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
2536                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2537                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
2538                 }
2539                 case LDKEvent_DiscardFunding: {
2540                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2541                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2542                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2543                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2544                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2545                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2546                 }
2547                 case LDKEvent_OpenChannelRequest: {
2548                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2549                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2550                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2551                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2552                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2553                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2554                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2555                         int64_t channel_type_ref = 0;
2556                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2557                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2558                         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);
2559                 }
2560                 case LDKEvent_HTLCHandlingFailed: {
2561                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
2562                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
2563                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2564                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
2565                 }
2566                 default: abort();
2567         }
2568 }
2569 static jclass LDKCOption_EventZ_Some_class = NULL;
2570 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2571 static jclass LDKCOption_EventZ_None_class = NULL;
2572 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2574         LDKCOption_EventZ_Some_class =
2575                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2576         CHECK(LDKCOption_EventZ_Some_class != NULL);
2577         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2578         CHECK(LDKCOption_EventZ_Some_meth != NULL);
2579         LDKCOption_EventZ_None_class =
2580                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2581         CHECK(LDKCOption_EventZ_None_class != NULL);
2582         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2583         CHECK(LDKCOption_EventZ_None_meth != NULL);
2584 }
2585 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2586         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2587         switch(obj->tag) {
2588                 case LDKCOption_EventZ_Some: {
2589                         int64_t some_ref = tag_ptr(&obj->some, false);
2590                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2591                 }
2592                 case LDKCOption_EventZ_None: {
2593                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2594                 }
2595                 default: abort();
2596         }
2597 }
2598 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2599 CHECK(owner->result_ok);
2600         return COption_EventZ_clone(&*owner->contents.result);
2601 }
2602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2603         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2604         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2605         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2606         int64_t ret_ref = tag_ptr(ret_copy, true);
2607         return ret_ref;
2608 }
2609
2610 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2611         LDKDecodeError ret = *owner->contents.err;
2612         ret.is_owned = false;
2613         return ret;
2614 }
2615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2616         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2617         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2618         int64_t ret_ref = 0;
2619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2621         return ret_ref;
2622 }
2623
2624 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2625 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2626 static jclass LDKErrorAction_IgnoreError_class = NULL;
2627 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2628 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2629 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2630 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2631 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2632 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2633 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2634 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2635 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2637         LDKErrorAction_DisconnectPeer_class =
2638                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2639         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2640         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2641         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2642         LDKErrorAction_IgnoreError_class =
2643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2644         CHECK(LDKErrorAction_IgnoreError_class != NULL);
2645         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2646         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2647         LDKErrorAction_IgnoreAndLog_class =
2648                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2649         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2650         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2651         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2652         LDKErrorAction_IgnoreDuplicateGossip_class =
2653                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2654         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2655         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2656         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2657         LDKErrorAction_SendErrorMessage_class =
2658                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2659         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2660         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2661         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2662         LDKErrorAction_SendWarningMessage_class =
2663                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2664         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2665         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2666         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2667 }
2668 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2669         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2670         switch(obj->tag) {
2671                 case LDKErrorAction_DisconnectPeer: {
2672                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2673                         int64_t msg_ref = 0;
2674                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2675                         msg_ref = tag_ptr(msg_var.inner, false);
2676                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2677                 }
2678                 case LDKErrorAction_IgnoreError: {
2679                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2680                 }
2681                 case LDKErrorAction_IgnoreAndLog: {
2682                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2683                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2684                 }
2685                 case LDKErrorAction_IgnoreDuplicateGossip: {
2686                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2687                 }
2688                 case LDKErrorAction_SendErrorMessage: {
2689                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2690                         int64_t msg_ref = 0;
2691                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2692                         msg_ref = tag_ptr(msg_var.inner, false);
2693                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2694                 }
2695                 case LDKErrorAction_SendWarningMessage: {
2696                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2697                         int64_t msg_ref = 0;
2698                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2699                         msg_ref = tag_ptr(msg_var.inner, false);
2700                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2701                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2702                 }
2703                 default: abort();
2704         }
2705 }
2706 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2707 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2708 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2709 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2710 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2711 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2712 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2713 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2714 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
2715 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
2716 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2717 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2718 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2719 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2720 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2721 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2722 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2723 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2724 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2725 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2726 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2727 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2728 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2729 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2730 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2731 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2732 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2733 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2734 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2735 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2736 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2737 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2738 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2739 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2740 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2741 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2742 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2743 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2744 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2745 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2747         LDKMessageSendEvent_SendAcceptChannel_class =
2748                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2749         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2750         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2751         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2752         LDKMessageSendEvent_SendOpenChannel_class =
2753                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2754         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2755         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2756         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2757         LDKMessageSendEvent_SendFundingCreated_class =
2758                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2759         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2760         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2761         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2762         LDKMessageSendEvent_SendFundingSigned_class =
2763                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2764         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2765         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2766         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2767         LDKMessageSendEvent_SendChannelReady_class =
2768                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
2769         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
2770         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
2771         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
2772         LDKMessageSendEvent_SendAnnouncementSignatures_class =
2773                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2774         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2775         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2776         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2777         LDKMessageSendEvent_UpdateHTLCs_class =
2778                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2779         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2780         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2781         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2782         LDKMessageSendEvent_SendRevokeAndACK_class =
2783                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2784         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2785         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2786         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2787         LDKMessageSendEvent_SendClosingSigned_class =
2788                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2789         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2790         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2791         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2792         LDKMessageSendEvent_SendShutdown_class =
2793                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2794         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2795         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2796         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2797         LDKMessageSendEvent_SendChannelReestablish_class =
2798                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2799         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2800         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2801         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2802         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2803                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2804         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2805         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2806         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2807         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2809         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2810         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2811         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2812         LDKMessageSendEvent_BroadcastChannelUpdate_class =
2813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2814         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2815         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2816         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2817         LDKMessageSendEvent_SendChannelUpdate_class =
2818                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2819         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2820         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2821         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2822         LDKMessageSendEvent_HandleError_class =
2823                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2824         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2825         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2826         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2827         LDKMessageSendEvent_SendChannelRangeQuery_class =
2828                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2829         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2830         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2831         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2832         LDKMessageSendEvent_SendShortIdsQuery_class =
2833                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2834         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2835         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2836         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2837         LDKMessageSendEvent_SendReplyChannelRange_class =
2838                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2839         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2840         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2841         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2842         LDKMessageSendEvent_SendGossipTimestampFilter_class =
2843                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2844         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2845         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2846         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2847 }
2848 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2849         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2850         switch(obj->tag) {
2851                 case LDKMessageSendEvent_SendAcceptChannel: {
2852                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2853                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2854                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2855                         int64_t msg_ref = 0;
2856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2857                         msg_ref = tag_ptr(msg_var.inner, false);
2858                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2859                 }
2860                 case LDKMessageSendEvent_SendOpenChannel: {
2861                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2862                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2863                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2864                         int64_t msg_ref = 0;
2865                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2866                         msg_ref = tag_ptr(msg_var.inner, false);
2867                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2868                 }
2869                 case LDKMessageSendEvent_SendFundingCreated: {
2870                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2871                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2872                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2873                         int64_t msg_ref = 0;
2874                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2875                         msg_ref = tag_ptr(msg_var.inner, false);
2876                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2877                 }
2878                 case LDKMessageSendEvent_SendFundingSigned: {
2879                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2880                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2881                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2882                         int64_t msg_ref = 0;
2883                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2884                         msg_ref = tag_ptr(msg_var.inner, false);
2885                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2886                 }
2887                 case LDKMessageSendEvent_SendChannelReady: {
2888                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2889                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
2890                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2891                         int64_t msg_ref = 0;
2892                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2893                         msg_ref = tag_ptr(msg_var.inner, false);
2894                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
2895                 }
2896                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2897                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2898                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2899                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2900                         int64_t msg_ref = 0;
2901                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2902                         msg_ref = tag_ptr(msg_var.inner, false);
2903                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2904                 }
2905                 case LDKMessageSendEvent_UpdateHTLCs: {
2906                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2907                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2908                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2909                         int64_t updates_ref = 0;
2910                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2911                         updates_ref = tag_ptr(updates_var.inner, false);
2912                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2913                 }
2914                 case LDKMessageSendEvent_SendRevokeAndACK: {
2915                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2916                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2917                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2918                         int64_t msg_ref = 0;
2919                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2920                         msg_ref = tag_ptr(msg_var.inner, false);
2921                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2922                 }
2923                 case LDKMessageSendEvent_SendClosingSigned: {
2924                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2925                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2926                         LDKClosingSigned msg_var = obj->send_closing_signed.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_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2931                 }
2932                 case LDKMessageSendEvent_SendShutdown: {
2933                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2934                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2935                         LDKShutdown msg_var = obj->send_shutdown.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_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2940                 }
2941                 case LDKMessageSendEvent_SendChannelReestablish: {
2942                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2943                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2944                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2945                         int64_t msg_ref = 0;
2946                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2947                         msg_ref = tag_ptr(msg_var.inner, false);
2948                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2949                 }
2950                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2951                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2952                         int64_t msg_ref = 0;
2953                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2954                         msg_ref = tag_ptr(msg_var.inner, false);
2955                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2956                         int64_t update_msg_ref = 0;
2957                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2958                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2959                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2960                 }
2961                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2962                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2963                         int64_t msg_ref = 0;
2964                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2965                         msg_ref = tag_ptr(msg_var.inner, false);
2966                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2967                 }
2968                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2969                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2970                         int64_t msg_ref = 0;
2971                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2972                         msg_ref = tag_ptr(msg_var.inner, false);
2973                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2974                 }
2975                 case LDKMessageSendEvent_SendChannelUpdate: {
2976                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2977                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2978                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2979                         int64_t msg_ref = 0;
2980                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2981                         msg_ref = tag_ptr(msg_var.inner, false);
2982                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2983                 }
2984                 case LDKMessageSendEvent_HandleError: {
2985                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2986                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2987                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2988                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2989                 }
2990                 case LDKMessageSendEvent_SendChannelRangeQuery: {
2991                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2992                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
2993                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2994                         int64_t msg_ref = 0;
2995                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2996                         msg_ref = tag_ptr(msg_var.inner, false);
2997                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
2998                 }
2999                 case LDKMessageSendEvent_SendShortIdsQuery: {
3000                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3001                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3002                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3003                         int64_t msg_ref = 0;
3004                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3005                         msg_ref = tag_ptr(msg_var.inner, false);
3006                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3007                 }
3008                 case LDKMessageSendEvent_SendReplyChannelRange: {
3009                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3010                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3011                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3012                         int64_t msg_ref = 0;
3013                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3014                         msg_ref = tag_ptr(msg_var.inner, false);
3015                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3016                 }
3017                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3018                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3019                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3020                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3021                         int64_t msg_ref = 0;
3022                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3023                         msg_ref = tag_ptr(msg_var.inner, false);
3024                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3025                 }
3026                 default: abort();
3027         }
3028 }
3029 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3030         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3031         for (size_t i = 0; i < ret.datalen; i++) {
3032                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3033         }
3034         return ret;
3035 }
3036 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3037 CHECK(owner->result_ok);
3038         return TxOut_clone(&*owner->contents.result);
3039 }
3040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3041         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
3042         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
3043         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
3044         return tag_ptr(ret_ref, true);
3045 }
3046
3047 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
3048 CHECK(!owner->result_ok);
3049         return AccessError_clone(&*owner->contents.err);
3050 }
3051 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3052         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
3053         jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
3054         return ret_conv;
3055 }
3056
3057 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3058         return owner->a;
3059 }
3060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3061         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3062         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3063         return ret_conv;
3064 }
3065
3066 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3067         return owner->b;
3068 }
3069 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3070         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3071         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3072         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3073         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3074         return ret_arr;
3075 }
3076
3077 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3078         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3079         for (size_t i = 0; i < ret.datalen; i++) {
3080                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3081         }
3082         return ret;
3083 }
3084 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
3085         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
3086         for (size_t i = 0; i < ret.datalen; i++) {
3087                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3088         }
3089         return ret;
3090 }
3091 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3092 CHECK(owner->result_ok);
3093         return *owner->contents.result;
3094 }
3095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3096         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3097         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
3098 }
3099
3100 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
3101 CHECK(!owner->result_ok);
3102         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
3103 }
3104 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3105         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
3106         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
3107         return ret_conv;
3108 }
3109
3110 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
3111 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
3112 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
3113 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
3114 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
3115 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
3116 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
3117 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
3118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
3119         LDKMonitorEvent_HTLCEvent_class =
3120                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
3121         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
3122         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
3123         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
3124         LDKMonitorEvent_CommitmentTxConfirmed_class =
3125                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
3126         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
3127         LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
3128         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
3129         LDKMonitorEvent_UpdateCompleted_class =
3130                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
3131         CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
3132         LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
3133         CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
3134         LDKMonitorEvent_UpdateFailed_class =
3135                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
3136         CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
3137         LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
3138         CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
3139 }
3140 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3141         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3142         switch(obj->tag) {
3143                 case LDKMonitorEvent_HTLCEvent: {
3144                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3145                         int64_t htlc_event_ref = 0;
3146                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3147                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3148                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
3149                 }
3150                 case LDKMonitorEvent_CommitmentTxConfirmed: {
3151                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3152                         int64_t commitment_tx_confirmed_ref = 0;
3153                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3154                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
3155                         return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
3156                 }
3157                 case LDKMonitorEvent_UpdateCompleted: {
3158                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
3159                         int64_t funding_txo_ref = 0;
3160                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3161                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3162                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
3163                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
3164                 }
3165                 case LDKMonitorEvent_UpdateFailed: {
3166                         LDKOutPoint update_failed_var = obj->update_failed;
3167                         int64_t update_failed_ref = 0;
3168                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3169                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
3170                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
3171                 }
3172                 default: abort();
3173         }
3174 }
3175 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3176         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3177         for (size_t i = 0; i < ret.datalen; i++) {
3178                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3179         }
3180         return ret;
3181 }
3182 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3183         LDKOutPoint ret = owner->a;
3184         ret.is_owned = false;
3185         return ret;
3186 }
3187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3188         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3189         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3190         int64_t ret_ref = 0;
3191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3193         return ret_ref;
3194 }
3195
3196 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3197         return CVec_MonitorEventZ_clone(&owner->b);
3198 }
3199 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3200         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3201         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3202         int64_tArray ret_arr = NULL;
3203         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3204         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3205         for (size_t o = 0; o < ret_var.datalen; o++) {
3206                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3207                 *ret_conv_14_copy = ret_var.data[o];
3208                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3209                 ret_arr_ptr[o] = ret_conv_14_ref;
3210         }
3211         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3212         FREE(ret_var.data);
3213         return ret_arr;
3214 }
3215
3216 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3217         return owner->c;
3218 }
3219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3220         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3221         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3222         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
3223         return ret_arr;
3224 }
3225
3226 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3227         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3228         for (size_t i = 0; i < ret.datalen; i++) {
3229                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3230         }
3231         return ret;
3232 }
3233 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
3234 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
3235 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
3236 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
3237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
3238         LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
3239                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
3240         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
3241         LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
3242         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
3243         LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
3244                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
3245         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
3246         LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
3247         CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
3248 }
3249 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3250         LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(ptr);
3251         switch(obj->tag) {
3252                 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
3253                         LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3254                         *some_conv = obj->some;
3255                         *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
3256                         return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, tag_ptr(some_conv, true));
3257                 }
3258                 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
3259                         return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
3260                 }
3261                 default: abort();
3262         }
3263 }
3264 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3265         LDKFixedPenaltyScorer ret = *owner->contents.result;
3266         ret.is_owned = false;
3267         return ret;
3268 }
3269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3270         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3271         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3272         int64_t ret_ref = 0;
3273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3275         return ret_ref;
3276 }
3277
3278 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3279         LDKDecodeError ret = *owner->contents.err;
3280         ret.is_owned = false;
3281         return ret;
3282 }
3283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3284         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3285         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3286         int64_t ret_ref = 0;
3287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3289         return ret_ref;
3290 }
3291
3292 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3293         return owner->a;
3294 }
3295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3296         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3297         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3298         return ret_conv;
3299 }
3300
3301 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3302         return owner->b;
3303 }
3304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3305         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3306         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3307         return ret_conv;
3308 }
3309
3310 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
3311 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
3312 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
3313 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
3314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
3315         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
3316                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
3317         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
3318         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
3319         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
3320         LDKCOption_C2Tuple_u64u64ZZ_None_class =
3321                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
3322         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
3323         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
3324         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
3325 }
3326 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3327         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3328         switch(obj->tag) {
3329                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
3330                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3331                         *some_conv = obj->some;
3332                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3333                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
3334                 }
3335                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
3336                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
3337                 }
3338                 default: abort();
3339         }
3340 }
3341 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3342         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3343         for (size_t i = 0; i < ret.datalen; i++) {
3344                 ret.data[i] = NodeId_clone(&orig->data[i]);
3345         }
3346         return ret;
3347 }
3348 typedef struct LDKLogger_JCalls {
3349         atomic_size_t refcnt;
3350         JavaVM *vm;
3351         jweak o;
3352         jmethodID log_meth;
3353 } LDKLogger_JCalls;
3354 static void LDKLogger_JCalls_free(void* this_arg) {
3355         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3356         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3357                 JNIEnv *env;
3358                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3359                 if (get_jenv_res == JNI_EDETACHED) {
3360                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3361                 } else {
3362                         DO_ASSERT(get_jenv_res == JNI_OK);
3363                 }
3364                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3365                 if (get_jenv_res == JNI_EDETACHED) {
3366                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3367                 }
3368                 FREE(j_calls);
3369         }
3370 }
3371 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3372         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3373         JNIEnv *env;
3374         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3375         if (get_jenv_res == JNI_EDETACHED) {
3376                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3377         } else {
3378                 DO_ASSERT(get_jenv_res == JNI_OK);
3379         }
3380         LDKRecord record_var = *record;
3381         int64_t record_ref = 0;
3382         record_var = Record_clone(&record_var);
3383         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3384         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3385         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3386         CHECK(obj != NULL);
3387         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
3388         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3389                 (*env)->ExceptionDescribe(env);
3390                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
3391         }
3392         if (get_jenv_res == JNI_EDETACHED) {
3393                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3394         }
3395 }
3396 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3397         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3398         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3399 }
3400 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3401         jclass c = (*env)->GetObjectClass(env, o);
3402         CHECK(c != NULL);
3403         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3404         atomic_init(&calls->refcnt, 1);
3405         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3406         calls->o = (*env)->NewWeakGlobalRef(env, o);
3407         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
3408         CHECK(calls->log_meth != NULL);
3409
3410         LDKLogger ret = {
3411                 .this_arg = (void*) calls,
3412                 .log = log_LDKLogger_jcall,
3413                 .free = LDKLogger_JCalls_free,
3414         };
3415         return ret;
3416 }
3417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3418         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3419         *res_ptr = LDKLogger_init(env, clz, o);
3420         return tag_ptr(res_ptr, true);
3421 }
3422 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3423         LDKProbabilisticScorer ret = *owner->contents.result;
3424         ret.is_owned = false;
3425         return ret;
3426 }
3427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3428         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3429         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3430         int64_t ret_ref = 0;
3431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3433         return ret_ref;
3434 }
3435
3436 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3437         LDKDecodeError ret = *owner->contents.err;
3438         ret.is_owned = false;
3439         return ret;
3440 }
3441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3442         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3443         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3444         int64_t ret_ref = 0;
3445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3447         return ret_ref;
3448 }
3449
3450 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3451         LDKInitFeatures ret = *owner->contents.result;
3452         ret.is_owned = false;
3453         return ret;
3454 }
3455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3456         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3457         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3458         int64_t ret_ref = 0;
3459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3461         return ret_ref;
3462 }
3463
3464 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3465         LDKDecodeError ret = *owner->contents.err;
3466         ret.is_owned = false;
3467         return ret;
3468 }
3469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3470         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3471         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3472         int64_t ret_ref = 0;
3473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3475         return ret_ref;
3476 }
3477
3478 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3479         LDKChannelFeatures ret = *owner->contents.result;
3480         ret.is_owned = false;
3481         return ret;
3482 }
3483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3484         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3485         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_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_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3493         LDKDecodeError ret = *owner->contents.err;
3494         ret.is_owned = false;
3495         return ret;
3496 }
3497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3498         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3499         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3500         int64_t ret_ref = 0;
3501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3503         return ret_ref;
3504 }
3505
3506 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3507         LDKNodeFeatures ret = *owner->contents.result;
3508         ret.is_owned = false;
3509         return ret;
3510 }
3511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3512         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3513         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3514         int64_t ret_ref = 0;
3515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3517         return ret_ref;
3518 }
3519
3520 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3521         LDKDecodeError ret = *owner->contents.err;
3522         ret.is_owned = false;
3523         return ret;
3524 }
3525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3526         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3527         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3528         int64_t ret_ref = 0;
3529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3531         return ret_ref;
3532 }
3533
3534 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3535         LDKInvoiceFeatures ret = *owner->contents.result;
3536         ret.is_owned = false;
3537         return ret;
3538 }
3539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3540         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3541         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3542         int64_t ret_ref = 0;
3543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3545         return ret_ref;
3546 }
3547
3548 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3549         LDKDecodeError ret = *owner->contents.err;
3550         ret.is_owned = false;
3551         return ret;
3552 }
3553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3554         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3555         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3556         int64_t ret_ref = 0;
3557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3559         return ret_ref;
3560 }
3561
3562 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3563         LDKChannelTypeFeatures ret = *owner->contents.result;
3564         ret.is_owned = false;
3565         return ret;
3566 }
3567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3568         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3569         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3570         int64_t ret_ref = 0;
3571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3573         return ret_ref;
3574 }
3575
3576 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3577         LDKDecodeError ret = *owner->contents.err;
3578         ret.is_owned = false;
3579         return ret;
3580 }
3581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3582         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3583         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3584         int64_t ret_ref = 0;
3585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3587         return ret_ref;
3588 }
3589
3590 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3591         LDKNodeId ret = *owner->contents.result;
3592         ret.is_owned = false;
3593         return ret;
3594 }
3595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3596         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3597         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3598         int64_t ret_ref = 0;
3599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3601         return ret_ref;
3602 }
3603
3604 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3605         LDKDecodeError ret = *owner->contents.err;
3606         ret.is_owned = false;
3607         return ret;
3608 }
3609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3610         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3611         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3612         int64_t ret_ref = 0;
3613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3615         return ret_ref;
3616 }
3617
3618 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3619 CHECK(owner->result_ok);
3620         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3621 }
3622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3623         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3624         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3625         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3626         int64_t ret_ref = tag_ptr(ret_copy, true);
3627         return ret_ref;
3628 }
3629
3630 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3631         LDKDecodeError ret = *owner->contents.err;
3632         ret.is_owned = false;
3633         return ret;
3634 }
3635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3636         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3637         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3638         int64_t ret_ref = 0;
3639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3641         return ret_ref;
3642 }
3643
3644 typedef struct LDKAccess_JCalls {
3645         atomic_size_t refcnt;
3646         JavaVM *vm;
3647         jweak o;
3648         jmethodID get_utxo_meth;
3649 } LDKAccess_JCalls;
3650 static void LDKAccess_JCalls_free(void* this_arg) {
3651         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3652         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3653                 JNIEnv *env;
3654                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3655                 if (get_jenv_res == JNI_EDETACHED) {
3656                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3657                 } else {
3658                         DO_ASSERT(get_jenv_res == JNI_OK);
3659                 }
3660                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3661                 if (get_jenv_res == JNI_EDETACHED) {
3662                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3663                 }
3664                 FREE(j_calls);
3665         }
3666 }
3667 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3668         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3669         JNIEnv *env;
3670         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3671         if (get_jenv_res == JNI_EDETACHED) {
3672                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3673         } else {
3674                 DO_ASSERT(get_jenv_res == JNI_OK);
3675         }
3676         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3677         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3678         int64_t short_channel_id_conv = short_channel_id;
3679         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3680         CHECK(obj != NULL);
3681         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
3682         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3683                 (*env)->ExceptionDescribe(env);
3684                 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
3685         }
3686         void* ret_ptr = untag_ptr(ret);
3687         CHECK_ACCESS(ret_ptr);
3688         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3689         FREE(untag_ptr(ret));
3690         if (get_jenv_res == JNI_EDETACHED) {
3691                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3692         }
3693         return ret_conv;
3694 }
3695 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3696         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3697         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3698 }
3699 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3700         jclass c = (*env)->GetObjectClass(env, o);
3701         CHECK(c != NULL);
3702         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3703         atomic_init(&calls->refcnt, 1);
3704         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3705         calls->o = (*env)->NewWeakGlobalRef(env, o);
3706         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3707         CHECK(calls->get_utxo_meth != NULL);
3708
3709         LDKAccess ret = {
3710                 .this_arg = (void*) calls,
3711                 .get_utxo = get_utxo_LDKAccess_jcall,
3712                 .free = LDKAccess_JCalls_free,
3713         };
3714         return ret;
3715 }
3716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3717         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3718         *res_ptr = LDKAccess_init(env, clz, o);
3719         return tag_ptr(res_ptr, true);
3720 }
3721 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) {
3722         void* this_arg_ptr = untag_ptr(this_arg);
3723         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3724         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3725         unsigned char genesis_hash_arr[32];
3726         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3727         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3728         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3729         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3730         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3731         return tag_ptr(ret_conv, true);
3732 }
3733
3734 static jclass LDKCOption_AccessZ_Some_class = NULL;
3735 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
3736 static jclass LDKCOption_AccessZ_None_class = NULL;
3737 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
3738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
3739         LDKCOption_AccessZ_Some_class =
3740                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
3741         CHECK(LDKCOption_AccessZ_Some_class != NULL);
3742         LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
3743         CHECK(LDKCOption_AccessZ_Some_meth != NULL);
3744         LDKCOption_AccessZ_None_class =
3745                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
3746         CHECK(LDKCOption_AccessZ_None_class != NULL);
3747         LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
3748         CHECK(LDKCOption_AccessZ_None_meth != NULL);
3749 }
3750 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3751         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3752         switch(obj->tag) {
3753                 case LDKCOption_AccessZ_Some: {
3754                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3755                         *some_ret = obj->some;
3756                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3757                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3758                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3759                                 LDKAccess_JCalls_cloned(&(*some_ret));
3760                         }
3761                         return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, tag_ptr(some_ret, true));
3762                 }
3763                 case LDKCOption_AccessZ_None: {
3764                         return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
3765                 }
3766                 default: abort();
3767         }
3768 }
3769 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3770 CHECK(owner->result_ok);
3771         return *owner->contents.result;
3772 }
3773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3774         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3775         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3776         return ret_conv;
3777 }
3778
3779 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3780         LDKLightningError ret = *owner->contents.err;
3781         ret.is_owned = false;
3782         return ret;
3783 }
3784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3785         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3786         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3787         int64_t ret_ref = 0;
3788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3790         return ret_ref;
3791 }
3792
3793 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3794         LDKChannelAnnouncement ret = owner->a;
3795         ret.is_owned = false;
3796         return ret;
3797 }
3798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3799         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3800         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3801         int64_t ret_ref = 0;
3802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3804         return ret_ref;
3805 }
3806
3807 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3808         LDKChannelUpdate ret = owner->b;
3809         ret.is_owned = false;
3810         return ret;
3811 }
3812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3813         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3814         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3815         int64_t ret_ref = 0;
3816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3818         return ret_ref;
3819 }
3820
3821 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3822         LDKChannelUpdate ret = owner->c;
3823         ret.is_owned = false;
3824         return ret;
3825 }
3826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
3827         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3828         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3829         int64_t ret_ref = 0;
3830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3832         return ret_ref;
3833 }
3834
3835 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3836         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3837         for (size_t i = 0; i < ret.datalen; i++) {
3838                 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3839         }
3840         return ret;
3841 }
3842 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3843         LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3844         for (size_t i = 0; i < ret.datalen; i++) {
3845                 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3846         }
3847         return ret;
3848 }
3849 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3850 CHECK(owner->result_ok);
3851         return *owner->contents.result;
3852 }
3853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3854         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3855         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3856 }
3857
3858 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3859         LDKLightningError ret = *owner->contents.err;
3860         ret.is_owned = false;
3861         return ret;
3862 }
3863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3864         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3865         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3866         int64_t ret_ref = 0;
3867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3869         return ret_ref;
3870 }
3871
3872 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3873         LDKChannelUpdateInfo ret = *owner->contents.result;
3874         ret.is_owned = false;
3875         return ret;
3876 }
3877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3878         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3879         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3880         int64_t ret_ref = 0;
3881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3883         return ret_ref;
3884 }
3885
3886 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3887         LDKDecodeError ret = *owner->contents.err;
3888         ret.is_owned = false;
3889         return ret;
3890 }
3891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3892         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3893         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3894         int64_t ret_ref = 0;
3895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3897         return ret_ref;
3898 }
3899
3900 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3901         LDKChannelInfo ret = *owner->contents.result;
3902         ret.is_owned = false;
3903         return ret;
3904 }
3905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3906         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3907         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3908         int64_t ret_ref = 0;
3909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3911         return ret_ref;
3912 }
3913
3914 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3915         LDKDecodeError ret = *owner->contents.err;
3916         ret.is_owned = false;
3917         return ret;
3918 }
3919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3920         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3921         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3922         int64_t ret_ref = 0;
3923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3925         return ret_ref;
3926 }
3927
3928 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3929         LDKRoutingFees ret = *owner->contents.result;
3930         ret.is_owned = false;
3931         return ret;
3932 }
3933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3934         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3935         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3936         int64_t ret_ref = 0;
3937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3939         return ret_ref;
3940 }
3941
3942 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3943         LDKDecodeError ret = *owner->contents.err;
3944         ret.is_owned = false;
3945         return ret;
3946 }
3947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3948         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3949         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3950         int64_t ret_ref = 0;
3951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3953         return ret_ref;
3954 }
3955
3956 static jclass LDKNetAddress_IPv4_class = NULL;
3957 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3958 static jclass LDKNetAddress_IPv6_class = NULL;
3959 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3960 static jclass LDKNetAddress_OnionV2_class = NULL;
3961 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3962 static jclass LDKNetAddress_OnionV3_class = NULL;
3963 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3964 static jclass LDKNetAddress_Hostname_class = NULL;
3965 static jmethodID LDKNetAddress_Hostname_meth = NULL;
3966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3967         LDKNetAddress_IPv4_class =
3968                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
3969         CHECK(LDKNetAddress_IPv4_class != NULL);
3970         LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3971         CHECK(LDKNetAddress_IPv4_meth != NULL);
3972         LDKNetAddress_IPv6_class =
3973                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
3974         CHECK(LDKNetAddress_IPv6_class != NULL);
3975         LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3976         CHECK(LDKNetAddress_IPv6_meth != NULL);
3977         LDKNetAddress_OnionV2_class =
3978                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
3979         CHECK(LDKNetAddress_OnionV2_class != NULL);
3980         LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
3981         CHECK(LDKNetAddress_OnionV2_meth != NULL);
3982         LDKNetAddress_OnionV3_class =
3983                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
3984         CHECK(LDKNetAddress_OnionV3_class != NULL);
3985         LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3986         CHECK(LDKNetAddress_OnionV3_meth != NULL);
3987         LDKNetAddress_Hostname_class =
3988                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
3989         CHECK(LDKNetAddress_Hostname_class != NULL);
3990         LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
3991         CHECK(LDKNetAddress_Hostname_meth != NULL);
3992 }
3993 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3994         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3995         switch(obj->tag) {
3996                 case LDKNetAddress_IPv4: {
3997                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3998                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3999                         int16_t port_conv = obj->i_pv4.port;
4000                         return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
4001                 }
4002                 case LDKNetAddress_IPv6: {
4003                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4004                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4005                         int16_t port_conv = obj->i_pv6.port;
4006                         return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
4007                 }
4008                 case LDKNetAddress_OnionV2: {
4009                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4010                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4011                         return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4012                 }
4013                 case LDKNetAddress_OnionV3: {
4014                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4015                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4016                         int16_t checksum_conv = obj->onion_v3.checksum;
4017                         int8_t version_conv = obj->onion_v3.version;
4018                         int16_t port_conv = obj->onion_v3.port;
4019                         return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
4020                 }
4021                 case LDKNetAddress_Hostname: {
4022                         LDKHostname hostname_var = obj->hostname.hostname;
4023                         int64_t hostname_ref = 0;
4024                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
4025                         hostname_ref = tag_ptr(hostname_var.inner, false);
4026                         int16_t port_conv = obj->hostname.port;
4027                         return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
4028                 }
4029                 default: abort();
4030         }
4031 }
4032 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4033         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4034         for (size_t i = 0; i < ret.datalen; i++) {
4035                 ret.data[i] = NetAddress_clone(&orig->data[i]);
4036         }
4037         return ret;
4038 }
4039 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4040         LDKNodeAnnouncementInfo ret = *owner->contents.result;
4041         ret.is_owned = false;
4042         return ret;
4043 }
4044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4045         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4046         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
4047         int64_t ret_ref = 0;
4048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4050         return ret_ref;
4051 }
4052
4053 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
4054         LDKDecodeError ret = *owner->contents.err;
4055         ret.is_owned = false;
4056         return ret;
4057 }
4058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4059         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
4060         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_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 inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4068         LDKNodeAlias ret = *owner->contents.result;
4069         ret.is_owned = false;
4070         return ret;
4071 }
4072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4073         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4074         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
4075         int64_t ret_ref = 0;
4076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4078         return ret_ref;
4079 }
4080
4081 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
4082         LDKDecodeError ret = *owner->contents.err;
4083         ret.is_owned = false;
4084         return ret;
4085 }
4086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4087         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
4088         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
4089         int64_t ret_ref = 0;
4090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4092         return ret_ref;
4093 }
4094
4095 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4096         LDKNodeInfo ret = *owner->contents.result;
4097         ret.is_owned = false;
4098         return ret;
4099 }
4100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4101         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4102         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
4103         int64_t ret_ref = 0;
4104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4106         return ret_ref;
4107 }
4108
4109 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
4110         LDKDecodeError ret = *owner->contents.err;
4111         ret.is_owned = false;
4112         return ret;
4113 }
4114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4115         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
4116         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
4117         int64_t ret_ref = 0;
4118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4120         return ret_ref;
4121 }
4122
4123 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4124         LDKNetworkGraph ret = *owner->contents.result;
4125         ret.is_owned = false;
4126         return ret;
4127 }
4128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4129         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4130         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
4131         int64_t ret_ref = 0;
4132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4134         return ret_ref;
4135 }
4136
4137 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
4138         LDKDecodeError ret = *owner->contents.err;
4139         ret.is_owned = false;
4140         return ret;
4141 }
4142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4143         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
4144         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
4145         int64_t ret_ref = 0;
4146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4148         return ret_ref;
4149 }
4150
4151 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
4152 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
4153 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
4154 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
4155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
4156         LDKCOption_CVec_NetAddressZZ_Some_class =
4157                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
4158         CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
4159         LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
4160         CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
4161         LDKCOption_CVec_NetAddressZZ_None_class =
4162                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
4163         CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
4164         LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
4165         CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
4166 }
4167 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4168         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
4169         switch(obj->tag) {
4170                 case LDKCOption_CVec_NetAddressZZ_Some: {
4171                         LDKCVec_NetAddressZ some_var = obj->some;
4172                         int64_tArray some_arr = NULL;
4173                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
4174                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
4175                         for (size_t m = 0; m < some_var.datalen; m++) {
4176                                 int64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
4177                                 some_arr_ptr[m] = some_conv_12_ref;
4178                         }
4179                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
4180                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
4181                 }
4182                 case LDKCOption_CVec_NetAddressZZ_None: {
4183                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
4184                 }
4185                 default: abort();
4186         }
4187 }
4188 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4189         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
4190         ret.is_owned = false;
4191         return ret;
4192 }
4193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4194         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4195         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4196         int64_t ret_ref = 0;
4197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4199         return ret_ref;
4200 }
4201
4202 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4203         LDKDecodeError ret = *owner->contents.err;
4204         ret.is_owned = false;
4205         return ret;
4206 }
4207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4208         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4209         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4210         int64_t ret_ref = 0;
4211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4213         return ret_ref;
4214 }
4215
4216 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4217         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
4218         ret.is_owned = false;
4219         return ret;
4220 }
4221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4222         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4223         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4224         int64_t ret_ref = 0;
4225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4227         return ret_ref;
4228 }
4229
4230 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4231         LDKDecodeError ret = *owner->contents.err;
4232         ret.is_owned = false;
4233         return ret;
4234 }
4235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4236         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4237         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4238         int64_t ret_ref = 0;
4239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4241         return ret_ref;
4242 }
4243
4244 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4245 CHECK(owner->result_ok);
4246         return SpendableOutputDescriptor_clone(&*owner->contents.result);
4247 }
4248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4249         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4250         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
4251         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
4252         int64_t ret_ref = tag_ptr(ret_copy, true);
4253         return ret_ref;
4254 }
4255
4256 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
4257         LDKDecodeError ret = *owner->contents.err;
4258         ret.is_owned = false;
4259         return ret;
4260 }
4261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4262         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
4263         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
4264         int64_t ret_ref = 0;
4265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4267         return ret_ref;
4268 }
4269
4270 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
4271         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
4272         for (size_t i = 0; i < ret.datalen; i++) {
4273                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4274         }
4275         return ret;
4276 }
4277 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4278         return owner->a;
4279 }
4280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4281         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4282         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4283         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
4284         return ret_arr;
4285 }
4286
4287 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
4288         return owner->b;
4289 }
4290 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4291         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
4292         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
4293         jobjectArray ret_arr = NULL;
4294         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4295         ;
4296         for (size_t i = 0; i < ret_var.datalen; i++) {
4297                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
4298                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
4299                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4300         }
4301         
4302         return ret_arr;
4303 }
4304
4305 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4306 CHECK(owner->result_ok);
4307         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
4308 }
4309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4310         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4311         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4312         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
4313         return tag_ptr(ret_conv, true);
4314 }
4315
4316 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
4317 CHECK(!owner->result_ok);
4318         return *owner->contents.err;
4319 }
4320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4321         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
4322         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
4323 }
4324
4325 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4326 CHECK(owner->result_ok);
4327         return *owner->contents.result;
4328 }
4329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4330         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4331         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
4333         return ret_arr;
4334 }
4335
4336 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
4337 CHECK(!owner->result_ok);
4338         return *owner->contents.err;
4339 }
4340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4341         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
4342         CResult_SignatureNoneZ_get_err(owner_conv);
4343 }
4344
4345 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4346         return owner->a;
4347 }
4348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4349         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
4350         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4351         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
4352         return ret_arr;
4353 }
4354
4355 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
4356         return owner->b;
4357 }
4358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4359         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
4360         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
4361         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
4362         return ret_arr;
4363 }
4364
4365 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4366 CHECK(owner->result_ok);
4367         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
4368 }
4369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4370         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
4371         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
4372         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
4373         return tag_ptr(ret_conv, true);
4374 }
4375
4376 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
4377 CHECK(!owner->result_ok);
4378         return *owner->contents.err;
4379 }
4380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4381         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
4382         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
4383 }
4384
4385 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4386 CHECK(owner->result_ok);
4387         return *owner->contents.result;
4388 }
4389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4390         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
4391         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4392         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
4393         return ret_arr;
4394 }
4395
4396 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
4397 CHECK(!owner->result_ok);
4398         return *owner->contents.err;
4399 }
4400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4401         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
4402         CResult_SecretKeyNoneZ_get_err(owner_conv);
4403 }
4404
4405 typedef struct LDKBaseSign_JCalls {
4406         atomic_size_t refcnt;
4407         JavaVM *vm;
4408         jweak o;
4409         jmethodID get_per_commitment_point_meth;
4410         jmethodID release_commitment_secret_meth;
4411         jmethodID validate_holder_commitment_meth;
4412         jmethodID channel_keys_id_meth;
4413         jmethodID sign_counterparty_commitment_meth;
4414         jmethodID validate_counterparty_revocation_meth;
4415         jmethodID sign_holder_commitment_and_htlcs_meth;
4416         jmethodID sign_justice_revoked_output_meth;
4417         jmethodID sign_justice_revoked_htlc_meth;
4418         jmethodID sign_counterparty_htlc_transaction_meth;
4419         jmethodID sign_closing_transaction_meth;
4420         jmethodID sign_channel_announcement_meth;
4421         jmethodID ready_channel_meth;
4422 } LDKBaseSign_JCalls;
4423 static void LDKBaseSign_JCalls_free(void* this_arg) {
4424         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4425         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4426                 JNIEnv *env;
4427                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4428                 if (get_jenv_res == JNI_EDETACHED) {
4429                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4430                 } else {
4431                         DO_ASSERT(get_jenv_res == JNI_OK);
4432                 }
4433                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4434                 if (get_jenv_res == JNI_EDETACHED) {
4435                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4436                 }
4437                 FREE(j_calls);
4438         }
4439 }
4440 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4441         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4442         JNIEnv *env;
4443         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4444         if (get_jenv_res == JNI_EDETACHED) {
4445                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4446         } else {
4447                 DO_ASSERT(get_jenv_res == JNI_OK);
4448         }
4449         int64_t idx_conv = idx;
4450         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4451         CHECK(obj != NULL);
4452         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
4453         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4454                 (*env)->ExceptionDescribe(env);
4455                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
4456         }
4457         LDKPublicKey ret_ref;
4458         CHECK((*env)->GetArrayLength(env, ret) == 33);
4459         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
4460         if (get_jenv_res == JNI_EDETACHED) {
4461                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4462         }
4463         return ret_ref;
4464 }
4465 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
4466         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4467         JNIEnv *env;
4468         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4469         if (get_jenv_res == JNI_EDETACHED) {
4470                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4471         } else {
4472                 DO_ASSERT(get_jenv_res == JNI_OK);
4473         }
4474         int64_t idx_conv = idx;
4475         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4476         CHECK(obj != NULL);
4477         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
4478         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4479                 (*env)->ExceptionDescribe(env);
4480                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
4481         }
4482         LDKThirtyTwoBytes ret_ref;
4483         CHECK((*env)->GetArrayLength(env, ret) == 32);
4484         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4485         if (get_jenv_res == JNI_EDETACHED) {
4486                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4487         }
4488         return ret_ref;
4489 }
4490 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
4491         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4492         JNIEnv *env;
4493         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4494         if (get_jenv_res == JNI_EDETACHED) {
4495                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4496         } else {
4497                 DO_ASSERT(get_jenv_res == JNI_OK);
4498         }
4499         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
4500         int64_t holder_tx_ref = 0;
4501         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
4502         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
4503         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
4504         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4505         jobjectArray preimages_arr = NULL;
4506         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4507         ;
4508         for (size_t i = 0; i < preimages_var.datalen; i++) {
4509                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4510                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4511                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4512         }
4513         
4514         FREE(preimages_var.data);
4515         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4516         CHECK(obj != NULL);
4517         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
4518         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4519                 (*env)->ExceptionDescribe(env);
4520                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
4521         }
4522         void* ret_ptr = untag_ptr(ret);
4523         CHECK_ACCESS(ret_ptr);
4524         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4525         FREE(untag_ptr(ret));
4526         if (get_jenv_res == JNI_EDETACHED) {
4527                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4528         }
4529         return ret_conv;
4530 }
4531 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
4532         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4533         JNIEnv *env;
4534         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4535         if (get_jenv_res == JNI_EDETACHED) {
4536                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4537         } else {
4538                 DO_ASSERT(get_jenv_res == JNI_OK);
4539         }
4540         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4541         CHECK(obj != NULL);
4542         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
4543         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4544                 (*env)->ExceptionDescribe(env);
4545                 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
4546         }
4547         LDKThirtyTwoBytes ret_ref;
4548         CHECK((*env)->GetArrayLength(env, ret) == 32);
4549         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4550         if (get_jenv_res == JNI_EDETACHED) {
4551                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4552         }
4553         return ret_ref;
4554 }
4555 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
4556         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4557         JNIEnv *env;
4558         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4559         if (get_jenv_res == JNI_EDETACHED) {
4560                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4561         } else {
4562                 DO_ASSERT(get_jenv_res == JNI_OK);
4563         }
4564         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
4565         int64_t commitment_tx_ref = 0;
4566         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
4567         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4568         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4569         LDKCVec_PaymentPreimageZ preimages_var = preimages;
4570         jobjectArray preimages_arr = NULL;
4571         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
4572         ;
4573         for (size_t i = 0; i < preimages_var.datalen; i++) {
4574                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
4575                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
4576                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
4577         }
4578         
4579         FREE(preimages_var.data);
4580         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4581         CHECK(obj != NULL);
4582         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
4583         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4584                 (*env)->ExceptionDescribe(env);
4585                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
4586         }
4587         void* ret_ptr = untag_ptr(ret);
4588         CHECK_ACCESS(ret_ptr);
4589         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4590         FREE(untag_ptr(ret));
4591         if (get_jenv_res == JNI_EDETACHED) {
4592                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4593         }
4594         return ret_conv;
4595 }
4596 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
4597         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4598         JNIEnv *env;
4599         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4600         if (get_jenv_res == JNI_EDETACHED) {
4601                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4602         } else {
4603                 DO_ASSERT(get_jenv_res == JNI_OK);
4604         }
4605         int64_t idx_conv = idx;
4606         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
4607         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
4608         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4609         CHECK(obj != NULL);
4610         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
4611         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4612                 (*env)->ExceptionDescribe(env);
4613                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
4614         }
4615         void* ret_ptr = untag_ptr(ret);
4616         CHECK_ACCESS(ret_ptr);
4617         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
4618         FREE(untag_ptr(ret));
4619         if (get_jenv_res == JNI_EDETACHED) {
4620                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4621         }
4622         return ret_conv;
4623 }
4624 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
4625         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4626         JNIEnv *env;
4627         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4628         if (get_jenv_res == JNI_EDETACHED) {
4629                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4630         } else {
4631                 DO_ASSERT(get_jenv_res == JNI_OK);
4632         }
4633         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
4634         int64_t commitment_tx_ref = 0;
4635         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
4636         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
4637         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
4638         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4639         CHECK(obj != NULL);
4640         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
4641         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4642                 (*env)->ExceptionDescribe(env);
4643                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
4644         }
4645         void* ret_ptr = untag_ptr(ret);
4646         CHECK_ACCESS(ret_ptr);
4647         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
4648         FREE(untag_ptr(ret));
4649         if (get_jenv_res == JNI_EDETACHED) {
4650                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4651         }
4652         return ret_conv;
4653 }
4654 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]) {
4655         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4656         JNIEnv *env;
4657         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4658         if (get_jenv_res == JNI_EDETACHED) {
4659                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4660         } else {
4661                 DO_ASSERT(get_jenv_res == JNI_OK);
4662         }
4663         LDKTransaction justice_tx_var = justice_tx;
4664         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4665         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4666         Transaction_free(justice_tx_var);
4667         int64_t input_conv = input;
4668         int64_t amount_conv = amount;
4669         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4670         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4671         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4672         CHECK(obj != NULL);
4673         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);
4674         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4675                 (*env)->ExceptionDescribe(env);
4676                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
4677         }
4678         void* ret_ptr = untag_ptr(ret);
4679         CHECK_ACCESS(ret_ptr);
4680         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4681         FREE(untag_ptr(ret));
4682         if (get_jenv_res == JNI_EDETACHED) {
4683                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4684         }
4685         return ret_conv;
4686 }
4687 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) {
4688         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4689         JNIEnv *env;
4690         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4691         if (get_jenv_res == JNI_EDETACHED) {
4692                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4693         } else {
4694                 DO_ASSERT(get_jenv_res == JNI_OK);
4695         }
4696         LDKTransaction justice_tx_var = justice_tx;
4697         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4698         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4699         Transaction_free(justice_tx_var);
4700         int64_t input_conv = input;
4701         int64_t amount_conv = amount;
4702         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4703         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4704         LDKHTLCOutputInCommitment htlc_var = *htlc;
4705         int64_t htlc_ref = 0;
4706         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4707         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4708         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4709         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4710         CHECK(obj != NULL);
4711         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);
4712         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4713                 (*env)->ExceptionDescribe(env);
4714                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
4715         }
4716         void* ret_ptr = untag_ptr(ret);
4717         CHECK_ACCESS(ret_ptr);
4718         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4719         FREE(untag_ptr(ret));
4720         if (get_jenv_res == JNI_EDETACHED) {
4721                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4722         }
4723         return ret_conv;
4724 }
4725 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) {
4726         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4727         JNIEnv *env;
4728         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4729         if (get_jenv_res == JNI_EDETACHED) {
4730                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4731         } else {
4732                 DO_ASSERT(get_jenv_res == JNI_OK);
4733         }
4734         LDKTransaction htlc_tx_var = htlc_tx;
4735         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4736         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4737         Transaction_free(htlc_tx_var);
4738         int64_t input_conv = input;
4739         int64_t amount_conv = amount;
4740         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4741         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4742         LDKHTLCOutputInCommitment htlc_var = *htlc;
4743         int64_t htlc_ref = 0;
4744         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4745         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4746         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4747         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4748         CHECK(obj != NULL);
4749         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);
4750         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4751                 (*env)->ExceptionDescribe(env);
4752                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4753         }
4754         void* ret_ptr = untag_ptr(ret);
4755         CHECK_ACCESS(ret_ptr);
4756         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4757         FREE(untag_ptr(ret));
4758         if (get_jenv_res == JNI_EDETACHED) {
4759                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4760         }
4761         return ret_conv;
4762 }
4763 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4764         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4765         JNIEnv *env;
4766         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4767         if (get_jenv_res == JNI_EDETACHED) {
4768                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4769         } else {
4770                 DO_ASSERT(get_jenv_res == JNI_OK);
4771         }
4772         LDKClosingTransaction closing_tx_var = *closing_tx;
4773         int64_t closing_tx_ref = 0;
4774         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4775         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4776         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4777         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4778         CHECK(obj != NULL);
4779         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4780         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4781                 (*env)->ExceptionDescribe(env);
4782                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4783         }
4784         void* ret_ptr = untag_ptr(ret);
4785         CHECK_ACCESS(ret_ptr);
4786         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4787         FREE(untag_ptr(ret));
4788         if (get_jenv_res == JNI_EDETACHED) {
4789                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4790         }
4791         return ret_conv;
4792 }
4793 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4794         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4795         JNIEnv *env;
4796         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4797         if (get_jenv_res == JNI_EDETACHED) {
4798                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4799         } else {
4800                 DO_ASSERT(get_jenv_res == JNI_OK);
4801         }
4802         LDKUnsignedChannelAnnouncement msg_var = *msg;
4803         int64_t msg_ref = 0;
4804         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4805         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4806         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4807         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4808         CHECK(obj != NULL);
4809         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4810         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4811                 (*env)->ExceptionDescribe(env);
4812                 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4813         }
4814         void* ret_ptr = untag_ptr(ret);
4815         CHECK_ACCESS(ret_ptr);
4816         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4817         FREE(untag_ptr(ret));
4818         if (get_jenv_res == JNI_EDETACHED) {
4819                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4820         }
4821         return ret_conv;
4822 }
4823 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4824         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4825         JNIEnv *env;
4826         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4827         if (get_jenv_res == JNI_EDETACHED) {
4828                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4829         } else {
4830                 DO_ASSERT(get_jenv_res == JNI_OK);
4831         }
4832         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4833         int64_t channel_parameters_ref = 0;
4834         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4835         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4836         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4837         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4838         CHECK(obj != NULL);
4839         (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4840         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4841                 (*env)->ExceptionDescribe(env);
4842                 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4843         }
4844         if (get_jenv_res == JNI_EDETACHED) {
4845                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4846         }
4847 }
4848 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4849         jclass c = (*env)->GetObjectClass(env, o);
4850         CHECK(c != NULL);
4851         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4852         atomic_init(&calls->refcnt, 1);
4853         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4854         calls->o = (*env)->NewWeakGlobalRef(env, o);
4855         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4856         CHECK(calls->get_per_commitment_point_meth != NULL);
4857         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4858         CHECK(calls->release_commitment_secret_meth != NULL);
4859         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4860         CHECK(calls->validate_holder_commitment_meth != NULL);
4861         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4862         CHECK(calls->channel_keys_id_meth != NULL);
4863         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4864         CHECK(calls->sign_counterparty_commitment_meth != NULL);
4865         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4866         CHECK(calls->validate_counterparty_revocation_meth != NULL);
4867         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4868         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4869         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4870         CHECK(calls->sign_justice_revoked_output_meth != NULL);
4871         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4872         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4873         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4874         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4875         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4876         CHECK(calls->sign_closing_transaction_meth != NULL);
4877         calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4878         CHECK(calls->sign_channel_announcement_meth != NULL);
4879         calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4880         CHECK(calls->ready_channel_meth != NULL);
4881
4882         LDKChannelPublicKeys pubkeys_conv;
4883         pubkeys_conv.inner = untag_ptr(pubkeys);
4884         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4885         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4886
4887         LDKBaseSign ret = {
4888                 .this_arg = (void*) calls,
4889                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4890                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4891                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4892                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4893                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4894                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4895                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4896                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4897                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4898                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4899                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4900                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4901                 .ready_channel = ready_channel_LDKBaseSign_jcall,
4902                 .free = LDKBaseSign_JCalls_free,
4903                 .pubkeys = pubkeys_conv,
4904                 .set_pubkeys = NULL,
4905         };
4906         return ret;
4907 }
4908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4909         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4910         *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
4911         return tag_ptr(res_ptr, true);
4912 }
4913 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) {
4914         void* this_arg_ptr = untag_ptr(this_arg);
4915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4916         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4917         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4918         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
4919         return ret_arr;
4920 }
4921
4922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4923         void* this_arg_ptr = untag_ptr(this_arg);
4924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4925         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4926         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4927         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
4928         return ret_arr;
4929 }
4930
4931 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) {
4932         void* this_arg_ptr = untag_ptr(this_arg);
4933         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4934         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4935         LDKHolderCommitmentTransaction holder_tx_conv;
4936         holder_tx_conv.inner = untag_ptr(holder_tx);
4937         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4938         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4939         holder_tx_conv.is_owned = false;
4940         LDKCVec_PaymentPreimageZ preimages_constr;
4941         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4942         if (preimages_constr.datalen > 0)
4943                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4944         else
4945                 preimages_constr.data = NULL;
4946         for (size_t i = 0; i < preimages_constr.datalen; i++) {
4947                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4948                 LDKThirtyTwoBytes preimages_conv_8_ref;
4949                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4950                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4951                 preimages_constr.data[i] = preimages_conv_8_ref;
4952         }
4953         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4954         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4955         return tag_ptr(ret_conv, true);
4956 }
4957
4958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4959         void* this_arg_ptr = untag_ptr(this_arg);
4960         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4961         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4962         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4963         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
4964         return ret_arr;
4965 }
4966
4967 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) {
4968         void* this_arg_ptr = untag_ptr(this_arg);
4969         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4970         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4971         LDKCommitmentTransaction commitment_tx_conv;
4972         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4973         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4974         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4975         commitment_tx_conv.is_owned = false;
4976         LDKCVec_PaymentPreimageZ preimages_constr;
4977         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4978         if (preimages_constr.datalen > 0)
4979                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4980         else
4981                 preimages_constr.data = NULL;
4982         for (size_t i = 0; i < preimages_constr.datalen; i++) {
4983                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4984                 LDKThirtyTwoBytes preimages_conv_8_ref;
4985                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4986                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4987                 preimages_constr.data[i] = preimages_conv_8_ref;
4988         }
4989         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4990         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4991         return tag_ptr(ret_conv, true);
4992 }
4993
4994 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) {
4995         void* this_arg_ptr = untag_ptr(this_arg);
4996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4997         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4998         unsigned char secret_arr[32];
4999         CHECK((*env)->GetArrayLength(env, secret) == 32);
5000         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
5001         unsigned char (*secret_ref)[32] = &secret_arr;
5002         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
5003         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
5004         return tag_ptr(ret_conv, true);
5005 }
5006
5007 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) {
5008         void* this_arg_ptr = untag_ptr(this_arg);
5009         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5010         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5011         LDKHolderCommitmentTransaction commitment_tx_conv;
5012         commitment_tx_conv.inner = untag_ptr(commitment_tx);
5013         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
5014         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
5015         commitment_tx_conv.is_owned = false;
5016         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5017         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
5018         return tag_ptr(ret_conv, true);
5019 }
5020
5021 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) {
5022         void* this_arg_ptr = untag_ptr(this_arg);
5023         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5024         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5025         LDKTransaction justice_tx_ref;
5026         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5027         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5028         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5029         justice_tx_ref.data_is_owned = true;
5030         unsigned char per_commitment_key_arr[32];
5031         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5032         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5033         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5034         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5035         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
5036         return tag_ptr(ret_conv, true);
5037 }
5038
5039 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) {
5040         void* this_arg_ptr = untag_ptr(this_arg);
5041         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5042         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5043         LDKTransaction justice_tx_ref;
5044         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
5045         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
5046         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
5047         justice_tx_ref.data_is_owned = true;
5048         unsigned char per_commitment_key_arr[32];
5049         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
5050         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
5051         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
5052         LDKHTLCOutputInCommitment htlc_conv;
5053         htlc_conv.inner = untag_ptr(htlc);
5054         htlc_conv.is_owned = ptr_is_owned(htlc);
5055         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5056         htlc_conv.is_owned = false;
5057         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5058         *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);
5059         return tag_ptr(ret_conv, true);
5060 }
5061
5062 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) {
5063         void* this_arg_ptr = untag_ptr(this_arg);
5064         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5065         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5066         LDKTransaction htlc_tx_ref;
5067         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
5068         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
5069         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
5070         htlc_tx_ref.data_is_owned = true;
5071         LDKPublicKey per_commitment_point_ref;
5072         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
5073         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
5074         LDKHTLCOutputInCommitment htlc_conv;
5075         htlc_conv.inner = untag_ptr(htlc);
5076         htlc_conv.is_owned = ptr_is_owned(htlc);
5077         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
5078         htlc_conv.is_owned = false;
5079         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5080         *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);
5081         return tag_ptr(ret_conv, true);
5082 }
5083
5084 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) {
5085         void* this_arg_ptr = untag_ptr(this_arg);
5086         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5087         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5088         LDKClosingTransaction closing_tx_conv;
5089         closing_tx_conv.inner = untag_ptr(closing_tx);
5090         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
5091         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
5092         closing_tx_conv.is_owned = false;
5093         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5094         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
5095         return tag_ptr(ret_conv, true);
5096 }
5097
5098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5099         void* this_arg_ptr = untag_ptr(this_arg);
5100         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5101         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5102         LDKUnsignedChannelAnnouncement msg_conv;
5103         msg_conv.inner = untag_ptr(msg);
5104         msg_conv.is_owned = ptr_is_owned(msg);
5105         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
5106         msg_conv.is_owned = false;
5107         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
5108         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5109         return tag_ptr(ret_conv, true);
5110 }
5111
5112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
5113         void* this_arg_ptr = untag_ptr(this_arg);
5114         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5115         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5116         LDKChannelTransactionParameters channel_parameters_conv;
5117         channel_parameters_conv.inner = untag_ptr(channel_parameters);
5118         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
5119         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
5120         channel_parameters_conv.is_owned = false;
5121         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
5122 }
5123
5124 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
5125         if (this_arg->set_pubkeys != NULL)
5126                 this_arg->set_pubkeys(this_arg);
5127         return this_arg->pubkeys;
5128 }
5129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
5130         void* this_arg_ptr = untag_ptr(this_arg);
5131         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5132         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
5133         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
5134         int64_t ret_ref = 0;
5135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5137         return ret_ref;
5138 }
5139
5140 typedef struct LDKSign_JCalls {
5141         atomic_size_t refcnt;
5142         JavaVM *vm;
5143         jweak o;
5144         LDKBaseSign_JCalls* BaseSign;
5145         jmethodID write_meth;
5146 } LDKSign_JCalls;
5147 static void LDKSign_JCalls_free(void* this_arg) {
5148         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5149         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5150                 JNIEnv *env;
5151                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5152                 if (get_jenv_res == JNI_EDETACHED) {
5153                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5154                 } else {
5155                         DO_ASSERT(get_jenv_res == JNI_OK);
5156                 }
5157                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5158                 if (get_jenv_res == JNI_EDETACHED) {
5159                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5160                 }
5161                 FREE(j_calls);
5162         }
5163 }
5164 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
5165         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
5166         JNIEnv *env;
5167         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5168         if (get_jenv_res == JNI_EDETACHED) {
5169                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5170         } else {
5171                 DO_ASSERT(get_jenv_res == JNI_OK);
5172         }
5173         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5174         CHECK(obj != NULL);
5175         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5176         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5177                 (*env)->ExceptionDescribe(env);
5178                 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
5179         }
5180         LDKCVec_u8Z ret_ref;
5181         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5182         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5183         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5184         if (get_jenv_res == JNI_EDETACHED) {
5185                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5186         }
5187         return ret_ref;
5188 }
5189 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
5190         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
5191         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5192         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
5193 }
5194 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5195         jclass c = (*env)->GetObjectClass(env, o);
5196         CHECK(c != NULL);
5197         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
5198         atomic_init(&calls->refcnt, 1);
5199         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5200         calls->o = (*env)->NewWeakGlobalRef(env, o);
5201         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
5202         CHECK(calls->write_meth != NULL);
5203
5204         LDKChannelPublicKeys pubkeys_conv;
5205         pubkeys_conv.inner = untag_ptr(pubkeys);
5206         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
5207         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
5208
5209         LDKSign ret = {
5210                 .this_arg = (void*) calls,
5211                 .write = write_LDKSign_jcall,
5212                 .cloned = LDKSign_JCalls_cloned,
5213                 .free = LDKSign_JCalls_free,
5214                 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
5215         };
5216         calls->BaseSign = ret.BaseSign.this_arg;
5217         return ret;
5218 }
5219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
5220         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
5221         *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
5222         return tag_ptr(res_ptr, true);
5223 }
5224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
5225         LDKSign *inp = (LDKSign *)untag_ptr(arg);
5226         return tag_ptr(&inp->BaseSign, false);
5227 }
5228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
5229         void* this_arg_ptr = untag_ptr(this_arg);
5230         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5231         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
5232         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5233         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5234         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5235         CVec_u8Z_free(ret_var);
5236         return ret_arr;
5237 }
5238
5239 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5240 CHECK(owner->result_ok);
5241         return Sign_clone(&*owner->contents.result);
5242 }
5243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5244         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
5245         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5246         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
5247         return tag_ptr(ret_ret, true);
5248 }
5249
5250 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
5251         LDKDecodeError ret = *owner->contents.err;
5252         ret.is_owned = false;
5253         return ret;
5254 }
5255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5256         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
5257         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
5258         int64_t ret_ref = 0;
5259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5261         return ret_ref;
5262 }
5263
5264 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5265 CHECK(owner->result_ok);
5266         return *owner->contents.result;
5267 }
5268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5269         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5270         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
5271         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
5272         return ret_arr;
5273 }
5274
5275 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
5276 CHECK(!owner->result_ok);
5277         return *owner->contents.err;
5278 }
5279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5280         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
5281         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
5282 }
5283
5284 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
5285         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
5286         for (size_t i = 0; i < ret.datalen; i++) {
5287                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
5288         }
5289         return ret;
5290 }
5291 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5292 CHECK(owner->result_ok);
5293         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
5294 }
5295 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5296         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
5297         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
5298         jobjectArray ret_arr = NULL;
5299         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
5300         ;
5301         for (size_t i = 0; i < ret_var.datalen; i++) {
5302                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
5303                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
5304                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
5305                 CVec_u8Z_free(ret_conv_8_var);
5306                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
5307         }
5308         
5309         FREE(ret_var.data);
5310         return ret_arr;
5311 }
5312
5313 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
5314 CHECK(!owner->result_ok);
5315         return *owner->contents.err;
5316 }
5317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5318         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
5319         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
5320 }
5321
5322 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5323         LDKInMemorySigner ret = *owner->contents.result;
5324         ret.is_owned = false;
5325         return ret;
5326 }
5327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5328         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
5329         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
5330         int64_t ret_ref = 0;
5331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5333         return ret_ref;
5334 }
5335
5336 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
5337         LDKDecodeError ret = *owner->contents.err;
5338         ret.is_owned = false;
5339         return ret;
5340 }
5341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5342         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
5343         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
5344         int64_t ret_ref = 0;
5345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5347         return ret_ref;
5348 }
5349
5350 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
5351         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
5352         for (size_t i = 0; i < ret.datalen; i++) {
5353                 ret.data[i] = TxOut_clone(&orig->data[i]);
5354         }
5355         return ret;
5356 }
5357 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5358 CHECK(owner->result_ok);
5359         return *owner->contents.result;
5360 }
5361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5362         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
5363         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
5364         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5365         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5366         return ret_arr;
5367 }
5368
5369 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
5370 CHECK(!owner->result_ok);
5371         return *owner->contents.err;
5372 }
5373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5374         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
5375         CResult_TransactionNoneZ_get_err(owner_conv);
5376 }
5377
5378 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5379         return ThirtyTwoBytes_clone(&owner->a);
5380 }
5381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5382         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
5383         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5384         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
5385         return ret_arr;
5386 }
5387
5388 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
5389         LDKChannelMonitor ret = owner->b;
5390         ret.is_owned = false;
5391         return ret;
5392 }
5393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5394         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
5395         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
5396         int64_t ret_ref = 0;
5397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5399         return ret_ref;
5400 }
5401
5402 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
5403         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
5404         for (size_t i = 0; i < ret.datalen; i++) {
5405                 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
5406         }
5407         return ret;
5408 }
5409 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5410 CHECK(owner->result_ok);
5411         return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
5412 }
5413 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5414         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
5415         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
5416         int64_tArray ret_arr = NULL;
5417         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5418         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5419         for (size_t j = 0; j < ret_var.datalen; j++) {
5420                 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5421                 *ret_conv_35_conv = ret_var.data[j];
5422                 ret_arr_ptr[j] = tag_ptr(ret_conv_35_conv, true);
5423         }
5424         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5425         FREE(ret_var.data);
5426         return ret_arr;
5427 }
5428
5429 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
5430 CHECK(!owner->result_ok);
5431         return *owner->contents.err;
5432 }
5433 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5434         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
5435         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
5436         return ret_conv;
5437 }
5438
5439 static jclass LDKCOption_u16Z_Some_class = NULL;
5440 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
5441 static jclass LDKCOption_u16Z_None_class = NULL;
5442 static jmethodID LDKCOption_u16Z_None_meth = NULL;
5443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
5444         LDKCOption_u16Z_Some_class =
5445                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
5446         CHECK(LDKCOption_u16Z_Some_class != NULL);
5447         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
5448         CHECK(LDKCOption_u16Z_Some_meth != NULL);
5449         LDKCOption_u16Z_None_class =
5450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
5451         CHECK(LDKCOption_u16Z_None_class != NULL);
5452         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
5453         CHECK(LDKCOption_u16Z_None_meth != NULL);
5454 }
5455 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5456         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
5457         switch(obj->tag) {
5458                 case LDKCOption_u16Z_Some: {
5459                         int16_t some_conv = obj->some;
5460                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
5461                 }
5462                 case LDKCOption_u16Z_None: {
5463                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
5464                 }
5465                 default: abort();
5466         }
5467 }
5468 static jclass LDKAPIError_APIMisuseError_class = NULL;
5469 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
5470 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
5471 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
5472 static jclass LDKAPIError_RouteError_class = NULL;
5473 static jmethodID LDKAPIError_RouteError_meth = NULL;
5474 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
5475 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
5476 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
5477 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
5478 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
5479 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
5480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
5481         LDKAPIError_APIMisuseError_class =
5482                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
5483         CHECK(LDKAPIError_APIMisuseError_class != NULL);
5484         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
5485         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
5486         LDKAPIError_FeeRateTooHigh_class =
5487                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
5488         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
5489         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
5490         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
5491         LDKAPIError_RouteError_class =
5492                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
5493         CHECK(LDKAPIError_RouteError_class != NULL);
5494         LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
5495         CHECK(LDKAPIError_RouteError_meth != NULL);
5496         LDKAPIError_ChannelUnavailable_class =
5497                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
5498         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
5499         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
5500         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
5501         LDKAPIError_MonitorUpdateFailed_class =
5502                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
5503         CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
5504         LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
5505         CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
5506         LDKAPIError_IncompatibleShutdownScript_class =
5507                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
5508         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
5509         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
5510         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
5511 }
5512 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5513         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
5514         switch(obj->tag) {
5515                 case LDKAPIError_APIMisuseError: {
5516                         LDKStr err_str = obj->api_misuse_error.err;
5517                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5518                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
5519                 }
5520                 case LDKAPIError_FeeRateTooHigh: {
5521                         LDKStr err_str = obj->fee_rate_too_high.err;
5522                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5523                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
5524                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
5525                 }
5526                 case LDKAPIError_RouteError: {
5527                         LDKStr err_str = obj->route_error.err;
5528                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5529                         return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
5530                 }
5531                 case LDKAPIError_ChannelUnavailable: {
5532                         LDKStr err_str = obj->channel_unavailable.err;
5533                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5534                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
5535                 }
5536                 case LDKAPIError_MonitorUpdateFailed: {
5537                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
5538                 }
5539                 case LDKAPIError_IncompatibleShutdownScript: {
5540                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
5541                         int64_t script_ref = 0;
5542                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
5543                         script_ref = tag_ptr(script_var.inner, false);
5544                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
5545                 }
5546                 default: abort();
5547         }
5548 }
5549 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5550 CHECK(owner->result_ok);
5551         return *owner->contents.result;
5552 }
5553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5554         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
5555         CResult_NoneAPIErrorZ_get_ok(owner_conv);
5556 }
5557
5558 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
5559 CHECK(!owner->result_ok);
5560         return APIError_clone(&*owner->contents.err);
5561 }
5562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5563         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
5564         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5565         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
5566         int64_t ret_ref = tag_ptr(ret_copy, true);
5567         return ret_ref;
5568 }
5569
5570 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
5571         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
5572         for (size_t i = 0; i < ret.datalen; i++) {
5573                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
5574         }
5575         return ret;
5576 }
5577 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
5578         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
5579         for (size_t i = 0; i < ret.datalen; i++) {
5580                 ret.data[i] = APIError_clone(&orig->data[i]);
5581         }
5582         return ret;
5583 }
5584 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5585 CHECK(owner->result_ok);
5586         return ThirtyTwoBytes_clone(&*owner->contents.result);
5587 }
5588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5589         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5590         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5591         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
5592         return ret_arr;
5593 }
5594
5595 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5596 CHECK(!owner->result_ok);
5597         return APIError_clone(&*owner->contents.err);
5598 }
5599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5600         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5601         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5602         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5603         int64_t ret_ref = tag_ptr(ret_copy, true);
5604         return ret_ref;
5605 }
5606
5607 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
5608 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
5609 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
5610 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
5611 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
5612 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
5613 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
5614 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
5615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
5616         LDKPaymentSendFailure_ParameterError_class =
5617                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
5618         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
5619         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
5620         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
5621         LDKPaymentSendFailure_PathParameterError_class =
5622                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
5623         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
5624         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
5625         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
5626         LDKPaymentSendFailure_AllFailedRetrySafe_class =
5627                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
5628         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
5629         LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
5630         CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
5631         LDKPaymentSendFailure_PartialFailure_class =
5632                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
5633         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
5634         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
5635         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
5636 }
5637 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5638         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5639         switch(obj->tag) {
5640                 case LDKPaymentSendFailure_ParameterError: {
5641                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
5642                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
5643                 }
5644                 case LDKPaymentSendFailure_PathParameterError: {
5645                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5646                         int64_tArray path_parameter_error_arr = NULL;
5647                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
5648                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
5649                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5650                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5651                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5652                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5653                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
5654                         }
5655                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
5656                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
5657                 }
5658                 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5659                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5660                         int64_tArray all_failed_retry_safe_arr = NULL;
5661                         all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
5662                         int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
5663                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5664                                 int64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
5665                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5666                         }
5667                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
5668                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
5669                 }
5670                 case LDKPaymentSendFailure_PartialFailure: {
5671                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5672                         int64_tArray results_arr = NULL;
5673                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
5674                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
5675                         for (size_t w = 0; w < results_var.datalen; w++) {
5676                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5677                                 *results_conv_22_conv = results_var.data[w];
5678                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5679                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
5680                         }
5681                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
5682                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5683                         int64_t failed_paths_retry_ref = 0;
5684                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5685                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
5686                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5687                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
5688                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5689                 }
5690                 default: abort();
5691         }
5692 }
5693 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5694 CHECK(owner->result_ok);
5695         return ThirtyTwoBytes_clone(&*owner->contents.result);
5696 }
5697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5698         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
5699         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5700         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5701         return ret_arr;
5702 }
5703
5704 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5705 CHECK(!owner->result_ok);
5706         return PaymentSendFailure_clone(&*owner->contents.err);
5707 }
5708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5709         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
5710         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5711         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5712         int64_t ret_ref = tag_ptr(ret_copy, true);
5713         return ret_ref;
5714 }
5715
5716 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5717 CHECK(owner->result_ok);
5718         return *owner->contents.result;
5719 }
5720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5721         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5722         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5723 }
5724
5725 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5726 CHECK(!owner->result_ok);
5727         return PaymentSendFailure_clone(&*owner->contents.err);
5728 }
5729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5730         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
5731         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5732         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5733         int64_t ret_ref = tag_ptr(ret_copy, true);
5734         return ret_ref;
5735 }
5736
5737 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5738         return ThirtyTwoBytes_clone(&owner->a);
5739 }
5740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5741         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5742         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5743         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5744         return ret_arr;
5745 }
5746
5747 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5748         return ThirtyTwoBytes_clone(&owner->b);
5749 }
5750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5751         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
5752         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5753         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5754         return ret_arr;
5755 }
5756
5757 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5758 CHECK(owner->result_ok);
5759         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5760 }
5761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5762         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5763         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5764         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5765         return tag_ptr(ret_conv, true);
5766 }
5767
5768 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5769 CHECK(!owner->result_ok);
5770         return PaymentSendFailure_clone(&*owner->contents.err);
5771 }
5772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5773         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
5774         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5775         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5776         int64_t ret_ref = tag_ptr(ret_copy, true);
5777         return ret_ref;
5778 }
5779
5780 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
5781         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
5782         for (size_t i = 0; i < ret.datalen; i++) {
5783                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5784         }
5785         return ret;
5786 }
5787 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5788         return ThirtyTwoBytes_clone(&owner->a);
5789 }
5790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5791         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5792         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5793         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5794         return ret_arr;
5795 }
5796
5797 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5798         return ThirtyTwoBytes_clone(&owner->b);
5799 }
5800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5801         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
5802         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5803         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5804         return ret_arr;
5805 }
5806
5807 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5808 CHECK(owner->result_ok);
5809         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5810 }
5811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5812         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5813         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5814         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5815         return tag_ptr(ret_conv, true);
5816 }
5817
5818 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5819 CHECK(!owner->result_ok);
5820         return *owner->contents.err;
5821 }
5822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5823         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
5824         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5825 }
5826
5827 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5828 CHECK(owner->result_ok);
5829         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5830 }
5831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5832         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5833         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5834         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5835         return tag_ptr(ret_conv, true);
5836 }
5837
5838 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5839 CHECK(!owner->result_ok);
5840         return APIError_clone(&*owner->contents.err);
5841 }
5842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5843         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
5844         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5845         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5846         int64_t ret_ref = tag_ptr(ret_copy, true);
5847         return ret_ref;
5848 }
5849
5850 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5851 CHECK(owner->result_ok);
5852         return ThirtyTwoBytes_clone(&*owner->contents.result);
5853 }
5854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5855         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5856         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5857         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5858         return ret_arr;
5859 }
5860
5861 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5862 CHECK(!owner->result_ok);
5863         return *owner->contents.err;
5864 }
5865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5866         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
5867         CResult_PaymentSecretNoneZ_get_err(owner_conv);
5868 }
5869
5870 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5871 CHECK(owner->result_ok);
5872         return ThirtyTwoBytes_clone(&*owner->contents.result);
5873 }
5874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5875         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5876         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5878         return ret_arr;
5879 }
5880
5881 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5882 CHECK(!owner->result_ok);
5883         return APIError_clone(&*owner->contents.err);
5884 }
5885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5886         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
5887         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5888         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5889         int64_t ret_ref = tag_ptr(ret_copy, true);
5890         return ret_ref;
5891 }
5892
5893 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5894 CHECK(owner->result_ok);
5895         return ThirtyTwoBytes_clone(&*owner->contents.result);
5896 }
5897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5898         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5899         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5900         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
5901         return ret_arr;
5902 }
5903
5904 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5905 CHECK(!owner->result_ok);
5906         return APIError_clone(&*owner->contents.err);
5907 }
5908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5909         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
5910         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5911         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5912         int64_t ret_ref = tag_ptr(ret_copy, true);
5913         return ret_ref;
5914 }
5915
5916 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5917         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
5918         ret.is_owned = false;
5919         return ret;
5920 }
5921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5922         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5923         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5924         int64_t ret_ref = 0;
5925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5927         return ret_ref;
5928 }
5929
5930 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5931         LDKDecodeError ret = *owner->contents.err;
5932         ret.is_owned = false;
5933         return ret;
5934 }
5935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5936         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5937         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5938         int64_t ret_ref = 0;
5939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5941         return ret_ref;
5942 }
5943
5944 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5945         LDKChannelCounterparty ret = *owner->contents.result;
5946         ret.is_owned = false;
5947         return ret;
5948 }
5949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5950         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5951         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5952         int64_t ret_ref = 0;
5953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5955         return ret_ref;
5956 }
5957
5958 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5959         LDKDecodeError ret = *owner->contents.err;
5960         ret.is_owned = false;
5961         return ret;
5962 }
5963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5964         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5965         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5966         int64_t ret_ref = 0;
5967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5969         return ret_ref;
5970 }
5971
5972 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5973         LDKChannelDetails ret = *owner->contents.result;
5974         ret.is_owned = false;
5975         return ret;
5976 }
5977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5978         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5979         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5980         int64_t ret_ref = 0;
5981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5983         return ret_ref;
5984 }
5985
5986 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5987         LDKDecodeError ret = *owner->contents.err;
5988         ret.is_owned = false;
5989         return ret;
5990 }
5991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5992         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5993         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5994         int64_t ret_ref = 0;
5995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5997         return ret_ref;
5998 }
5999
6000 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6001         LDKPhantomRouteHints ret = *owner->contents.result;
6002         ret.is_owned = false;
6003         return ret;
6004 }
6005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6006         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6007         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6008         int64_t ret_ref = 0;
6009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6011         return ret_ref;
6012 }
6013
6014 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6015         LDKDecodeError ret = *owner->contents.err;
6016         ret.is_owned = false;
6017         return ret;
6018 }
6019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6020         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6021         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6022         int64_t ret_ref = 0;
6023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6025         return ret_ref;
6026 }
6027
6028 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6029         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6030         for (size_t i = 0; i < ret.datalen; i++) {
6031                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6032         }
6033         return ret;
6034 }
6035 typedef struct LDKWatch_JCalls {
6036         atomic_size_t refcnt;
6037         JavaVM *vm;
6038         jweak o;
6039         jmethodID watch_channel_meth;
6040         jmethodID update_channel_meth;
6041         jmethodID release_pending_monitor_events_meth;
6042 } LDKWatch_JCalls;
6043 static void LDKWatch_JCalls_free(void* this_arg) {
6044         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6045         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6046                 JNIEnv *env;
6047                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6048                 if (get_jenv_res == JNI_EDETACHED) {
6049                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6050                 } else {
6051                         DO_ASSERT(get_jenv_res == JNI_OK);
6052                 }
6053                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6054                 if (get_jenv_res == JNI_EDETACHED) {
6055                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6056                 }
6057                 FREE(j_calls);
6058         }
6059 }
6060 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6061         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6062         JNIEnv *env;
6063         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6064         if (get_jenv_res == JNI_EDETACHED) {
6065                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6066         } else {
6067                 DO_ASSERT(get_jenv_res == JNI_OK);
6068         }
6069         LDKOutPoint funding_txo_var = funding_txo;
6070         int64_t funding_txo_ref = 0;
6071         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6072         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6073         LDKChannelMonitor monitor_var = monitor;
6074         int64_t monitor_ref = 0;
6075         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6076         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6077         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6078         CHECK(obj != NULL);
6079         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
6080         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6081                 (*env)->ExceptionDescribe(env);
6082                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
6083         }
6084         void* ret_ptr = untag_ptr(ret);
6085         CHECK_ACCESS(ret_ptr);
6086         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6087         FREE(untag_ptr(ret));
6088         if (get_jenv_res == JNI_EDETACHED) {
6089                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6090         }
6091         return ret_conv;
6092 }
6093 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
6094         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6095         JNIEnv *env;
6096         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6097         if (get_jenv_res == JNI_EDETACHED) {
6098                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6099         } else {
6100                 DO_ASSERT(get_jenv_res == JNI_OK);
6101         }
6102         LDKOutPoint funding_txo_var = funding_txo;
6103         int64_t funding_txo_ref = 0;
6104         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6105         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6106         LDKChannelMonitorUpdate update_var = update;
6107         int64_t update_ref = 0;
6108         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6109         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6110         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6111         CHECK(obj != NULL);
6112         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
6113         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6114                 (*env)->ExceptionDescribe(env);
6115                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
6116         }
6117         void* ret_ptr = untag_ptr(ret);
6118         CHECK_ACCESS(ret_ptr);
6119         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
6120         FREE(untag_ptr(ret));
6121         if (get_jenv_res == JNI_EDETACHED) {
6122                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6123         }
6124         return ret_conv;
6125 }
6126 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6127         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6128         JNIEnv *env;
6129         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6130         if (get_jenv_res == JNI_EDETACHED) {
6131                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6132         } else {
6133                 DO_ASSERT(get_jenv_res == JNI_OK);
6134         }
6135         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6136         CHECK(obj != NULL);
6137         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
6138         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6139                 (*env)->ExceptionDescribe(env);
6140                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
6141         }
6142         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6143         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6144         if (ret_constr.datalen > 0)
6145                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6146         else
6147                 ret_constr.data = NULL;
6148         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6149         for (size_t x = 0; x < ret_constr.datalen; x++) {
6150                 int64_t ret_conv_49 = ret_vals[x];
6151                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6152                 CHECK_ACCESS(ret_conv_49_ptr);
6153                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6154                 FREE(untag_ptr(ret_conv_49));
6155                 ret_constr.data[x] = ret_conv_49_conv;
6156         }
6157         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6158         if (get_jenv_res == JNI_EDETACHED) {
6159                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6160         }
6161         return ret_constr;
6162 }
6163 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6164         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6165         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6166 }
6167 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
6168         jclass c = (*env)->GetObjectClass(env, o);
6169         CHECK(c != NULL);
6170         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6171         atomic_init(&calls->refcnt, 1);
6172         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6173         calls->o = (*env)->NewWeakGlobalRef(env, o);
6174         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
6175         CHECK(calls->watch_channel_meth != NULL);
6176         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
6177         CHECK(calls->update_channel_meth != NULL);
6178         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
6179         CHECK(calls->release_pending_monitor_events_meth != NULL);
6180
6181         LDKWatch ret = {
6182                 .this_arg = (void*) calls,
6183                 .watch_channel = watch_channel_LDKWatch_jcall,
6184                 .update_channel = update_channel_LDKWatch_jcall,
6185                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6186                 .free = LDKWatch_JCalls_free,
6187         };
6188         return ret;
6189 }
6190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
6191         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6192         *res_ptr = LDKWatch_init(env, clz, o);
6193         return tag_ptr(res_ptr, true);
6194 }
6195 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) {
6196         void* this_arg_ptr = untag_ptr(this_arg);
6197         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6198         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6199         LDKOutPoint funding_txo_conv;
6200         funding_txo_conv.inner = untag_ptr(funding_txo);
6201         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6202         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6203         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6204         LDKChannelMonitor monitor_conv;
6205         monitor_conv.inner = untag_ptr(monitor);
6206         monitor_conv.is_owned = ptr_is_owned(monitor);
6207         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6208         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6209         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6210         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6211         return tag_ptr(ret_conv, true);
6212 }
6213
6214 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) {
6215         void* this_arg_ptr = untag_ptr(this_arg);
6216         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6217         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6218         LDKOutPoint funding_txo_conv;
6219         funding_txo_conv.inner = untag_ptr(funding_txo);
6220         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6221         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6222         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6223         LDKChannelMonitorUpdate update_conv;
6224         update_conv.inner = untag_ptr(update);
6225         update_conv.is_owned = ptr_is_owned(update);
6226         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6227         update_conv = ChannelMonitorUpdate_clone(&update_conv);
6228         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6229         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
6230         return tag_ptr(ret_conv, true);
6231 }
6232
6233 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6234         void* this_arg_ptr = untag_ptr(this_arg);
6235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6236         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6237         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6238         int64_tArray ret_arr = NULL;
6239         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6240         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6241         for (size_t x = 0; x < ret_var.datalen; x++) {
6242                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6243                 *ret_conv_49_conv = ret_var.data[x];
6244                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6245         }
6246         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6247         FREE(ret_var.data);
6248         return ret_arr;
6249 }
6250
6251 typedef struct LDKBroadcasterInterface_JCalls {
6252         atomic_size_t refcnt;
6253         JavaVM *vm;
6254         jweak o;
6255         jmethodID broadcast_transaction_meth;
6256 } LDKBroadcasterInterface_JCalls;
6257 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6258         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6259         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6260                 JNIEnv *env;
6261                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6262                 if (get_jenv_res == JNI_EDETACHED) {
6263                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6264                 } else {
6265                         DO_ASSERT(get_jenv_res == JNI_OK);
6266                 }
6267                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6268                 if (get_jenv_res == JNI_EDETACHED) {
6269                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6270                 }
6271                 FREE(j_calls);
6272         }
6273 }
6274 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
6275         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6276         JNIEnv *env;
6277         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6278         if (get_jenv_res == JNI_EDETACHED) {
6279                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6280         } else {
6281                 DO_ASSERT(get_jenv_res == JNI_OK);
6282         }
6283         LDKTransaction tx_var = tx;
6284         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
6285         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
6286         Transaction_free(tx_var);
6287         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6288         CHECK(obj != NULL);
6289         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
6290         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6291                 (*env)->ExceptionDescribe(env);
6292                 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
6293         }
6294         if (get_jenv_res == JNI_EDETACHED) {
6295                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6296         }
6297 }
6298 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6299         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6300         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6301 }
6302 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
6303         jclass c = (*env)->GetObjectClass(env, o);
6304         CHECK(c != NULL);
6305         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6306         atomic_init(&calls->refcnt, 1);
6307         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6308         calls->o = (*env)->NewWeakGlobalRef(env, o);
6309         calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
6310         CHECK(calls->broadcast_transaction_meth != NULL);
6311
6312         LDKBroadcasterInterface ret = {
6313                 .this_arg = (void*) calls,
6314                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
6315                 .free = LDKBroadcasterInterface_JCalls_free,
6316         };
6317         return ret;
6318 }
6319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6320         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6321         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
6322         return tag_ptr(res_ptr, true);
6323 }
6324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
6325         void* this_arg_ptr = untag_ptr(this_arg);
6326         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6327         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6328         LDKTransaction tx_ref;
6329         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
6330         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
6331         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
6332         tx_ref.data_is_owned = true;
6333         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
6334 }
6335
6336 typedef struct LDKKeysInterface_JCalls {
6337         atomic_size_t refcnt;
6338         JavaVM *vm;
6339         jweak o;
6340         jmethodID get_node_secret_meth;
6341         jmethodID get_destination_script_meth;
6342         jmethodID get_shutdown_scriptpubkey_meth;
6343         jmethodID get_channel_signer_meth;
6344         jmethodID get_secure_random_bytes_meth;
6345         jmethodID read_chan_signer_meth;
6346         jmethodID sign_invoice_meth;
6347         jmethodID get_inbound_payment_key_material_meth;
6348 } LDKKeysInterface_JCalls;
6349 static void LDKKeysInterface_JCalls_free(void* this_arg) {
6350         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6351         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6352                 JNIEnv *env;
6353                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6354                 if (get_jenv_res == JNI_EDETACHED) {
6355                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6356                 } else {
6357                         DO_ASSERT(get_jenv_res == JNI_OK);
6358                 }
6359                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6360                 if (get_jenv_res == JNI_EDETACHED) {
6361                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6362                 }
6363                 FREE(j_calls);
6364         }
6365 }
6366 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
6367         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6368         JNIEnv *env;
6369         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6370         if (get_jenv_res == JNI_EDETACHED) {
6371                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6372         } else {
6373                 DO_ASSERT(get_jenv_res == JNI_OK);
6374         }
6375         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
6376         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6377         CHECK(obj != NULL);
6378         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
6379         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6380                 (*env)->ExceptionDescribe(env);
6381                 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
6382         }
6383         void* ret_ptr = untag_ptr(ret);
6384         CHECK_ACCESS(ret_ptr);
6385         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
6386         FREE(untag_ptr(ret));
6387         if (get_jenv_res == JNI_EDETACHED) {
6388                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6389         }
6390         return ret_conv;
6391 }
6392 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
6393         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6394         JNIEnv *env;
6395         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6396         if (get_jenv_res == JNI_EDETACHED) {
6397                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6398         } else {
6399                 DO_ASSERT(get_jenv_res == JNI_OK);
6400         }
6401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6402         CHECK(obj != NULL);
6403         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
6404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6405                 (*env)->ExceptionDescribe(env);
6406                 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
6407         }
6408         LDKCVec_u8Z ret_ref;
6409         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6410         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6411         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6412         if (get_jenv_res == JNI_EDETACHED) {
6413                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6414         }
6415         return ret_ref;
6416 }
6417 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
6418         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6419         JNIEnv *env;
6420         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6421         if (get_jenv_res == JNI_EDETACHED) {
6422                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6423         } else {
6424                 DO_ASSERT(get_jenv_res == JNI_OK);
6425         }
6426         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6427         CHECK(obj != NULL);
6428         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
6429         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6430                 (*env)->ExceptionDescribe(env);
6431                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
6432         }
6433         LDKShutdownScript ret_conv;
6434         ret_conv.inner = untag_ptr(ret);
6435         ret_conv.is_owned = ptr_is_owned(ret);
6436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
6437         if (get_jenv_res == JNI_EDETACHED) {
6438                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6439         }
6440         return ret_conv;
6441 }
6442 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
6443         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6444         JNIEnv *env;
6445         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6446         if (get_jenv_res == JNI_EDETACHED) {
6447                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6448         } else {
6449                 DO_ASSERT(get_jenv_res == JNI_OK);
6450         }
6451         jboolean inbound_conv = inbound;
6452         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6453         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6454         CHECK(obj != NULL);
6455         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
6456         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6457                 (*env)->ExceptionDescribe(env);
6458                 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
6459         }
6460         void* ret_ptr = untag_ptr(ret);
6461         CHECK_ACCESS(ret_ptr);
6462         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
6463         FREE(untag_ptr(ret));
6464         if (get_jenv_res == JNI_EDETACHED) {
6465                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6466         }
6467         return ret_conv;
6468 }
6469 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
6470         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6471         JNIEnv *env;
6472         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6473         if (get_jenv_res == JNI_EDETACHED) {
6474                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6475         } else {
6476                 DO_ASSERT(get_jenv_res == JNI_OK);
6477         }
6478         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6479         CHECK(obj != NULL);
6480         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
6481         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6482                 (*env)->ExceptionDescribe(env);
6483                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
6484         }
6485         LDKThirtyTwoBytes ret_ref;
6486         CHECK((*env)->GetArrayLength(env, ret) == 32);
6487         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6488         if (get_jenv_res == JNI_EDETACHED) {
6489                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6490         }
6491         return ret_ref;
6492 }
6493 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
6494         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6495         JNIEnv *env;
6496         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6497         if (get_jenv_res == JNI_EDETACHED) {
6498                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6499         } else {
6500                 DO_ASSERT(get_jenv_res == JNI_OK);
6501         }
6502         LDKu8slice reader_var = reader;
6503         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
6504         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
6505         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6506         CHECK(obj != NULL);
6507         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
6508         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6509                 (*env)->ExceptionDescribe(env);
6510                 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
6511         }
6512         void* ret_ptr = untag_ptr(ret);
6513         CHECK_ACCESS(ret_ptr);
6514         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6515         FREE(untag_ptr(ret));
6516         if (get_jenv_res == JNI_EDETACHED) {
6517                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6518         }
6519         return ret_conv;
6520 }
6521 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6522         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6523         JNIEnv *env;
6524         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6525         if (get_jenv_res == JNI_EDETACHED) {
6526                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6527         } else {
6528                 DO_ASSERT(get_jenv_res == JNI_OK);
6529         }
6530         LDKu8slice hrp_bytes_var = hrp_bytes;
6531         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6532         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
6533         LDKCVec_u5Z invoice_data_var = invoice_data;
6534         jobjectArray invoice_data_arr = NULL;
6535         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
6536         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
6537         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6538                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6539                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6540         }
6541         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
6542         FREE(invoice_data_var.data);
6543         jclass receipient_conv = LDKRecipient_to_java(env, receipient);
6544         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6545         CHECK(obj != NULL);
6546         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
6547         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6548                 (*env)->ExceptionDescribe(env);
6549                 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
6550         }
6551         void* ret_ptr = untag_ptr(ret);
6552         CHECK_ACCESS(ret_ptr);
6553         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6554         FREE(untag_ptr(ret));
6555         if (get_jenv_res == JNI_EDETACHED) {
6556                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6557         }
6558         return ret_conv;
6559 }
6560 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6561         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6562         JNIEnv *env;
6563         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6564         if (get_jenv_res == JNI_EDETACHED) {
6565                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6566         } else {
6567                 DO_ASSERT(get_jenv_res == JNI_OK);
6568         }
6569         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6570         CHECK(obj != NULL);
6571         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
6572         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6573                 (*env)->ExceptionDescribe(env);
6574                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
6575         }
6576         LDKThirtyTwoBytes ret_ref;
6577         CHECK((*env)->GetArrayLength(env, ret) == 32);
6578         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6579         if (get_jenv_res == JNI_EDETACHED) {
6580                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6581         }
6582         return ret_ref;
6583 }
6584 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6585         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6586         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6587 }
6588 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6589         jclass c = (*env)->GetObjectClass(env, o);
6590         CHECK(c != NULL);
6591         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6592         atomic_init(&calls->refcnt, 1);
6593         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6594         calls->o = (*env)->NewWeakGlobalRef(env, o);
6595         calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6596         CHECK(calls->get_node_secret_meth != NULL);
6597         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6598         CHECK(calls->get_destination_script_meth != NULL);
6599         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6600         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6601         calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6602         CHECK(calls->get_channel_signer_meth != NULL);
6603         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6604         CHECK(calls->get_secure_random_bytes_meth != NULL);
6605         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6606         CHECK(calls->read_chan_signer_meth != NULL);
6607         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6608         CHECK(calls->sign_invoice_meth != NULL);
6609         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6610         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6611
6612         LDKKeysInterface ret = {
6613                 .this_arg = (void*) calls,
6614                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6615                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6616                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6617                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6618                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6619                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6620                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6621                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6622                 .free = LDKKeysInterface_JCalls_free,
6623         };
6624         return ret;
6625 }
6626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6627         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6628         *res_ptr = LDKKeysInterface_init(env, clz, o);
6629         return tag_ptr(res_ptr, true);
6630 }
6631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6632         void* this_arg_ptr = untag_ptr(this_arg);
6633         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6634         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6635         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6636         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6637         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6638         return tag_ptr(ret_conv, true);
6639 }
6640
6641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6642         void* this_arg_ptr = untag_ptr(this_arg);
6643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6644         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6645         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6646         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6647         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6648         CVec_u8Z_free(ret_var);
6649         return ret_arr;
6650 }
6651
6652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6653         void* this_arg_ptr = untag_ptr(this_arg);
6654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6655         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6656         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6657         int64_t ret_ref = 0;
6658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6660         return ret_ref;
6661 }
6662
6663 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) {
6664         void* this_arg_ptr = untag_ptr(this_arg);
6665         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6666         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6667         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6668         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6669         return tag_ptr(ret_ret, true);
6670 }
6671
6672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6673         void* this_arg_ptr = untag_ptr(this_arg);
6674         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6675         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6676         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6677         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6678         return ret_arr;
6679 }
6680
6681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6682         void* this_arg_ptr = untag_ptr(this_arg);
6683         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6684         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6685         LDKu8slice reader_ref;
6686         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6687         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6688         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6689         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6690         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6691         return tag_ptr(ret_conv, true);
6692 }
6693
6694 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) {
6695         void* this_arg_ptr = untag_ptr(this_arg);
6696         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6697         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6698         LDKu8slice hrp_bytes_ref;
6699         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6700         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6701         LDKCVec_u5Z invoice_data_constr;
6702         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6703         if (invoice_data_constr.datalen > 0)
6704                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6705         else
6706                 invoice_data_constr.data = NULL;
6707         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6708         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6709                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6710                 
6711                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6712         }
6713         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6714         LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6715         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6716         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6717         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6718         return tag_ptr(ret_conv, true);
6719 }
6720
6721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6722         void* this_arg_ptr = untag_ptr(this_arg);
6723         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6724         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6725         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6726         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6727         return ret_arr;
6728 }
6729
6730 typedef struct LDKFeeEstimator_JCalls {
6731         atomic_size_t refcnt;
6732         JavaVM *vm;
6733         jweak o;
6734         jmethodID get_est_sat_per_1000_weight_meth;
6735 } LDKFeeEstimator_JCalls;
6736 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6737         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6738         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6739                 JNIEnv *env;
6740                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6741                 if (get_jenv_res == JNI_EDETACHED) {
6742                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6743                 } else {
6744                         DO_ASSERT(get_jenv_res == JNI_OK);
6745                 }
6746                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6747                 if (get_jenv_res == JNI_EDETACHED) {
6748                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6749                 }
6750                 FREE(j_calls);
6751         }
6752 }
6753 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6754         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6755         JNIEnv *env;
6756         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6757         if (get_jenv_res == JNI_EDETACHED) {
6758                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6759         } else {
6760                 DO_ASSERT(get_jenv_res == JNI_OK);
6761         }
6762         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6763         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6764         CHECK(obj != NULL);
6765         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6766         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6767                 (*env)->ExceptionDescribe(env);
6768                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6769         }
6770         if (get_jenv_res == JNI_EDETACHED) {
6771                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6772         }
6773         return ret;
6774 }
6775 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6776         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6777         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6778 }
6779 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6780         jclass c = (*env)->GetObjectClass(env, o);
6781         CHECK(c != NULL);
6782         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6783         atomic_init(&calls->refcnt, 1);
6784         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6785         calls->o = (*env)->NewWeakGlobalRef(env, o);
6786         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6787         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6788
6789         LDKFeeEstimator ret = {
6790                 .this_arg = (void*) calls,
6791                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6792                 .free = LDKFeeEstimator_JCalls_free,
6793         };
6794         return ret;
6795 }
6796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6797         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6798         *res_ptr = LDKFeeEstimator_init(env, clz, o);
6799         return tag_ptr(res_ptr, true);
6800 }
6801 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) {
6802         void* this_arg_ptr = untag_ptr(this_arg);
6803         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6804         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6805         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6806         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6807         return ret_conv;
6808 }
6809
6810 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6811         return ThirtyTwoBytes_clone(&owner->a);
6812 }
6813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6814         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6815         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6816         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6817         return ret_arr;
6818 }
6819
6820 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6821         LDKChannelManager ret = owner->b;
6822         ret.is_owned = false;
6823         return ret;
6824 }
6825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6826         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
6827         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6828         int64_t ret_ref = 0;
6829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6831         return ret_ref;
6832 }
6833
6834 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6835 CHECK(owner->result_ok);
6836         return &*owner->contents.result;
6837 }
6838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6839         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6840         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
6841         return ret_ret;
6842 }
6843
6844 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6845         LDKDecodeError ret = *owner->contents.err;
6846         ret.is_owned = false;
6847         return ret;
6848 }
6849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6850         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
6851         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6852         int64_t ret_ref = 0;
6853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6855         return ret_ref;
6856 }
6857
6858 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6859         LDKChannelConfig ret = *owner->contents.result;
6860         ret.is_owned = false;
6861         return ret;
6862 }
6863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6864         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6865         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6866         int64_t ret_ref = 0;
6867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6869         return ret_ref;
6870 }
6871
6872 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6873         LDKDecodeError ret = *owner->contents.err;
6874         ret.is_owned = false;
6875         return ret;
6876 }
6877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6878         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
6879         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6880         int64_t ret_ref = 0;
6881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6883         return ret_ref;
6884 }
6885
6886 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6887         LDKOutPoint ret = *owner->contents.result;
6888         ret.is_owned = false;
6889         return ret;
6890 }
6891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6892         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6893         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6894         int64_t ret_ref = 0;
6895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6897         return ret_ref;
6898 }
6899
6900 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6901         LDKDecodeError ret = *owner->contents.err;
6902         ret.is_owned = false;
6903         return ret;
6904 }
6905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6906         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
6907         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6908         int64_t ret_ref = 0;
6909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6911         return ret_ref;
6912 }
6913
6914 typedef struct LDKType_JCalls {
6915         atomic_size_t refcnt;
6916         JavaVM *vm;
6917         jweak o;
6918         jmethodID type_id_meth;
6919         jmethodID debug_str_meth;
6920         jmethodID write_meth;
6921 } LDKType_JCalls;
6922 static void LDKType_JCalls_free(void* this_arg) {
6923         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6924         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6925                 JNIEnv *env;
6926                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6927                 if (get_jenv_res == JNI_EDETACHED) {
6928                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6929                 } else {
6930                         DO_ASSERT(get_jenv_res == JNI_OK);
6931                 }
6932                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6933                 if (get_jenv_res == JNI_EDETACHED) {
6934                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6935                 }
6936                 FREE(j_calls);
6937         }
6938 }
6939 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6940         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6941         JNIEnv *env;
6942         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6943         if (get_jenv_res == JNI_EDETACHED) {
6944                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6945         } else {
6946                 DO_ASSERT(get_jenv_res == JNI_OK);
6947         }
6948         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6949         CHECK(obj != NULL);
6950         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
6951         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6952                 (*env)->ExceptionDescribe(env);
6953                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
6954         }
6955         if (get_jenv_res == JNI_EDETACHED) {
6956                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6957         }
6958         return ret;
6959 }
6960 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6961         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6962         JNIEnv *env;
6963         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6964         if (get_jenv_res == JNI_EDETACHED) {
6965                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6966         } else {
6967                 DO_ASSERT(get_jenv_res == JNI_OK);
6968         }
6969         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6970         CHECK(obj != NULL);
6971         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
6972         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6973                 (*env)->ExceptionDescribe(env);
6974                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
6975         }
6976         LDKStr ret_conv = java_to_owned_str(env, ret);
6977         if (get_jenv_res == JNI_EDETACHED) {
6978                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6979         }
6980         return ret_conv;
6981 }
6982 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6983         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6984         JNIEnv *env;
6985         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6986         if (get_jenv_res == JNI_EDETACHED) {
6987                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6988         } else {
6989                 DO_ASSERT(get_jenv_res == JNI_OK);
6990         }
6991         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6992         CHECK(obj != NULL);
6993         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6994         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6995                 (*env)->ExceptionDescribe(env);
6996                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
6997         }
6998         LDKCVec_u8Z ret_ref;
6999         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
7000         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7001         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
7002         if (get_jenv_res == JNI_EDETACHED) {
7003                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7004         }
7005         return ret_ref;
7006 }
7007 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7008         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7009         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7010 }
7011 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
7012         jclass c = (*env)->GetObjectClass(env, o);
7013         CHECK(c != NULL);
7014         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7015         atomic_init(&calls->refcnt, 1);
7016         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7017         calls->o = (*env)->NewWeakGlobalRef(env, o);
7018         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
7019         CHECK(calls->type_id_meth != NULL);
7020         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
7021         CHECK(calls->debug_str_meth != NULL);
7022         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
7023         CHECK(calls->write_meth != NULL);
7024
7025         LDKType ret = {
7026                 .this_arg = (void*) calls,
7027                 .type_id = type_id_LDKType_jcall,
7028                 .debug_str = debug_str_LDKType_jcall,
7029                 .write = write_LDKType_jcall,
7030                 .cloned = LDKType_JCalls_cloned,
7031                 .free = LDKType_JCalls_free,
7032         };
7033         return ret;
7034 }
7035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
7036         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7037         *res_ptr = LDKType_init(env, clz, o);
7038         return tag_ptr(res_ptr, true);
7039 }
7040 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
7041         void* this_arg_ptr = untag_ptr(this_arg);
7042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7043         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7044         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7045         return ret_conv;
7046 }
7047
7048 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
7049         void* this_arg_ptr = untag_ptr(this_arg);
7050         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7051         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7052         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7053         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7054         Str_free(ret_str);
7055         return ret_conv;
7056 }
7057
7058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
7059         void* this_arg_ptr = untag_ptr(this_arg);
7060         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7061         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7062         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7063         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7064         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7065         CVec_u8Z_free(ret_var);
7066         return ret_arr;
7067 }
7068
7069 static jclass LDKCOption_TypeZ_Some_class = NULL;
7070 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
7071 static jclass LDKCOption_TypeZ_None_class = NULL;
7072 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
7073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
7074         LDKCOption_TypeZ_Some_class =
7075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
7076         CHECK(LDKCOption_TypeZ_Some_class != NULL);
7077         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
7078         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
7079         LDKCOption_TypeZ_None_class =
7080                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
7081         CHECK(LDKCOption_TypeZ_None_class != NULL);
7082         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
7083         CHECK(LDKCOption_TypeZ_None_meth != NULL);
7084 }
7085 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7086         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7087         switch(obj->tag) {
7088                 case LDKCOption_TypeZ_Some: {
7089                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7090                         *some_ret = Type_clone(&obj->some);
7091                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
7092                 }
7093                 case LDKCOption_TypeZ_None: {
7094                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
7095                 }
7096                 default: abort();
7097         }
7098 }
7099 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7100 CHECK(owner->result_ok);
7101         return COption_TypeZ_clone(&*owner->contents.result);
7102 }
7103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7104         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7105         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7106         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7107         int64_t ret_ref = tag_ptr(ret_copy, true);
7108         return ret_ref;
7109 }
7110
7111 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7112         LDKDecodeError ret = *owner->contents.err;
7113         ret.is_owned = false;
7114         return ret;
7115 }
7116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7117         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7118         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7119         int64_t ret_ref = 0;
7120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7122         return ret_ref;
7123 }
7124
7125 static jclass LDKPaymentError_Invoice_class = NULL;
7126 static jmethodID LDKPaymentError_Invoice_meth = NULL;
7127 static jclass LDKPaymentError_Routing_class = NULL;
7128 static jmethodID LDKPaymentError_Routing_meth = NULL;
7129 static jclass LDKPaymentError_Sending_class = NULL;
7130 static jmethodID LDKPaymentError_Sending_meth = NULL;
7131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
7132         LDKPaymentError_Invoice_class =
7133                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
7134         CHECK(LDKPaymentError_Invoice_class != NULL);
7135         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
7136         CHECK(LDKPaymentError_Invoice_meth != NULL);
7137         LDKPaymentError_Routing_class =
7138                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
7139         CHECK(LDKPaymentError_Routing_class != NULL);
7140         LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
7141         CHECK(LDKPaymentError_Routing_meth != NULL);
7142         LDKPaymentError_Sending_class =
7143                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
7144         CHECK(LDKPaymentError_Sending_class != NULL);
7145         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
7146         CHECK(LDKPaymentError_Sending_meth != NULL);
7147 }
7148 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7149         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7150         switch(obj->tag) {
7151                 case LDKPaymentError_Invoice: {
7152                         LDKStr invoice_str = obj->invoice;
7153                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
7154                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
7155                 }
7156                 case LDKPaymentError_Routing: {
7157                         LDKLightningError routing_var = obj->routing;
7158                         int64_t routing_ref = 0;
7159                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
7160                         routing_ref = tag_ptr(routing_var.inner, false);
7161                         return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
7162                 }
7163                 case LDKPaymentError_Sending: {
7164                         int64_t sending_ref = tag_ptr(&obj->sending, false);
7165                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
7166                 }
7167                 default: abort();
7168         }
7169 }
7170 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7171 CHECK(owner->result_ok);
7172         return ThirtyTwoBytes_clone(&*owner->contents.result);
7173 }
7174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7175         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7176         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7177         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
7178         return ret_arr;
7179 }
7180
7181 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7182 CHECK(!owner->result_ok);
7183         return PaymentError_clone(&*owner->contents.err);
7184 }
7185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7186         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7187         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7188         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7189         int64_t ret_ref = tag_ptr(ret_copy, true);
7190         return ret_ref;
7191 }
7192
7193 static jclass LDKParseError_Bech32Error_class = NULL;
7194 static jmethodID LDKParseError_Bech32Error_meth = NULL;
7195 static jclass LDKParseError_ParseAmountError_class = NULL;
7196 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
7197 static jclass LDKParseError_MalformedSignature_class = NULL;
7198 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
7199 static jclass LDKParseError_BadPrefix_class = NULL;
7200 static jmethodID LDKParseError_BadPrefix_meth = NULL;
7201 static jclass LDKParseError_UnknownCurrency_class = NULL;
7202 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
7203 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
7204 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
7205 static jclass LDKParseError_MalformedHRP_class = NULL;
7206 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
7207 static jclass LDKParseError_TooShortDataPart_class = NULL;
7208 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
7209 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
7210 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
7211 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
7212 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
7213 static jclass LDKParseError_PaddingError_class = NULL;
7214 static jmethodID LDKParseError_PaddingError_meth = NULL;
7215 static jclass LDKParseError_IntegerOverflowError_class = NULL;
7216 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
7217 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
7218 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
7219 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
7220 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
7221 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
7222 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
7223 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
7224 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
7225 static jclass LDKParseError_InvalidSliceLength_class = NULL;
7226 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
7227 static jclass LDKParseError_Skip_class = NULL;
7228 static jmethodID LDKParseError_Skip_meth = NULL;
7229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
7230         LDKParseError_Bech32Error_class =
7231                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
7232         CHECK(LDKParseError_Bech32Error_class != NULL);
7233         LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
7234         CHECK(LDKParseError_Bech32Error_meth != NULL);
7235         LDKParseError_ParseAmountError_class =
7236                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
7237         CHECK(LDKParseError_ParseAmountError_class != NULL);
7238         LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
7239         CHECK(LDKParseError_ParseAmountError_meth != NULL);
7240         LDKParseError_MalformedSignature_class =
7241                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
7242         CHECK(LDKParseError_MalformedSignature_class != NULL);
7243         LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
7244         CHECK(LDKParseError_MalformedSignature_meth != NULL);
7245         LDKParseError_BadPrefix_class =
7246                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
7247         CHECK(LDKParseError_BadPrefix_class != NULL);
7248         LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
7249         CHECK(LDKParseError_BadPrefix_meth != NULL);
7250         LDKParseError_UnknownCurrency_class =
7251                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
7252         CHECK(LDKParseError_UnknownCurrency_class != NULL);
7253         LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
7254         CHECK(LDKParseError_UnknownCurrency_meth != NULL);
7255         LDKParseError_UnknownSiPrefix_class =
7256                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
7257         CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
7258         LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
7259         CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
7260         LDKParseError_MalformedHRP_class =
7261                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
7262         CHECK(LDKParseError_MalformedHRP_class != NULL);
7263         LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
7264         CHECK(LDKParseError_MalformedHRP_meth != NULL);
7265         LDKParseError_TooShortDataPart_class =
7266                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
7267         CHECK(LDKParseError_TooShortDataPart_class != NULL);
7268         LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
7269         CHECK(LDKParseError_TooShortDataPart_meth != NULL);
7270         LDKParseError_UnexpectedEndOfTaggedFields_class =
7271                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
7272         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
7273         LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
7274         CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
7275         LDKParseError_DescriptionDecodeError_class =
7276                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
7277         CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
7278         LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
7279         CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
7280         LDKParseError_PaddingError_class =
7281                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
7282         CHECK(LDKParseError_PaddingError_class != NULL);
7283         LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
7284         CHECK(LDKParseError_PaddingError_meth != NULL);
7285         LDKParseError_IntegerOverflowError_class =
7286                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
7287         CHECK(LDKParseError_IntegerOverflowError_class != NULL);
7288         LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
7289         CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
7290         LDKParseError_InvalidSegWitProgramLength_class =
7291                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
7292         CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
7293         LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
7294         CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
7295         LDKParseError_InvalidPubKeyHashLength_class =
7296                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
7297         CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
7298         LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
7299         CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
7300         LDKParseError_InvalidScriptHashLength_class =
7301                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
7302         CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
7303         LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
7304         CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
7305         LDKParseError_InvalidRecoveryId_class =
7306                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
7307         CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
7308         LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
7309         CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
7310         LDKParseError_InvalidSliceLength_class =
7311                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
7312         CHECK(LDKParseError_InvalidSliceLength_class != NULL);
7313         LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
7314         CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
7315         LDKParseError_Skip_class =
7316                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
7317         CHECK(LDKParseError_Skip_class != NULL);
7318         LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
7319         CHECK(LDKParseError_Skip_meth != NULL);
7320 }
7321 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7322         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
7323         switch(obj->tag) {
7324                 case LDKParseError_Bech32Error: {
7325                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
7326                         return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
7327                 }
7328                 case LDKParseError_ParseAmountError: {
7329                         /*obj->parse_amount_error*/
7330                         return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
7331                 }
7332                 case LDKParseError_MalformedSignature: {
7333                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
7334                         return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
7335                 }
7336                 case LDKParseError_BadPrefix: {
7337                         return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
7338                 }
7339                 case LDKParseError_UnknownCurrency: {
7340                         return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
7341                 }
7342                 case LDKParseError_UnknownSiPrefix: {
7343                         return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
7344                 }
7345                 case LDKParseError_MalformedHRP: {
7346                         return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
7347                 }
7348                 case LDKParseError_TooShortDataPart: {
7349                         return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
7350                 }
7351                 case LDKParseError_UnexpectedEndOfTaggedFields: {
7352                         return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
7353                 }
7354                 case LDKParseError_DescriptionDecodeError: {
7355                         /*obj->description_decode_error*/
7356                         return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
7357                 }
7358                 case LDKParseError_PaddingError: {
7359                         return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
7360                 }
7361                 case LDKParseError_IntegerOverflowError: {
7362                         return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
7363                 }
7364                 case LDKParseError_InvalidSegWitProgramLength: {
7365                         return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
7366                 }
7367                 case LDKParseError_InvalidPubKeyHashLength: {
7368                         return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
7369                 }
7370                 case LDKParseError_InvalidScriptHashLength: {
7371                         return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
7372                 }
7373                 case LDKParseError_InvalidRecoveryId: {
7374                         return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
7375                 }
7376                 case LDKParseError_InvalidSliceLength: {
7377                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
7378                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
7379                         return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
7380                 }
7381                 case LDKParseError_Skip: {
7382                         return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
7383                 }
7384                 default: abort();
7385         }
7386 }
7387 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7388 CHECK(owner->result_ok);
7389         return SiPrefix_clone(&*owner->contents.result);
7390 }
7391 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7392         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7393         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
7394         return ret_conv;
7395 }
7396
7397 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
7398 CHECK(!owner->result_ok);
7399         return ParseError_clone(&*owner->contents.err);
7400 }
7401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7402         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
7403         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7404         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
7405         int64_t ret_ref = tag_ptr(ret_copy, true);
7406         return ret_ref;
7407 }
7408
7409 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7410 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7411 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7412 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7414         LDKParseOrSemanticError_ParseError_class =
7415                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7416         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7417         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7418         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7419         LDKParseOrSemanticError_SemanticError_class =
7420                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7421         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7422         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7423         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7424 }
7425 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7426         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
7427         switch(obj->tag) {
7428                 case LDKParseOrSemanticError_ParseError: {
7429                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
7430                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7431                 }
7432                 case LDKParseOrSemanticError_SemanticError: {
7433                         jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7434                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7435                 }
7436                 default: abort();
7437         }
7438 }
7439 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7440         LDKInvoice ret = *owner->contents.result;
7441         ret.is_owned = false;
7442         return ret;
7443 }
7444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7445         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7446         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7447         int64_t ret_ref = 0;
7448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7450         return ret_ref;
7451 }
7452
7453 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7454 CHECK(!owner->result_ok);
7455         return ParseOrSemanticError_clone(&*owner->contents.err);
7456 }
7457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7458         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
7459         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7460         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7461         int64_t ret_ref = tag_ptr(ret_copy, true);
7462         return ret_ref;
7463 }
7464
7465 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7466         LDKSignedRawInvoice ret = *owner->contents.result;
7467         ret.is_owned = false;
7468         return ret;
7469 }
7470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7471         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7472         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7473         int64_t ret_ref = 0;
7474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7476         return ret_ref;
7477 }
7478
7479 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7480 CHECK(!owner->result_ok);
7481         return ParseError_clone(&*owner->contents.err);
7482 }
7483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7484         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
7485         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7486         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7487         int64_t ret_ref = tag_ptr(ret_copy, true);
7488         return ret_ref;
7489 }
7490
7491 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7492         LDKRawInvoice ret = owner->a;
7493         ret.is_owned = false;
7494         return ret;
7495 }
7496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7497         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7498         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7499         int64_t ret_ref = 0;
7500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7502         return ret_ref;
7503 }
7504
7505 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7506         return ThirtyTwoBytes_clone(&owner->b);
7507 }
7508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7509         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7510         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7511         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
7512         return ret_arr;
7513 }
7514
7515 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7516         LDKInvoiceSignature ret = owner->c;
7517         ret.is_owned = false;
7518         return ret;
7519 }
7520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7521         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
7522         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7523         int64_t ret_ref = 0;
7524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7526         return ret_ref;
7527 }
7528
7529 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7530         LDKPayeePubKey ret = *owner->contents.result;
7531         ret.is_owned = false;
7532         return ret;
7533 }
7534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7535         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7536         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7537         int64_t ret_ref = 0;
7538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7540         return ret_ref;
7541 }
7542
7543 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7544 CHECK(!owner->result_ok);
7545         return *owner->contents.err;
7546 }
7547 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7548         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
7549         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7550         return ret_conv;
7551 }
7552
7553 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7554         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7555         for (size_t i = 0; i < ret.datalen; i++) {
7556                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7557         }
7558         return ret;
7559 }
7560 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7561         LDKPositiveTimestamp ret = *owner->contents.result;
7562         ret.is_owned = false;
7563         return ret;
7564 }
7565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7566         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7567         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7568         int64_t ret_ref = 0;
7569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7571         return ret_ref;
7572 }
7573
7574 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7575 CHECK(!owner->result_ok);
7576         return CreationError_clone(&*owner->contents.err);
7577 }
7578 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7579         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
7580         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7581         return ret_conv;
7582 }
7583
7584 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7585 CHECK(owner->result_ok);
7586         return *owner->contents.result;
7587 }
7588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7589         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7590         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7591 }
7592
7593 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7594 CHECK(!owner->result_ok);
7595         return SemanticError_clone(&*owner->contents.err);
7596 }
7597 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7598         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
7599         jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
7600         return ret_conv;
7601 }
7602
7603 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7604         LDKInvoice ret = *owner->contents.result;
7605         ret.is_owned = false;
7606         return ret;
7607 }
7608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7609         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7610         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7611         int64_t ret_ref = 0;
7612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7614         return ret_ref;
7615 }
7616
7617 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7618 CHECK(!owner->result_ok);
7619         return SemanticError_clone(&*owner->contents.err);
7620 }
7621 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7622         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
7623         jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7624         return ret_conv;
7625 }
7626
7627 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7628         LDKDescription ret = *owner->contents.result;
7629         ret.is_owned = false;
7630         return ret;
7631 }
7632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7633         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7634         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7635         int64_t ret_ref = 0;
7636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7638         return ret_ref;
7639 }
7640
7641 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7642 CHECK(!owner->result_ok);
7643         return CreationError_clone(&*owner->contents.err);
7644 }
7645 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7646         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
7647         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7648         return ret_conv;
7649 }
7650
7651 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7652         LDKPrivateRoute ret = *owner->contents.result;
7653         ret.is_owned = false;
7654         return ret;
7655 }
7656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7657         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7658         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7659         int64_t ret_ref = 0;
7660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7662         return ret_ref;
7663 }
7664
7665 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7666 CHECK(!owner->result_ok);
7667         return CreationError_clone(&*owner->contents.err);
7668 }
7669 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7670         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
7671         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7672         return ret_conv;
7673 }
7674
7675 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7676 CHECK(owner->result_ok);
7677         return *owner->contents.result;
7678 }
7679 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7680         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7681         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7682         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7683         return ret_conv;
7684 }
7685
7686 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7687 CHECK(!owner->result_ok);
7688         return *owner->contents.err;
7689 }
7690 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7691         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7692         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
7693         return ret_conv;
7694 }
7695
7696 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7697         LDKChannelMonitorUpdate ret = *owner->contents.result;
7698         ret.is_owned = false;
7699         return ret;
7700 }
7701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7702         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7703         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7704         int64_t ret_ref = 0;
7705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7707         return ret_ref;
7708 }
7709
7710 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7711         LDKDecodeError ret = *owner->contents.err;
7712         ret.is_owned = false;
7713         return ret;
7714 }
7715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7716         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7717         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7718         int64_t ret_ref = 0;
7719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7721         return ret_ref;
7722 }
7723
7724 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
7725 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
7726 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
7727 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
7728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
7729         LDKCOption_MonitorEventZ_Some_class =
7730                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
7731         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7732         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7733         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7734         LDKCOption_MonitorEventZ_None_class =
7735                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7736         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7737         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7738         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7739 }
7740 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7741         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7742         switch(obj->tag) {
7743                 case LDKCOption_MonitorEventZ_Some: {
7744                         int64_t some_ref = tag_ptr(&obj->some, false);
7745                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7746                 }
7747                 case LDKCOption_MonitorEventZ_None: {
7748                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7749                 }
7750                 default: abort();
7751         }
7752 }
7753 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7754 CHECK(owner->result_ok);
7755         return COption_MonitorEventZ_clone(&*owner->contents.result);
7756 }
7757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7758         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7759         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7760         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7761         int64_t ret_ref = tag_ptr(ret_copy, true);
7762         return ret_ref;
7763 }
7764
7765 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7766         LDKDecodeError ret = *owner->contents.err;
7767         ret.is_owned = false;
7768         return ret;
7769 }
7770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7771         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7772         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7773         int64_t ret_ref = 0;
7774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7776         return ret_ref;
7777 }
7778
7779 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7780         LDKHTLCUpdate ret = *owner->contents.result;
7781         ret.is_owned = false;
7782         return ret;
7783 }
7784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7785         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7786         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7787         int64_t ret_ref = 0;
7788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7790         return ret_ref;
7791 }
7792
7793 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7794         LDKDecodeError ret = *owner->contents.err;
7795         ret.is_owned = false;
7796         return ret;
7797 }
7798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7799         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7800         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7801         int64_t ret_ref = 0;
7802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7804         return ret_ref;
7805 }
7806
7807 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7808         LDKOutPoint ret = owner->a;
7809         ret.is_owned = false;
7810         return ret;
7811 }
7812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7813         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7814         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7815         int64_t ret_ref = 0;
7816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7818         return ret_ref;
7819 }
7820
7821 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7822         return CVec_u8Z_clone(&owner->b);
7823 }
7824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7825         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7826         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7827         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7828         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7829         CVec_u8Z_free(ret_var);
7830         return ret_arr;
7831 }
7832
7833 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7834         return owner->a;
7835 }
7836 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7837         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7838         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
7839         return ret_conv;
7840 }
7841
7842 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7843         return CVec_u8Z_clone(&owner->b);
7844 }
7845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7846         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7847         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7848         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7849         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7850         CVec_u8Z_free(ret_var);
7851         return ret_arr;
7852 }
7853
7854 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7855         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7856         for (size_t i = 0; i < ret.datalen; i++) {
7857                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7858         }
7859         return ret;
7860 }
7861 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7862         return ThirtyTwoBytes_clone(&owner->a);
7863 }
7864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7865         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7866         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7867         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
7868         return ret_arr;
7869 }
7870
7871 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7872         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7873 }
7874 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7875         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7876         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7877         int64_tArray ret_arr = NULL;
7878         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7879         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7880         for (size_t v = 0; v < ret_var.datalen; v++) {
7881                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7882                 *ret_conv_21_conv = ret_var.data[v];
7883                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
7884         }
7885         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7886         FREE(ret_var.data);
7887         return ret_arr;
7888 }
7889
7890 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
7891         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 };
7892         for (size_t i = 0; i < ret.datalen; i++) {
7893                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
7894         }
7895         return ret;
7896 }
7897 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
7898         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
7899         for (size_t i = 0; i < ret.datalen; i++) {
7900                 ret.data[i] = Event_clone(&orig->data[i]);
7901         }
7902         return ret;
7903 }
7904 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7905         return owner->a;
7906 }
7907 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7908         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7909         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7910         return ret_conv;
7911 }
7912
7913 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7914         return TxOut_clone(&owner->b);
7915 }
7916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7917         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
7918         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7919         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7920         return tag_ptr(ret_ref, true);
7921 }
7922
7923 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7924         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7925         for (size_t i = 0; i < ret.datalen; i++) {
7926                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7927         }
7928         return ret;
7929 }
7930 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7931         return ThirtyTwoBytes_clone(&owner->a);
7932 }
7933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7934         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7935         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7936         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
7937         return ret_arr;
7938 }
7939
7940 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7941         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7942 }
7943 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7944         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
7945         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7946         int64_tArray ret_arr = NULL;
7947         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7948         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7949         for (size_t u = 0; u < ret_var.datalen; u++) {
7950                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7951                 *ret_conv_20_conv = ret_var.data[u];
7952                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
7953         }
7954         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7955         FREE(ret_var.data);
7956         return ret_arr;
7957 }
7958
7959 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
7960         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 };
7961         for (size_t i = 0; i < ret.datalen; i++) {
7962                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7963         }
7964         return ret;
7965 }
7966 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
7967 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
7968 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
7969 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
7970 static jclass LDKBalance_ContentiousClaimable_class = NULL;
7971 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
7972 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
7973 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
7974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
7975         LDKBalance_ClaimableOnChannelClose_class =
7976                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
7977         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
7978         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
7979         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
7980         LDKBalance_ClaimableAwaitingConfirmations_class =
7981                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
7982         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
7983         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
7984         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
7985         LDKBalance_ContentiousClaimable_class =
7986                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
7987         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
7988         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
7989         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
7990         LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
7991                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
7992         CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
7993         LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
7994         CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
7995 }
7996 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7997         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
7998         switch(obj->tag) {
7999                 case LDKBalance_ClaimableOnChannelClose: {
8000                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
8001                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
8002                 }
8003                 case LDKBalance_ClaimableAwaitingConfirmations: {
8004                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
8005                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8006                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
8007                 }
8008                 case LDKBalance_ContentiousClaimable: {
8009                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
8010                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8011                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
8012                 }
8013                 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
8014                         int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
8015                         int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
8016                         return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
8017                 }
8018                 default: abort();
8019         }
8020 }
8021 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8022         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8023         for (size_t i = 0; i < ret.datalen; i++) {
8024                 ret.data[i] = Balance_clone(&orig->data[i]);
8025         }
8026         return ret;
8027 }
8028 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8029 CHECK(owner->result_ok);
8030         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8031 }
8032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8033         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8034         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8035         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8036         return tag_ptr(ret_conv, true);
8037 }
8038
8039 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8040         LDKDecodeError ret = *owner->contents.err;
8041         ret.is_owned = false;
8042         return ret;
8043 }
8044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8045         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8046         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8047         int64_t ret_ref = 0;
8048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8050         return ret_ref;
8051 }
8052
8053 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8054         return owner->a;
8055 }
8056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8057         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8058         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8059         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
8060         return ret_arr;
8061 }
8062
8063 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8064         return Type_clone(&owner->b);
8065 }
8066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8067         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8068         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8069         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8070         return tag_ptr(ret_ret, true);
8071 }
8072
8073 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8074         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8075         for (size_t i = 0; i < ret.datalen; i++) {
8076                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8077         }
8078         return ret;
8079 }
8080 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
8081 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
8082 static jclass LDKCOption_NetAddressZ_None_class = NULL;
8083 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
8084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
8085         LDKCOption_NetAddressZ_Some_class =
8086                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
8087         CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
8088         LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
8089         CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
8090         LDKCOption_NetAddressZ_None_class =
8091                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
8092         CHECK(LDKCOption_NetAddressZ_None_class != NULL);
8093         LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
8094         CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
8095 }
8096 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8097         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
8098         switch(obj->tag) {
8099                 case LDKCOption_NetAddressZ_Some: {
8100                         int64_t some_ref = tag_ptr(&obj->some, false);
8101                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
8102                 }
8103                 case LDKCOption_NetAddressZ_None: {
8104                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
8105                 }
8106                 default: abort();
8107         }
8108 }
8109 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8110 CHECK(owner->result_ok);
8111         return CVec_u8Z_clone(&*owner->contents.result);
8112 }
8113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8114         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8115         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8116         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8117         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8118         CVec_u8Z_free(ret_var);
8119         return ret_arr;
8120 }
8121
8122 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8123         LDKPeerHandleError ret = *owner->contents.err;
8124         ret.is_owned = false;
8125         return ret;
8126 }
8127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8128         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8129         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8130         int64_t ret_ref = 0;
8131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8133         return ret_ref;
8134 }
8135
8136 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8137 CHECK(owner->result_ok);
8138         return *owner->contents.result;
8139 }
8140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8141         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8142         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8143 }
8144
8145 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8146         LDKPeerHandleError ret = *owner->contents.err;
8147         ret.is_owned = false;
8148         return ret;
8149 }
8150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8151         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8152         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8153         int64_t ret_ref = 0;
8154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8156         return ret_ref;
8157 }
8158
8159 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8160 CHECK(owner->result_ok);
8161         return *owner->contents.result;
8162 }
8163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8164         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8165         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8166         return ret_conv;
8167 }
8168
8169 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8170         LDKPeerHandleError ret = *owner->contents.err;
8171         ret.is_owned = false;
8172         return ret;
8173 }
8174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8175         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8176         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8177         int64_t ret_ref = 0;
8178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8180         return ret_ref;
8181 }
8182
8183 static jclass LDKGraphSyncError_DecodeError_class = NULL;
8184 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
8185 static jclass LDKGraphSyncError_LightningError_class = NULL;
8186 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
8187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
8188         LDKGraphSyncError_DecodeError_class =
8189                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
8190         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
8191         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
8192         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
8193         LDKGraphSyncError_LightningError_class =
8194                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
8195         CHECK(LDKGraphSyncError_LightningError_class != NULL);
8196         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
8197         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
8198 }
8199 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8200         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8201         switch(obj->tag) {
8202                 case LDKGraphSyncError_DecodeError: {
8203                         LDKDecodeError decode_error_var = obj->decode_error;
8204                         int64_t decode_error_ref = 0;
8205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
8206                         decode_error_ref = tag_ptr(decode_error_var.inner, false);
8207                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
8208                 }
8209                 case LDKGraphSyncError_LightningError: {
8210                         LDKLightningError lightning_error_var = obj->lightning_error;
8211                         int64_t lightning_error_ref = 0;
8212                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8213                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8214                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
8215                 }
8216                 default: abort();
8217         }
8218 }
8219 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8220 CHECK(owner->result_ok);
8221         return *owner->contents.result;
8222 }
8223 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8224         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8225         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8226         return ret_conv;
8227 }
8228
8229 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8230 CHECK(!owner->result_ok);
8231         return GraphSyncError_clone(&*owner->contents.err);
8232 }
8233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8234         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8235         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8236         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8237         int64_t ret_ref = tag_ptr(ret_copy, true);
8238         return ret_ref;
8239 }
8240
8241 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8242 CHECK(owner->result_ok);
8243         return NetAddress_clone(&*owner->contents.result);
8244 }
8245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8246         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8247         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8248         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8249         int64_t ret_ref = tag_ptr(ret_copy, true);
8250         return ret_ref;
8251 }
8252
8253 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8254         LDKDecodeError ret = *owner->contents.err;
8255         ret.is_owned = false;
8256         return ret;
8257 }
8258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8259         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8260         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8261         int64_t ret_ref = 0;
8262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8264         return ret_ref;
8265 }
8266
8267 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8268         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8269         for (size_t i = 0; i < ret.datalen; i++) {
8270                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8271         }
8272         return ret;
8273 }
8274 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8275         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8276         for (size_t i = 0; i < ret.datalen; i++) {
8277                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8278         }
8279         return ret;
8280 }
8281 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8282         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8283         for (size_t i = 0; i < ret.datalen; i++) {
8284                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8285         }
8286         return ret;
8287 }
8288 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8289         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8290         for (size_t i = 0; i < ret.datalen; i++) {
8291                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8292         }
8293         return ret;
8294 }
8295 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8296         LDKAcceptChannel ret = *owner->contents.result;
8297         ret.is_owned = false;
8298         return ret;
8299 }
8300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8301         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8302         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8303         int64_t ret_ref = 0;
8304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8306         return ret_ref;
8307 }
8308
8309 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8310         LDKDecodeError ret = *owner->contents.err;
8311         ret.is_owned = false;
8312         return ret;
8313 }
8314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8315         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8316         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8317         int64_t ret_ref = 0;
8318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8320         return ret_ref;
8321 }
8322
8323 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8324         LDKAnnouncementSignatures ret = *owner->contents.result;
8325         ret.is_owned = false;
8326         return ret;
8327 }
8328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8329         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8330         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8331         int64_t ret_ref = 0;
8332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8334         return ret_ref;
8335 }
8336
8337 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8338         LDKDecodeError ret = *owner->contents.err;
8339         ret.is_owned = false;
8340         return ret;
8341 }
8342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8343         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
8344         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8345         int64_t ret_ref = 0;
8346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8348         return ret_ref;
8349 }
8350
8351 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8352         LDKChannelReestablish ret = *owner->contents.result;
8353         ret.is_owned = false;
8354         return ret;
8355 }
8356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8357         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8358         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8359         int64_t ret_ref = 0;
8360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8362         return ret_ref;
8363 }
8364
8365 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8366         LDKDecodeError ret = *owner->contents.err;
8367         ret.is_owned = false;
8368         return ret;
8369 }
8370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8371         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
8372         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8373         int64_t ret_ref = 0;
8374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8376         return ret_ref;
8377 }
8378
8379 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8380         LDKClosingSigned ret = *owner->contents.result;
8381         ret.is_owned = false;
8382         return ret;
8383 }
8384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8385         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8386         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8387         int64_t ret_ref = 0;
8388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8390         return ret_ref;
8391 }
8392
8393 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8394         LDKDecodeError ret = *owner->contents.err;
8395         ret.is_owned = false;
8396         return ret;
8397 }
8398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8399         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
8400         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8401         int64_t ret_ref = 0;
8402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8404         return ret_ref;
8405 }
8406
8407 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8408         LDKClosingSignedFeeRange ret = *owner->contents.result;
8409         ret.is_owned = false;
8410         return ret;
8411 }
8412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8413         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8414         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8415         int64_t ret_ref = 0;
8416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8418         return ret_ref;
8419 }
8420
8421 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8422         LDKDecodeError ret = *owner->contents.err;
8423         ret.is_owned = false;
8424         return ret;
8425 }
8426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8427         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
8428         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(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 LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8436         LDKCommitmentSigned ret = *owner->contents.result;
8437         ret.is_owned = false;
8438         return ret;
8439 }
8440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8441         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8442         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8443         int64_t ret_ref = 0;
8444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8446         return ret_ref;
8447 }
8448
8449 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8450         LDKDecodeError ret = *owner->contents.err;
8451         ret.is_owned = false;
8452         return ret;
8453 }
8454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8455         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
8456         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8457         int64_t ret_ref = 0;
8458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8460         return ret_ref;
8461 }
8462
8463 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8464         LDKFundingCreated ret = *owner->contents.result;
8465         ret.is_owned = false;
8466         return ret;
8467 }
8468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8469         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8470         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8471         int64_t ret_ref = 0;
8472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8474         return ret_ref;
8475 }
8476
8477 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8478         LDKDecodeError ret = *owner->contents.err;
8479         ret.is_owned = false;
8480         return ret;
8481 }
8482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8483         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
8484         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8485         int64_t ret_ref = 0;
8486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8488         return ret_ref;
8489 }
8490
8491 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8492         LDKFundingSigned ret = *owner->contents.result;
8493         ret.is_owned = false;
8494         return ret;
8495 }
8496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8497         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8498         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8499         int64_t ret_ref = 0;
8500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8502         return ret_ref;
8503 }
8504
8505 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8506         LDKDecodeError ret = *owner->contents.err;
8507         ret.is_owned = false;
8508         return ret;
8509 }
8510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8511         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
8512         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8513         int64_t ret_ref = 0;
8514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8516         return ret_ref;
8517 }
8518
8519 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8520         LDKChannelReady ret = *owner->contents.result;
8521         ret.is_owned = false;
8522         return ret;
8523 }
8524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8525         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8526         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
8527         int64_t ret_ref = 0;
8528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8530         return ret_ref;
8531 }
8532
8533 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
8534         LDKDecodeError ret = *owner->contents.err;
8535         ret.is_owned = false;
8536         return ret;
8537 }
8538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8539         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
8540         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
8541         int64_t ret_ref = 0;
8542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8544         return ret_ref;
8545 }
8546
8547 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8548         LDKInit ret = *owner->contents.result;
8549         ret.is_owned = false;
8550         return ret;
8551 }
8552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8553         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8554         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8555         int64_t ret_ref = 0;
8556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8558         return ret_ref;
8559 }
8560
8561 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8562         LDKDecodeError ret = *owner->contents.err;
8563         ret.is_owned = false;
8564         return ret;
8565 }
8566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8567         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
8568         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
8569         int64_t ret_ref = 0;
8570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8572         return ret_ref;
8573 }
8574
8575 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8576         LDKOpenChannel ret = *owner->contents.result;
8577         ret.is_owned = false;
8578         return ret;
8579 }
8580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8581         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8582         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8583         int64_t ret_ref = 0;
8584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8586         return ret_ref;
8587 }
8588
8589 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8590         LDKDecodeError ret = *owner->contents.err;
8591         ret.is_owned = false;
8592         return ret;
8593 }
8594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8595         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
8596         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8597         int64_t ret_ref = 0;
8598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8600         return ret_ref;
8601 }
8602
8603 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8604         LDKRevokeAndACK ret = *owner->contents.result;
8605         ret.is_owned = false;
8606         return ret;
8607 }
8608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8609         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8610         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_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_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8618         LDKDecodeError ret = *owner->contents.err;
8619         ret.is_owned = false;
8620         return ret;
8621 }
8622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8623         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
8624         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8625         int64_t ret_ref = 0;
8626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8628         return ret_ref;
8629 }
8630
8631 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8632         LDKShutdown ret = *owner->contents.result;
8633         ret.is_owned = false;
8634         return ret;
8635 }
8636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8637         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8638         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8639         int64_t ret_ref = 0;
8640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8642         return ret_ref;
8643 }
8644
8645 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8646         LDKDecodeError ret = *owner->contents.err;
8647         ret.is_owned = false;
8648         return ret;
8649 }
8650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8651         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
8652         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8653         int64_t ret_ref = 0;
8654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8656         return ret_ref;
8657 }
8658
8659 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8660         LDKUpdateFailHTLC ret = *owner->contents.result;
8661         ret.is_owned = false;
8662         return ret;
8663 }
8664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8665         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8666         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8667         int64_t ret_ref = 0;
8668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8670         return ret_ref;
8671 }
8672
8673 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8674         LDKDecodeError ret = *owner->contents.err;
8675         ret.is_owned = false;
8676         return ret;
8677 }
8678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8679         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
8680         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8681         int64_t ret_ref = 0;
8682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8684         return ret_ref;
8685 }
8686
8687 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8688         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
8689         ret.is_owned = false;
8690         return ret;
8691 }
8692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8693         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8694         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8695         int64_t ret_ref = 0;
8696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8698         return ret_ref;
8699 }
8700
8701 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8702         LDKDecodeError ret = *owner->contents.err;
8703         ret.is_owned = false;
8704         return ret;
8705 }
8706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8707         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
8708         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8709         int64_t ret_ref = 0;
8710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8712         return ret_ref;
8713 }
8714
8715 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8716         LDKUpdateFee ret = *owner->contents.result;
8717         ret.is_owned = false;
8718         return ret;
8719 }
8720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8721         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8722         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8723         int64_t ret_ref = 0;
8724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8726         return ret_ref;
8727 }
8728
8729 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8730         LDKDecodeError ret = *owner->contents.err;
8731         ret.is_owned = false;
8732         return ret;
8733 }
8734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8735         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
8736         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8737         int64_t ret_ref = 0;
8738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8740         return ret_ref;
8741 }
8742
8743 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8744         LDKUpdateFulfillHTLC ret = *owner->contents.result;
8745         ret.is_owned = false;
8746         return ret;
8747 }
8748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8749         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8750         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8751         int64_t ret_ref = 0;
8752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8754         return ret_ref;
8755 }
8756
8757 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8758         LDKDecodeError ret = *owner->contents.err;
8759         ret.is_owned = false;
8760         return ret;
8761 }
8762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8763         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
8764         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8765         int64_t ret_ref = 0;
8766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8768         return ret_ref;
8769 }
8770
8771 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8772         LDKUpdateAddHTLC ret = *owner->contents.result;
8773         ret.is_owned = false;
8774         return ret;
8775 }
8776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8777         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8778         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8779         int64_t ret_ref = 0;
8780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8782         return ret_ref;
8783 }
8784
8785 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8786         LDKDecodeError ret = *owner->contents.err;
8787         ret.is_owned = false;
8788         return ret;
8789 }
8790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8791         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
8792         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(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 LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8800         LDKPing ret = *owner->contents.result;
8801         ret.is_owned = false;
8802         return ret;
8803 }
8804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8805         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8806         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8807         int64_t ret_ref = 0;
8808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8810         return ret_ref;
8811 }
8812
8813 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8814         LDKDecodeError ret = *owner->contents.err;
8815         ret.is_owned = false;
8816         return ret;
8817 }
8818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8819         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
8820         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
8821         int64_t ret_ref = 0;
8822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8824         return ret_ref;
8825 }
8826
8827 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8828         LDKPong ret = *owner->contents.result;
8829         ret.is_owned = false;
8830         return ret;
8831 }
8832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8833         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8834         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8835         int64_t ret_ref = 0;
8836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8838         return ret_ref;
8839 }
8840
8841 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8842         LDKDecodeError ret = *owner->contents.err;
8843         ret.is_owned = false;
8844         return ret;
8845 }
8846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8847         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
8848         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
8849         int64_t ret_ref = 0;
8850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8852         return ret_ref;
8853 }
8854
8855 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8856         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
8857         ret.is_owned = false;
8858         return ret;
8859 }
8860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8861         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8862         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8863         int64_t ret_ref = 0;
8864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8866         return ret_ref;
8867 }
8868
8869 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8870         LDKDecodeError ret = *owner->contents.err;
8871         ret.is_owned = false;
8872         return ret;
8873 }
8874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8875         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8876         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8877         int64_t ret_ref = 0;
8878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8880         return ret_ref;
8881 }
8882
8883 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8884         LDKChannelAnnouncement ret = *owner->contents.result;
8885         ret.is_owned = false;
8886         return ret;
8887 }
8888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8889         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8890         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8891         int64_t ret_ref = 0;
8892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8894         return ret_ref;
8895 }
8896
8897 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8898         LDKDecodeError ret = *owner->contents.err;
8899         ret.is_owned = false;
8900         return ret;
8901 }
8902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8903         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
8904         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8905         int64_t ret_ref = 0;
8906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8908         return ret_ref;
8909 }
8910
8911 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8912         LDKUnsignedChannelUpdate ret = *owner->contents.result;
8913         ret.is_owned = false;
8914         return ret;
8915 }
8916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8917         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8918         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8919         int64_t ret_ref = 0;
8920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8922         return ret_ref;
8923 }
8924
8925 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8926         LDKDecodeError ret = *owner->contents.err;
8927         ret.is_owned = false;
8928         return ret;
8929 }
8930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8931         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8932         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8933         int64_t ret_ref = 0;
8934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8936         return ret_ref;
8937 }
8938
8939 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8940         LDKChannelUpdate ret = *owner->contents.result;
8941         ret.is_owned = false;
8942         return ret;
8943 }
8944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8945         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8946         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8947         int64_t ret_ref = 0;
8948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8950         return ret_ref;
8951 }
8952
8953 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8954         LDKDecodeError ret = *owner->contents.err;
8955         ret.is_owned = false;
8956         return ret;
8957 }
8958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8959         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
8960         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8961         int64_t ret_ref = 0;
8962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8964         return ret_ref;
8965 }
8966
8967 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8968         LDKErrorMessage ret = *owner->contents.result;
8969         ret.is_owned = false;
8970         return ret;
8971 }
8972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8973         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8974         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_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_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8982         LDKDecodeError ret = *owner->contents.err;
8983         ret.is_owned = false;
8984         return ret;
8985 }
8986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8987         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
8988         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8989         int64_t ret_ref = 0;
8990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8992         return ret_ref;
8993 }
8994
8995 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
8996         LDKWarningMessage ret = *owner->contents.result;
8997         ret.is_owned = false;
8998         return ret;
8999 }
9000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9001         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9002         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9003         int64_t ret_ref = 0;
9004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9006         return ret_ref;
9007 }
9008
9009 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9010         LDKDecodeError ret = *owner->contents.err;
9011         ret.is_owned = false;
9012         return ret;
9013 }
9014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9015         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9016         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9017         int64_t ret_ref = 0;
9018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9020         return ret_ref;
9021 }
9022
9023 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9024         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9025         ret.is_owned = false;
9026         return ret;
9027 }
9028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9029         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9030         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9031         int64_t ret_ref = 0;
9032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9034         return ret_ref;
9035 }
9036
9037 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9038         LDKDecodeError ret = *owner->contents.err;
9039         ret.is_owned = false;
9040         return ret;
9041 }
9042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9043         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9044         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9045         int64_t ret_ref = 0;
9046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9048         return ret_ref;
9049 }
9050
9051 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9052         LDKNodeAnnouncement ret = *owner->contents.result;
9053         ret.is_owned = false;
9054         return ret;
9055 }
9056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9057         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9058         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9059         int64_t ret_ref = 0;
9060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9062         return ret_ref;
9063 }
9064
9065 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9066         LDKDecodeError ret = *owner->contents.err;
9067         ret.is_owned = false;
9068         return ret;
9069 }
9070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9071         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9072         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9073         int64_t ret_ref = 0;
9074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9076         return ret_ref;
9077 }
9078
9079 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9080         LDKQueryShortChannelIds ret = *owner->contents.result;
9081         ret.is_owned = false;
9082         return ret;
9083 }
9084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9085         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9086         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9087         int64_t ret_ref = 0;
9088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9090         return ret_ref;
9091 }
9092
9093 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9094         LDKDecodeError ret = *owner->contents.err;
9095         ret.is_owned = false;
9096         return ret;
9097 }
9098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9099         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9100         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9101         int64_t ret_ref = 0;
9102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9104         return ret_ref;
9105 }
9106
9107 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9108         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
9109         ret.is_owned = false;
9110         return ret;
9111 }
9112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9113         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9114         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9115         int64_t ret_ref = 0;
9116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9118         return ret_ref;
9119 }
9120
9121 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9122         LDKDecodeError ret = *owner->contents.err;
9123         ret.is_owned = false;
9124         return ret;
9125 }
9126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9127         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9128         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9129         int64_t ret_ref = 0;
9130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9132         return ret_ref;
9133 }
9134
9135 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9136         LDKQueryChannelRange ret = *owner->contents.result;
9137         ret.is_owned = false;
9138         return ret;
9139 }
9140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9141         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9142         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9143         int64_t ret_ref = 0;
9144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9146         return ret_ref;
9147 }
9148
9149 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9150         LDKDecodeError ret = *owner->contents.err;
9151         ret.is_owned = false;
9152         return ret;
9153 }
9154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9155         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9156         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9157         int64_t ret_ref = 0;
9158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9160         return ret_ref;
9161 }
9162
9163 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9164         LDKReplyChannelRange ret = *owner->contents.result;
9165         ret.is_owned = false;
9166         return ret;
9167 }
9168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9169         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9170         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9171         int64_t ret_ref = 0;
9172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9174         return ret_ref;
9175 }
9176
9177 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9178         LDKDecodeError ret = *owner->contents.err;
9179         ret.is_owned = false;
9180         return ret;
9181 }
9182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9183         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9184         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9185         int64_t ret_ref = 0;
9186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9188         return ret_ref;
9189 }
9190
9191 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9192         LDKGossipTimestampFilter ret = *owner->contents.result;
9193         ret.is_owned = false;
9194         return ret;
9195 }
9196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9197         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9198         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9199         int64_t ret_ref = 0;
9200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9202         return ret_ref;
9203 }
9204
9205 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9206         LDKDecodeError ret = *owner->contents.err;
9207         ret.is_owned = false;
9208         return ret;
9209 }
9210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9211         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9212         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9213         int64_t ret_ref = 0;
9214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9216         return ret_ref;
9217 }
9218
9219 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9220         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9221         for (size_t i = 0; i < ret.datalen; i++) {
9222                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9223         }
9224         return ret;
9225 }
9226 static jclass LDKSignOrCreationError_SignError_class = NULL;
9227 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9228 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9229 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9231         LDKSignOrCreationError_SignError_class =
9232                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9233         CHECK(LDKSignOrCreationError_SignError_class != NULL);
9234         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9235         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9236         LDKSignOrCreationError_CreationError_class =
9237                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9238         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9239         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9240         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9241 }
9242 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9243         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
9244         switch(obj->tag) {
9245                 case LDKSignOrCreationError_SignError: {
9246                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9247                 }
9248                 case LDKSignOrCreationError_CreationError: {
9249                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9250                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9251                 }
9252                 default: abort();
9253         }
9254 }
9255 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9256         LDKInvoice ret = *owner->contents.result;
9257         ret.is_owned = false;
9258         return ret;
9259 }
9260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9261         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9262         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9263         int64_t ret_ref = 0;
9264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9266         return ret_ref;
9267 }
9268
9269 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9270 CHECK(!owner->result_ok);
9271         return SignOrCreationError_clone(&*owner->contents.err);
9272 }
9273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9274         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
9275         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9276         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9277         int64_t ret_ref = tag_ptr(ret_copy, true);
9278         return ret_ref;
9279 }
9280
9281 typedef struct LDKFilter_JCalls {
9282         atomic_size_t refcnt;
9283         JavaVM *vm;
9284         jweak o;
9285         jmethodID register_tx_meth;
9286         jmethodID register_output_meth;
9287 } LDKFilter_JCalls;
9288 static void LDKFilter_JCalls_free(void* this_arg) {
9289         LDKFilter_JCalls *j_calls = (LDKFilter_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 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9306         LDKFilter_JCalls *j_calls = (LDKFilter_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         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9315         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9316         LDKu8slice script_pubkey_var = script_pubkey;
9317         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9318         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9319         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9320         CHECK(obj != NULL);
9321         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9322         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9323                 (*env)->ExceptionDescribe(env);
9324                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9325         }
9326         if (get_jenv_res == JNI_EDETACHED) {
9327                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9328         }
9329 }
9330 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9331         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9332         JNIEnv *env;
9333         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9334         if (get_jenv_res == JNI_EDETACHED) {
9335                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9336         } else {
9337                 DO_ASSERT(get_jenv_res == JNI_OK);
9338         }
9339         LDKWatchedOutput output_var = output;
9340         int64_t output_ref = 0;
9341         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9342         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
9343         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9344         CHECK(obj != NULL);
9345         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9346         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9347                 (*env)->ExceptionDescribe(env);
9348                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9349         }
9350         void* ret_ptr = untag_ptr(ret);
9351         CHECK_ACCESS(ret_ptr);
9352         LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9353         FREE(untag_ptr(ret));
9354         if (get_jenv_res == JNI_EDETACHED) {
9355                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9356         }
9357         return ret_conv;
9358 }
9359 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9360         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9361         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9362 }
9363 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9364         jclass c = (*env)->GetObjectClass(env, o);
9365         CHECK(c != NULL);
9366         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9367         atomic_init(&calls->refcnt, 1);
9368         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9369         calls->o = (*env)->NewWeakGlobalRef(env, o);
9370         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9371         CHECK(calls->register_tx_meth != NULL);
9372         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9373         CHECK(calls->register_output_meth != NULL);
9374
9375         LDKFilter ret = {
9376                 .this_arg = (void*) calls,
9377                 .register_tx = register_tx_LDKFilter_jcall,
9378                 .register_output = register_output_LDKFilter_jcall,
9379                 .free = LDKFilter_JCalls_free,
9380         };
9381         return ret;
9382 }
9383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9384         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9385         *res_ptr = LDKFilter_init(env, clz, o);
9386         return tag_ptr(res_ptr, true);
9387 }
9388 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) {
9389         void* this_arg_ptr = untag_ptr(this_arg);
9390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9391         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9392         unsigned char txid_arr[32];
9393         CHECK((*env)->GetArrayLength(env, txid) == 32);
9394         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9395         unsigned char (*txid_ref)[32] = &txid_arr;
9396         LDKu8slice script_pubkey_ref;
9397         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9398         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9399         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9400         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9401 }
9402
9403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9404         void* this_arg_ptr = untag_ptr(this_arg);
9405         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9406         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9407         LDKWatchedOutput output_conv;
9408         output_conv.inner = untag_ptr(output);
9409         output_conv.is_owned = ptr_is_owned(output);
9410         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9411         output_conv = WatchedOutput_clone(&output_conv);
9412         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9413         *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9414         int64_t ret_ref = tag_ptr(ret_copy, true);
9415         return ret_ref;
9416 }
9417
9418 static jclass LDKCOption_FilterZ_Some_class = NULL;
9419 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9420 static jclass LDKCOption_FilterZ_None_class = NULL;
9421 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9423         LDKCOption_FilterZ_Some_class =
9424                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9425         CHECK(LDKCOption_FilterZ_Some_class != NULL);
9426         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9427         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9428         LDKCOption_FilterZ_None_class =
9429                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9430         CHECK(LDKCOption_FilterZ_None_class != NULL);
9431         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9432         CHECK(LDKCOption_FilterZ_None_meth != NULL);
9433 }
9434 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9435         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
9436         switch(obj->tag) {
9437                 case LDKCOption_FilterZ_Some: {
9438                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9439                         *some_ret = obj->some;
9440                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9441                         if ((*some_ret).free == LDKFilter_JCalls_free) {
9442                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9443                                 LDKFilter_JCalls_cloned(&(*some_ret));
9444                         }
9445                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
9446                 }
9447                 case LDKCOption_FilterZ_None: {
9448                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9449                 }
9450                 default: abort();
9451         }
9452 }
9453 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9454         LDKLockedChannelMonitor ret = *owner->contents.result;
9455         ret.is_owned = false;
9456         return ret;
9457 }
9458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9459         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
9460         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9461         int64_t ret_ref = 0;
9462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9464         return ret_ref;
9465 }
9466
9467 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9468 CHECK(!owner->result_ok);
9469         return *owner->contents.err;
9470 }
9471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9472         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
9473         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9474 }
9475
9476 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9477         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9478         for (size_t i = 0; i < ret.datalen; i++) {
9479                 ret.data[i] = OutPoint_clone(&orig->data[i]);
9480         }
9481         return ret;
9482 }
9483 typedef struct LDKMessageSendEventsProvider_JCalls {
9484         atomic_size_t refcnt;
9485         JavaVM *vm;
9486         jweak o;
9487         jmethodID get_and_clear_pending_msg_events_meth;
9488 } LDKMessageSendEventsProvider_JCalls;
9489 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9490         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9491         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9500                 if (get_jenv_res == JNI_EDETACHED) {
9501                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9502                 }
9503                 FREE(j_calls);
9504         }
9505 }
9506 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9507         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9508         JNIEnv *env;
9509         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9510         if (get_jenv_res == JNI_EDETACHED) {
9511                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9512         } else {
9513                 DO_ASSERT(get_jenv_res == JNI_OK);
9514         }
9515         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9516         CHECK(obj != NULL);
9517         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9518         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9519                 (*env)->ExceptionDescribe(env);
9520                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9521         }
9522         LDKCVec_MessageSendEventZ ret_constr;
9523         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9524         if (ret_constr.datalen > 0)
9525                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9526         else
9527                 ret_constr.data = NULL;
9528         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9529         for (size_t s = 0; s < ret_constr.datalen; s++) {
9530                 int64_t ret_conv_18 = ret_vals[s];
9531                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
9532                 CHECK_ACCESS(ret_conv_18_ptr);
9533                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9534                 FREE(untag_ptr(ret_conv_18));
9535                 ret_constr.data[s] = ret_conv_18_conv;
9536         }
9537         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9538         if (get_jenv_res == JNI_EDETACHED) {
9539                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9540         }
9541         return ret_constr;
9542 }
9543 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
9544         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
9545         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9546 }
9547 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9548         jclass c = (*env)->GetObjectClass(env, o);
9549         CHECK(c != NULL);
9550         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
9551         atomic_init(&calls->refcnt, 1);
9552         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9553         calls->o = (*env)->NewWeakGlobalRef(env, o);
9554         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
9555         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
9556
9557         LDKMessageSendEventsProvider ret = {
9558                 .this_arg = (void*) calls,
9559                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
9560                 .free = LDKMessageSendEventsProvider_JCalls_free,
9561         };
9562         return ret;
9563 }
9564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9565         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9566         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
9567         return tag_ptr(res_ptr, true);
9568 }
9569 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9570         void* this_arg_ptr = untag_ptr(this_arg);
9571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9572         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
9573         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
9574         int64_tArray ret_arr = NULL;
9575         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9576         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9577         for (size_t s = 0; s < ret_var.datalen; s++) {
9578                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9579                 *ret_conv_18_copy = ret_var.data[s];
9580                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
9581                 ret_arr_ptr[s] = ret_conv_18_ref;
9582         }
9583         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9584         FREE(ret_var.data);
9585         return ret_arr;
9586 }
9587
9588 typedef struct LDKEventHandler_JCalls {
9589         atomic_size_t refcnt;
9590         JavaVM *vm;
9591         jweak o;
9592         jmethodID handle_event_meth;
9593 } LDKEventHandler_JCalls;
9594 static void LDKEventHandler_JCalls_free(void* this_arg) {
9595         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9596         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9597                 JNIEnv *env;
9598                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9599                 if (get_jenv_res == JNI_EDETACHED) {
9600                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9601                 } else {
9602                         DO_ASSERT(get_jenv_res == JNI_OK);
9603                 }
9604                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9605                 if (get_jenv_res == JNI_EDETACHED) {
9606                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9607                 }
9608                 FREE(j_calls);
9609         }
9610 }
9611 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
9612         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9613         JNIEnv *env;
9614         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9615         if (get_jenv_res == JNI_EDETACHED) {
9616                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9617         } else {
9618                 DO_ASSERT(get_jenv_res == JNI_OK);
9619         }
9620         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
9621         *ret_event = Event_clone(event);
9622         int64_t ref_event = tag_ptr(ret_event, true);
9623         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9624         CHECK(obj != NULL);
9625         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, ref_event);
9626         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9627                 (*env)->ExceptionDescribe(env);
9628                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
9629         }
9630         if (get_jenv_res == JNI_EDETACHED) {
9631                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9632         }
9633 }
9634 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9635         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9636         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9637 }
9638 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
9639         jclass c = (*env)->GetObjectClass(env, o);
9640         CHECK(c != NULL);
9641         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9642         atomic_init(&calls->refcnt, 1);
9643         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9644         calls->o = (*env)->NewWeakGlobalRef(env, o);
9645         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
9646         CHECK(calls->handle_event_meth != NULL);
9647
9648         LDKEventHandler ret = {
9649                 .this_arg = (void*) calls,
9650                 .handle_event = handle_event_LDKEventHandler_jcall,
9651                 .free = LDKEventHandler_JCalls_free,
9652         };
9653         return ret;
9654 }
9655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
9656         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9657         *res_ptr = LDKEventHandler_init(env, clz, o);
9658         return tag_ptr(res_ptr, true);
9659 }
9660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
9661         void* this_arg_ptr = untag_ptr(this_arg);
9662         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9663         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9664         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
9665         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9666 }
9667
9668 typedef struct LDKEventsProvider_JCalls {
9669         atomic_size_t refcnt;
9670         JavaVM *vm;
9671         jweak o;
9672         jmethodID process_pending_events_meth;
9673 } LDKEventsProvider_JCalls;
9674 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9675         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9676         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9677                 JNIEnv *env;
9678                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9679                 if (get_jenv_res == JNI_EDETACHED) {
9680                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9681                 } else {
9682                         DO_ASSERT(get_jenv_res == JNI_OK);
9683                 }
9684                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9685                 if (get_jenv_res == JNI_EDETACHED) {
9686                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9687                 }
9688                 FREE(j_calls);
9689         }
9690 }
9691 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9692         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9693         JNIEnv *env;
9694         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9695         if (get_jenv_res == JNI_EDETACHED) {
9696                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9697         } else {
9698                 DO_ASSERT(get_jenv_res == JNI_OK);
9699         }
9700         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9701         *handler_ret = handler;
9702         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9703         CHECK(obj != NULL);
9704         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
9705         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9706                 (*env)->ExceptionDescribe(env);
9707                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
9708         }
9709         if (get_jenv_res == JNI_EDETACHED) {
9710                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9711         }
9712 }
9713 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9714         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9715         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9716 }
9717 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9718         jclass c = (*env)->GetObjectClass(env, o);
9719         CHECK(c != NULL);
9720         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9721         atomic_init(&calls->refcnt, 1);
9722         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9723         calls->o = (*env)->NewWeakGlobalRef(env, o);
9724         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
9725         CHECK(calls->process_pending_events_meth != NULL);
9726
9727         LDKEventsProvider ret = {
9728                 .this_arg = (void*) calls,
9729                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9730                 .free = LDKEventsProvider_JCalls_free,
9731         };
9732         return ret;
9733 }
9734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9735         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9736         *res_ptr = LDKEventsProvider_init(env, clz, o);
9737         return tag_ptr(res_ptr, true);
9738 }
9739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
9740         void* this_arg_ptr = untag_ptr(this_arg);
9741         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9742         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9743         void* handler_ptr = untag_ptr(handler);
9744         CHECK_ACCESS(handler_ptr);
9745         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9746         if (handler_conv.free == LDKEventHandler_JCalls_free) {
9747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9748                 LDKEventHandler_JCalls_cloned(&handler_conv);
9749         }
9750         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9751 }
9752
9753 typedef struct LDKScore_JCalls {
9754         atomic_size_t refcnt;
9755         JavaVM *vm;
9756         jweak o;
9757         jmethodID channel_penalty_msat_meth;
9758         jmethodID payment_path_failed_meth;
9759         jmethodID payment_path_successful_meth;
9760         jmethodID probe_failed_meth;
9761         jmethodID probe_successful_meth;
9762         jmethodID write_meth;
9763 } LDKScore_JCalls;
9764 static void LDKScore_JCalls_free(void* this_arg) {
9765         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9766         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9767                 JNIEnv *env;
9768                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9769                 if (get_jenv_res == JNI_EDETACHED) {
9770                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9771                 } else {
9772                         DO_ASSERT(get_jenv_res == JNI_OK);
9773                 }
9774                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9775                 if (get_jenv_res == JNI_EDETACHED) {
9776                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9777                 }
9778                 FREE(j_calls);
9779         }
9780 }
9781 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
9782         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9783         JNIEnv *env;
9784         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9785         if (get_jenv_res == JNI_EDETACHED) {
9786                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9787         } else {
9788                 DO_ASSERT(get_jenv_res == JNI_OK);
9789         }
9790         int64_t short_channel_id_conv = short_channel_id;
9791         LDKNodeId source_var = *source;
9792         int64_t source_ref = 0;
9793         source_var = NodeId_clone(&source_var);
9794         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
9795         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
9796         LDKNodeId target_var = *target;
9797         int64_t target_ref = 0;
9798         target_var = NodeId_clone(&target_var);
9799         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
9800         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
9801         LDKChannelUsage usage_var = usage;
9802         int64_t usage_ref = 0;
9803         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
9804         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
9805         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9806         CHECK(obj != NULL);
9807         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref);
9808         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9809                 (*env)->ExceptionDescribe(env);
9810                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
9811         }
9812         if (get_jenv_res == JNI_EDETACHED) {
9813                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9814         }
9815         return ret;
9816 }
9817 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9818         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9819         JNIEnv *env;
9820         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9821         if (get_jenv_res == JNI_EDETACHED) {
9822                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9823         } else {
9824                 DO_ASSERT(get_jenv_res == JNI_OK);
9825         }
9826         LDKCVec_RouteHopZ path_var = path;
9827         int64_tArray path_arr = NULL;
9828         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9829         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9830         for (size_t k = 0; k < path_var.datalen; k++) {
9831                 LDKRouteHop path_conv_10_var = path_var.data[k];
9832                 int64_t path_conv_10_ref = 0;
9833                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9834                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9835                 path_arr_ptr[k] = path_conv_10_ref;
9836         }
9837         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9838         FREE(path_var.data);
9839         int64_t short_channel_id_conv = short_channel_id;
9840         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9841         CHECK(obj != NULL);
9842         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
9843         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9844                 (*env)->ExceptionDescribe(env);
9845                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
9846         }
9847         if (get_jenv_res == JNI_EDETACHED) {
9848                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9849         }
9850 }
9851 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9852         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9853         JNIEnv *env;
9854         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9855         if (get_jenv_res == JNI_EDETACHED) {
9856                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9857         } else {
9858                 DO_ASSERT(get_jenv_res == JNI_OK);
9859         }
9860         LDKCVec_RouteHopZ path_var = path;
9861         int64_tArray path_arr = NULL;
9862         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9863         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9864         for (size_t k = 0; k < path_var.datalen; k++) {
9865                 LDKRouteHop path_conv_10_var = path_var.data[k];
9866                 int64_t path_conv_10_ref = 0;
9867                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9868                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9869                 path_arr_ptr[k] = path_conv_10_ref;
9870         }
9871         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9872         FREE(path_var.data);
9873         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9874         CHECK(obj != NULL);
9875         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
9876         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9877                 (*env)->ExceptionDescribe(env);
9878                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
9879         }
9880         if (get_jenv_res == JNI_EDETACHED) {
9881                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9882         }
9883 }
9884 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
9885         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9886         JNIEnv *env;
9887         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9888         if (get_jenv_res == JNI_EDETACHED) {
9889                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9890         } else {
9891                 DO_ASSERT(get_jenv_res == JNI_OK);
9892         }
9893         LDKCVec_RouteHopZ path_var = path;
9894         int64_tArray path_arr = NULL;
9895         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9896         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9897         for (size_t k = 0; k < path_var.datalen; k++) {
9898                 LDKRouteHop path_conv_10_var = path_var.data[k];
9899                 int64_t path_conv_10_ref = 0;
9900                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9901                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9902                 path_arr_ptr[k] = path_conv_10_ref;
9903         }
9904         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9905         FREE(path_var.data);
9906         int64_t short_channel_id_conv = short_channel_id;
9907         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9908         CHECK(obj != NULL);
9909         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_arr, short_channel_id_conv);
9910         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9911                 (*env)->ExceptionDescribe(env);
9912                 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
9913         }
9914         if (get_jenv_res == JNI_EDETACHED) {
9915                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9916         }
9917 }
9918 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
9919         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9920         JNIEnv *env;
9921         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9922         if (get_jenv_res == JNI_EDETACHED) {
9923                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9924         } else {
9925                 DO_ASSERT(get_jenv_res == JNI_OK);
9926         }
9927         LDKCVec_RouteHopZ path_var = path;
9928         int64_tArray path_arr = NULL;
9929         path_arr = (*env)->NewLongArray(env, path_var.datalen);
9930         int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
9931         for (size_t k = 0; k < path_var.datalen; k++) {
9932                 LDKRouteHop path_conv_10_var = path_var.data[k];
9933                 int64_t path_conv_10_ref = 0;
9934                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
9935                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
9936                 path_arr_ptr[k] = path_conv_10_ref;
9937         }
9938         (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
9939         FREE(path_var.data);
9940         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9941         CHECK(obj != NULL);
9942         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_arr);
9943         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9944                 (*env)->ExceptionDescribe(env);
9945                 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
9946         }
9947         if (get_jenv_res == JNI_EDETACHED) {
9948                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9949         }
9950 }
9951 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
9952         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
9953         JNIEnv *env;
9954         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9955         if (get_jenv_res == JNI_EDETACHED) {
9956                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9957         } else {
9958                 DO_ASSERT(get_jenv_res == JNI_OK);
9959         }
9960         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9961         CHECK(obj != NULL);
9962         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9963         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9964                 (*env)->ExceptionDescribe(env);
9965                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
9966         }
9967         LDKCVec_u8Z ret_ref;
9968         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9969         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9970         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9971         if (get_jenv_res == JNI_EDETACHED) {
9972                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9973         }
9974         return ret_ref;
9975 }
9976 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
9977         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
9978         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9979 }
9980 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
9981         jclass c = (*env)->GetObjectClass(env, o);
9982         CHECK(c != NULL);
9983         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
9984         atomic_init(&calls->refcnt, 1);
9985         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9986         calls->o = (*env)->NewWeakGlobalRef(env, o);
9987         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJ)J");
9988         CHECK(calls->channel_penalty_msat_meth != NULL);
9989         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
9990         CHECK(calls->payment_path_failed_meth != NULL);
9991         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
9992         CHECK(calls->payment_path_successful_meth != NULL);
9993         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "([JJ)V");
9994         CHECK(calls->probe_failed_meth != NULL);
9995         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "([J)V");
9996         CHECK(calls->probe_successful_meth != NULL);
9997         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9998         CHECK(calls->write_meth != NULL);
9999
10000         LDKScore ret = {
10001                 .this_arg = (void*) calls,
10002                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10003                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10004                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10005                 .probe_failed = probe_failed_LDKScore_jcall,
10006                 .probe_successful = probe_successful_LDKScore_jcall,
10007                 .write = write_LDKScore_jcall,
10008                 .free = LDKScore_JCalls_free,
10009         };
10010         return ret;
10011 }
10012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
10013         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10014         *res_ptr = LDKScore_init(env, clz, o);
10015         return tag_ptr(res_ptr, true);
10016 }
10017 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) {
10018         void* this_arg_ptr = untag_ptr(this_arg);
10019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10020         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10021         LDKNodeId source_conv;
10022         source_conv.inner = untag_ptr(source);
10023         source_conv.is_owned = ptr_is_owned(source);
10024         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10025         source_conv.is_owned = false;
10026         LDKNodeId target_conv;
10027         target_conv.inner = untag_ptr(target);
10028         target_conv.is_owned = ptr_is_owned(target);
10029         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10030         target_conv.is_owned = false;
10031         LDKChannelUsage usage_conv;
10032         usage_conv.inner = untag_ptr(usage);
10033         usage_conv.is_owned = ptr_is_owned(usage);
10034         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10035         usage_conv = ChannelUsage_clone(&usage_conv);
10036         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
10037         return ret_conv;
10038 }
10039
10040 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) {
10041         void* this_arg_ptr = untag_ptr(this_arg);
10042         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10043         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10044         LDKCVec_RouteHopZ path_constr;
10045         path_constr.datalen = (*env)->GetArrayLength(env, path);
10046         if (path_constr.datalen > 0)
10047                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10048         else
10049                 path_constr.data = NULL;
10050         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10051         for (size_t k = 0; k < path_constr.datalen; k++) {
10052                 int64_t path_conv_10 = path_vals[k];
10053                 LDKRouteHop path_conv_10_conv;
10054                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10055                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10056                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10057                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10058                 path_constr.data[k] = path_conv_10_conv;
10059         }
10060         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10061         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10062 }
10063
10064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10065         void* this_arg_ptr = untag_ptr(this_arg);
10066         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10067         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10068         LDKCVec_RouteHopZ path_constr;
10069         path_constr.datalen = (*env)->GetArrayLength(env, path);
10070         if (path_constr.datalen > 0)
10071                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10072         else
10073                 path_constr.data = NULL;
10074         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10075         for (size_t k = 0; k < path_constr.datalen; k++) {
10076                 int64_t path_conv_10 = path_vals[k];
10077                 LDKRouteHop path_conv_10_conv;
10078                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10079                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10080                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10081                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10082                 path_constr.data[k] = path_conv_10_conv;
10083         }
10084         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10085         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
10086 }
10087
10088 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) {
10089         void* this_arg_ptr = untag_ptr(this_arg);
10090         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10091         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10092         LDKCVec_RouteHopZ path_constr;
10093         path_constr.datalen = (*env)->GetArrayLength(env, path);
10094         if (path_constr.datalen > 0)
10095                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10096         else
10097                 path_constr.data = NULL;
10098         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10099         for (size_t k = 0; k < path_constr.datalen; k++) {
10100                 int64_t path_conv_10 = path_vals[k];
10101                 LDKRouteHop path_conv_10_conv;
10102                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10103                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10104                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10105                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10106                 path_constr.data[k] = path_conv_10_conv;
10107         }
10108         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10109         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10110 }
10111
10112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
10113         void* this_arg_ptr = untag_ptr(this_arg);
10114         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10115         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10116         LDKCVec_RouteHopZ path_constr;
10117         path_constr.datalen = (*env)->GetArrayLength(env, path);
10118         if (path_constr.datalen > 0)
10119                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10120         else
10121                 path_constr.data = NULL;
10122         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
10123         for (size_t k = 0; k < path_constr.datalen; k++) {
10124                 int64_t path_conv_10 = path_vals[k];
10125                 LDKRouteHop path_conv_10_conv;
10126                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10127                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10128                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10129                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10130                 path_constr.data[k] = path_conv_10_conv;
10131         }
10132         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
10133         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
10134 }
10135
10136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
10137         void* this_arg_ptr = untag_ptr(this_arg);
10138         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10139         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10140         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10141         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
10142         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
10143         CVec_u8Z_free(ret_var);
10144         return ret_arr;
10145 }
10146
10147 typedef struct LDKPersister_JCalls {
10148         atomic_size_t refcnt;
10149         JavaVM *vm;
10150         jweak o;
10151         jmethodID persist_manager_meth;
10152         jmethodID persist_graph_meth;
10153         jmethodID persist_scorer_meth;
10154 } LDKPersister_JCalls;
10155 static void LDKPersister_JCalls_free(void* this_arg) {
10156         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10157         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10158                 JNIEnv *env;
10159                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10160                 if (get_jenv_res == JNI_EDETACHED) {
10161                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10162                 } else {
10163                         DO_ASSERT(get_jenv_res == JNI_OK);
10164                 }
10165                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10166                 if (get_jenv_res == JNI_EDETACHED) {
10167                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10168                 }
10169                 FREE(j_calls);
10170         }
10171 }
10172 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10173         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10174         JNIEnv *env;
10175         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10176         if (get_jenv_res == JNI_EDETACHED) {
10177                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10178         } else {
10179                 DO_ASSERT(get_jenv_res == JNI_OK);
10180         }
10181         LDKChannelManager channel_manager_var = *channel_manager;
10182         int64_t channel_manager_ref = 0;
10183         // WARNING: we may need a move here but no clone is available for LDKChannelManager
10184         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10185         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
10186         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10187         CHECK(obj != NULL);
10188         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10189         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10190                 (*env)->ExceptionDescribe(env);
10191                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
10192         }
10193         void* ret_ptr = untag_ptr(ret);
10194         CHECK_ACCESS(ret_ptr);
10195         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10196         FREE(untag_ptr(ret));
10197         if (get_jenv_res == JNI_EDETACHED) {
10198                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10199         }
10200         return ret_conv;
10201 }
10202 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10203         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10204         JNIEnv *env;
10205         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10206         if (get_jenv_res == JNI_EDETACHED) {
10207                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10208         } else {
10209                 DO_ASSERT(get_jenv_res == JNI_OK);
10210         }
10211         LDKNetworkGraph network_graph_var = *network_graph;
10212         int64_t network_graph_ref = 0;
10213         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10214         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10215         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
10216         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10217         CHECK(obj != NULL);
10218         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
10219         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10220                 (*env)->ExceptionDescribe(env);
10221                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
10222         }
10223         void* ret_ptr = untag_ptr(ret);
10224         CHECK_ACCESS(ret_ptr);
10225         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10226         FREE(untag_ptr(ret));
10227         if (get_jenv_res == JNI_EDETACHED) {
10228                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10229         }
10230         return ret_conv;
10231 }
10232 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKMultiThreadedLockableScore * scorer) {
10233         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10234         JNIEnv *env;
10235         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10236         if (get_jenv_res == JNI_EDETACHED) {
10237                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10238         } else {
10239                 DO_ASSERT(get_jenv_res == JNI_OK);
10240         }
10241         LDKMultiThreadedLockableScore scorer_var = *scorer;
10242         int64_t scorer_ref = 0;
10243         // WARNING: we may need a move here but no clone is available for LDKMultiThreadedLockableScore
10244         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_var);
10245         scorer_ref = tag_ptr(scorer_var.inner, scorer_var.is_owned);
10246         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10247         CHECK(obj != NULL);
10248         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, scorer_ref);
10249         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10250                 (*env)->ExceptionDescribe(env);
10251                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
10252         }
10253         void* ret_ptr = untag_ptr(ret);
10254         CHECK_ACCESS(ret_ptr);
10255         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10256         FREE(untag_ptr(ret));
10257         if (get_jenv_res == JNI_EDETACHED) {
10258                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10259         }
10260         return ret_conv;
10261 }
10262 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10263         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10264         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10265 }
10266 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
10267         jclass c = (*env)->GetObjectClass(env, o);
10268         CHECK(c != NULL);
10269         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10270         atomic_init(&calls->refcnt, 1);
10271         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10272         calls->o = (*env)->NewWeakGlobalRef(env, o);
10273         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10274         CHECK(calls->persist_manager_meth != NULL);
10275         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
10276         CHECK(calls->persist_graph_meth != NULL);
10277         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
10278         CHECK(calls->persist_scorer_meth != NULL);
10279
10280         LDKPersister ret = {
10281                 .this_arg = (void*) calls,
10282                 .persist_manager = persist_manager_LDKPersister_jcall,
10283                 .persist_graph = persist_graph_LDKPersister_jcall,
10284                 .persist_scorer = persist_scorer_LDKPersister_jcall,
10285                 .free = LDKPersister_JCalls_free,
10286         };
10287         return ret;
10288 }
10289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10290         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10291         *res_ptr = LDKPersister_init(env, clz, o);
10292         return tag_ptr(res_ptr, true);
10293 }
10294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10295         void* this_arg_ptr = untag_ptr(this_arg);
10296         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10297         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10298         LDKChannelManager channel_manager_conv;
10299         channel_manager_conv.inner = untag_ptr(channel_manager);
10300         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
10301         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10302         channel_manager_conv.is_owned = false;
10303         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10304         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10305         return tag_ptr(ret_conv, true);
10306 }
10307
10308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
10309         void* this_arg_ptr = untag_ptr(this_arg);
10310         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10311         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10312         LDKNetworkGraph network_graph_conv;
10313         network_graph_conv.inner = untag_ptr(network_graph);
10314         network_graph_conv.is_owned = ptr_is_owned(network_graph);
10315         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10316         network_graph_conv.is_owned = false;
10317         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10318         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10319         return tag_ptr(ret_conv, true);
10320 }
10321
10322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
10323         void* this_arg_ptr = untag_ptr(this_arg);
10324         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10325         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10326         LDKMultiThreadedLockableScore scorer_conv;
10327         scorer_conv.inner = untag_ptr(scorer);
10328         scorer_conv.is_owned = ptr_is_owned(scorer);
10329         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
10330         scorer_conv.is_owned = false;
10331         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10332         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, &scorer_conv);
10333         return tag_ptr(ret_conv, true);
10334 }
10335
10336 typedef struct LDKListen_JCalls {
10337         atomic_size_t refcnt;
10338         JavaVM *vm;
10339         jweak o;
10340         jmethodID filtered_block_connected_meth;
10341         jmethodID block_connected_meth;
10342         jmethodID block_disconnected_meth;
10343 } LDKListen_JCalls;
10344 static void LDKListen_JCalls_free(void* this_arg) {
10345         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10346         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10347                 JNIEnv *env;
10348                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10349                 if (get_jenv_res == JNI_EDETACHED) {
10350                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10351                 } else {
10352                         DO_ASSERT(get_jenv_res == JNI_OK);
10353                 }
10354                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10355                 if (get_jenv_res == JNI_EDETACHED) {
10356                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10357                 }
10358                 FREE(j_calls);
10359         }
10360 }
10361 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10362         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10363         JNIEnv *env;
10364         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10365         if (get_jenv_res == JNI_EDETACHED) {
10366                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10367         } else {
10368                 DO_ASSERT(get_jenv_res == JNI_OK);
10369         }
10370         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10371         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10372         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10373         int64_tArray txdata_arr = NULL;
10374         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10375         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10376         for (size_t c = 0; c < txdata_var.datalen; c++) {
10377                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10378                 *txdata_conv_28_conv = txdata_var.data[c];
10379                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
10380         }
10381         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10382         FREE(txdata_var.data);
10383         int32_t height_conv = height;
10384         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10385         CHECK(obj != NULL);
10386         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
10387         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10388                 (*env)->ExceptionDescribe(env);
10389                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
10390         }
10391         if (get_jenv_res == JNI_EDETACHED) {
10392                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10393         }
10394 }
10395 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
10396         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10397         JNIEnv *env;
10398         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10399         if (get_jenv_res == JNI_EDETACHED) {
10400                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10401         } else {
10402                 DO_ASSERT(get_jenv_res == JNI_OK);
10403         }
10404         LDKu8slice block_var = block;
10405         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
10406         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
10407         int32_t height_conv = height;
10408         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10409         CHECK(obj != NULL);
10410         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
10411         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10412                 (*env)->ExceptionDescribe(env);
10413                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
10414         }
10415         if (get_jenv_res == JNI_EDETACHED) {
10416                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10417         }
10418 }
10419 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10420         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10421         JNIEnv *env;
10422         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10423         if (get_jenv_res == JNI_EDETACHED) {
10424                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10425         } else {
10426                 DO_ASSERT(get_jenv_res == JNI_OK);
10427         }
10428         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10429         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10430         int32_t height_conv = height;
10431         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10432         CHECK(obj != NULL);
10433         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
10434         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10435                 (*env)->ExceptionDescribe(env);
10436                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
10437         }
10438         if (get_jenv_res == JNI_EDETACHED) {
10439                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10440         }
10441 }
10442 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
10443         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
10444         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10445 }
10446 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
10447         jclass c = (*env)->GetObjectClass(env, o);
10448         CHECK(c != NULL);
10449         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
10450         atomic_init(&calls->refcnt, 1);
10451         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10452         calls->o = (*env)->NewWeakGlobalRef(env, o);
10453         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
10454         CHECK(calls->filtered_block_connected_meth != NULL);
10455         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
10456         CHECK(calls->block_connected_meth != NULL);
10457         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
10458         CHECK(calls->block_disconnected_meth != NULL);
10459
10460         LDKListen ret = {
10461                 .this_arg = (void*) calls,
10462                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
10463                 .block_connected = block_connected_LDKListen_jcall,
10464                 .block_disconnected = block_disconnected_LDKListen_jcall,
10465                 .free = LDKListen_JCalls_free,
10466         };
10467         return ret;
10468 }
10469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
10470         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
10471         *res_ptr = LDKListen_init(env, clz, o);
10472         return tag_ptr(res_ptr, true);
10473 }
10474 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) {
10475         void* this_arg_ptr = untag_ptr(this_arg);
10476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10477         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10478         unsigned char header_arr[80];
10479         CHECK((*env)->GetArrayLength(env, header) == 80);
10480         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10481         unsigned char (*header_ref)[80] = &header_arr;
10482         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10483         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10484         if (txdata_constr.datalen > 0)
10485                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10486         else
10487                 txdata_constr.data = NULL;
10488         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10489         for (size_t c = 0; c < txdata_constr.datalen; c++) {
10490                 int64_t txdata_conv_28 = txdata_vals[c];
10491                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
10492                 CHECK_ACCESS(txdata_conv_28_ptr);
10493                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10494                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
10495                 txdata_constr.data[c] = txdata_conv_28_conv;
10496         }
10497         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10498         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10499 }
10500
10501 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) {
10502         void* this_arg_ptr = untag_ptr(this_arg);
10503         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10504         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10505         LDKu8slice block_ref;
10506         block_ref.datalen = (*env)->GetArrayLength(env, block);
10507         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
10508         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
10509         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
10510 }
10511
10512 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) {
10513         void* this_arg_ptr = untag_ptr(this_arg);
10514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10515         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10516         unsigned char header_arr[80];
10517         CHECK((*env)->GetArrayLength(env, header) == 80);
10518         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10519         unsigned char (*header_ref)[80] = &header_arr;
10520         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
10521 }
10522
10523 typedef struct LDKConfirm_JCalls {
10524         atomic_size_t refcnt;
10525         JavaVM *vm;
10526         jweak o;
10527         jmethodID transactions_confirmed_meth;
10528         jmethodID transaction_unconfirmed_meth;
10529         jmethodID best_block_updated_meth;
10530         jmethodID get_relevant_txids_meth;
10531 } LDKConfirm_JCalls;
10532 static void LDKConfirm_JCalls_free(void* this_arg) {
10533         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10534         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10535                 JNIEnv *env;
10536                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10537                 if (get_jenv_res == JNI_EDETACHED) {
10538                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10539                 } else {
10540                         DO_ASSERT(get_jenv_res == JNI_OK);
10541                 }
10542                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10543                 if (get_jenv_res == JNI_EDETACHED) {
10544                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10545                 }
10546                 FREE(j_calls);
10547         }
10548 }
10549 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10550         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10551         JNIEnv *env;
10552         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10553         if (get_jenv_res == JNI_EDETACHED) {
10554                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10555         } else {
10556                 DO_ASSERT(get_jenv_res == JNI_OK);
10557         }
10558         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10559         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10560         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10561         int64_tArray txdata_arr = NULL;
10562         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10563         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10564         for (size_t c = 0; c < txdata_var.datalen; c++) {
10565                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10566                 *txdata_conv_28_conv = txdata_var.data[c];
10567                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
10568         }
10569         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10570         FREE(txdata_var.data);
10571         int32_t height_conv = height;
10572         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10573         CHECK(obj != NULL);
10574         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
10575         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10576                 (*env)->ExceptionDescribe(env);
10577                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
10578         }
10579         if (get_jenv_res == JNI_EDETACHED) {
10580                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10581         }
10582 }
10583 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
10584         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10585         JNIEnv *env;
10586         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10587         if (get_jenv_res == JNI_EDETACHED) {
10588                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10589         } else {
10590                 DO_ASSERT(get_jenv_res == JNI_OK);
10591         }
10592         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10593         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10594         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10595         CHECK(obj != NULL);
10596         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
10597         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10598                 (*env)->ExceptionDescribe(env);
10599                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
10600         }
10601         if (get_jenv_res == JNI_EDETACHED) {
10602                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10603         }
10604 }
10605 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10606         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10607         JNIEnv *env;
10608         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10609         if (get_jenv_res == JNI_EDETACHED) {
10610                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10611         } else {
10612                 DO_ASSERT(get_jenv_res == JNI_OK);
10613         }
10614         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10615         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10616         int32_t height_conv = height;
10617         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10618         CHECK(obj != NULL);
10619         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
10620         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10621                 (*env)->ExceptionDescribe(env);
10622                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
10623         }
10624         if (get_jenv_res == JNI_EDETACHED) {
10625                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10626         }
10627 }
10628 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
10629         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10630         JNIEnv *env;
10631         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10632         if (get_jenv_res == JNI_EDETACHED) {
10633                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10634         } else {
10635                 DO_ASSERT(get_jenv_res == JNI_OK);
10636         }
10637         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10638         CHECK(obj != NULL);
10639         jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
10640         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10641                 (*env)->ExceptionDescribe(env);
10642                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
10643         }
10644         LDKCVec_TxidZ ret_constr;
10645         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10646         if (ret_constr.datalen > 0)
10647                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10648         else
10649                 ret_constr.data = NULL;
10650         for (size_t i = 0; i < ret_constr.datalen; i++) {
10651                 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
10652                 LDKThirtyTwoBytes ret_conv_8_ref;
10653                 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
10654                 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
10655                 ret_constr.data[i] = ret_conv_8_ref;
10656         }
10657         if (get_jenv_res == JNI_EDETACHED) {
10658                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10659         }
10660         return ret_constr;
10661 }
10662 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
10663         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
10664         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10665 }
10666 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
10667         jclass c = (*env)->GetObjectClass(env, o);
10668         CHECK(c != NULL);
10669         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
10670         atomic_init(&calls->refcnt, 1);
10671         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10672         calls->o = (*env)->NewWeakGlobalRef(env, o);
10673         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
10674         CHECK(calls->transactions_confirmed_meth != NULL);
10675         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
10676         CHECK(calls->transaction_unconfirmed_meth != NULL);
10677         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
10678         CHECK(calls->best_block_updated_meth != NULL);
10679         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
10680         CHECK(calls->get_relevant_txids_meth != NULL);
10681
10682         LDKConfirm ret = {
10683                 .this_arg = (void*) calls,
10684                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
10685                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
10686                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
10687                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
10688                 .free = LDKConfirm_JCalls_free,
10689         };
10690         return ret;
10691 }
10692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
10693         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
10694         *res_ptr = LDKConfirm_init(env, clz, o);
10695         return tag_ptr(res_ptr, true);
10696 }
10697 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) {
10698         void* this_arg_ptr = untag_ptr(this_arg);
10699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10700         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10701         unsigned char header_arr[80];
10702         CHECK((*env)->GetArrayLength(env, header) == 80);
10703         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10704         unsigned char (*header_ref)[80] = &header_arr;
10705         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10706         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10707         if (txdata_constr.datalen > 0)
10708                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10709         else
10710                 txdata_constr.data = NULL;
10711         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10712         for (size_t c = 0; c < txdata_constr.datalen; c++) {
10713                 int64_t txdata_conv_28 = txdata_vals[c];
10714                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
10715                 CHECK_ACCESS(txdata_conv_28_ptr);
10716                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10717                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
10718                 txdata_constr.data[c] = txdata_conv_28_conv;
10719         }
10720         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10721         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10722 }
10723
10724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
10725         void* this_arg_ptr = untag_ptr(this_arg);
10726         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10727         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10728         unsigned char txid_arr[32];
10729         CHECK((*env)->GetArrayLength(env, txid) == 32);
10730         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10731         unsigned char (*txid_ref)[32] = &txid_arr;
10732         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
10733 }
10734
10735 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) {
10736         void* this_arg_ptr = untag_ptr(this_arg);
10737         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10738         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10739         unsigned char header_arr[80];
10740         CHECK((*env)->GetArrayLength(env, header) == 80);
10741         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10742         unsigned char (*header_ref)[80] = &header_arr;
10743         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
10744 }
10745
10746 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
10747         void* this_arg_ptr = untag_ptr(this_arg);
10748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10749         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10750         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
10751         jobjectArray ret_arr = NULL;
10752         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10753         ;
10754         for (size_t i = 0; i < ret_var.datalen; i++) {
10755                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
10756                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
10757                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10758         }
10759         
10760         FREE(ret_var.data);
10761         return ret_arr;
10762 }
10763
10764 typedef struct LDKPersist_JCalls {
10765         atomic_size_t refcnt;
10766         JavaVM *vm;
10767         jweak o;
10768         jmethodID persist_new_channel_meth;
10769         jmethodID update_persisted_channel_meth;
10770 } LDKPersist_JCalls;
10771 static void LDKPersist_JCalls_free(void* this_arg) {
10772         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10773         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10774                 JNIEnv *env;
10775                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10776                 if (get_jenv_res == JNI_EDETACHED) {
10777                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10778                 } else {
10779                         DO_ASSERT(get_jenv_res == JNI_OK);
10780                 }
10781                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10782                 if (get_jenv_res == JNI_EDETACHED) {
10783                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10784                 }
10785                 FREE(j_calls);
10786         }
10787 }
10788 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10789         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10790         JNIEnv *env;
10791         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10792         if (get_jenv_res == JNI_EDETACHED) {
10793                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10794         } else {
10795                 DO_ASSERT(get_jenv_res == JNI_OK);
10796         }
10797         LDKOutPoint channel_id_var = channel_id;
10798         int64_t channel_id_ref = 0;
10799         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10800         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
10801         LDKChannelMonitor data_var = *data;
10802         int64_t data_ref = 0;
10803         data_var = ChannelMonitor_clone(&data_var);
10804         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10805         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
10806         LDKMonitorUpdateId update_id_var = update_id;
10807         int64_t update_id_ref = 0;
10808         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10809         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
10810         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10811         CHECK(obj != NULL);
10812         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
10813         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10814                 (*env)->ExceptionDescribe(env);
10815                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
10816         }
10817         void* ret_ptr = untag_ptr(ret);
10818         CHECK_ACCESS(ret_ptr);
10819         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10820         FREE(untag_ptr(ret));
10821         if (get_jenv_res == JNI_EDETACHED) {
10822                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10823         }
10824         return ret_conv;
10825 }
10826 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10827         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10828         JNIEnv *env;
10829         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10830         if (get_jenv_res == JNI_EDETACHED) {
10831                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10832         } else {
10833                 DO_ASSERT(get_jenv_res == JNI_OK);
10834         }
10835         LDKOutPoint channel_id_var = channel_id;
10836         int64_t channel_id_ref = 0;
10837         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10838         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
10839         LDKChannelMonitorUpdate update_var = *update;
10840         int64_t update_ref = 0;
10841         update_var = ChannelMonitorUpdate_clone(&update_var);
10842         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
10843         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
10844         LDKChannelMonitor data_var = *data;
10845         int64_t data_ref = 0;
10846         data_var = ChannelMonitor_clone(&data_var);
10847         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10848         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
10849         LDKMonitorUpdateId update_id_var = update_id;
10850         int64_t update_id_ref = 0;
10851         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10852         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
10853         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10854         CHECK(obj != NULL);
10855         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
10856         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10857                 (*env)->ExceptionDescribe(env);
10858                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
10859         }
10860         void* ret_ptr = untag_ptr(ret);
10861         CHECK_ACCESS(ret_ptr);
10862         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10863         FREE(untag_ptr(ret));
10864         if (get_jenv_res == JNI_EDETACHED) {
10865                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10866         }
10867         return ret_conv;
10868 }
10869 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
10870         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
10871         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10872 }
10873 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
10874         jclass c = (*env)->GetObjectClass(env, o);
10875         CHECK(c != NULL);
10876         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
10877         atomic_init(&calls->refcnt, 1);
10878         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10879         calls->o = (*env)->NewWeakGlobalRef(env, o);
10880         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
10881         CHECK(calls->persist_new_channel_meth != NULL);
10882         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
10883         CHECK(calls->update_persisted_channel_meth != NULL);
10884
10885         LDKPersist ret = {
10886                 .this_arg = (void*) calls,
10887                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
10888                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
10889                 .free = LDKPersist_JCalls_free,
10890         };
10891         return ret;
10892 }
10893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
10894         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
10895         *res_ptr = LDKPersist_init(env, clz, o);
10896         return tag_ptr(res_ptr, true);
10897 }
10898 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) {
10899         void* this_arg_ptr = untag_ptr(this_arg);
10900         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10901         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10902         LDKOutPoint channel_id_conv;
10903         channel_id_conv.inner = untag_ptr(channel_id);
10904         channel_id_conv.is_owned = ptr_is_owned(channel_id);
10905         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10906         channel_id_conv = OutPoint_clone(&channel_id_conv);
10907         LDKChannelMonitor data_conv;
10908         data_conv.inner = untag_ptr(data);
10909         data_conv.is_owned = ptr_is_owned(data);
10910         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10911         data_conv.is_owned = false;
10912         LDKMonitorUpdateId update_id_conv;
10913         update_id_conv.inner = untag_ptr(update_id);
10914         update_id_conv.is_owned = ptr_is_owned(update_id);
10915         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10916         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10917         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10918         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
10919         return tag_ptr(ret_conv, true);
10920 }
10921
10922 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) {
10923         void* this_arg_ptr = untag_ptr(this_arg);
10924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10925         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10926         LDKOutPoint channel_id_conv;
10927         channel_id_conv.inner = untag_ptr(channel_id);
10928         channel_id_conv.is_owned = ptr_is_owned(channel_id);
10929         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10930         channel_id_conv = OutPoint_clone(&channel_id_conv);
10931         LDKChannelMonitorUpdate update_conv;
10932         update_conv.inner = untag_ptr(update);
10933         update_conv.is_owned = ptr_is_owned(update);
10934         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
10935         update_conv.is_owned = false;
10936         LDKChannelMonitor data_conv;
10937         data_conv.inner = untag_ptr(data);
10938         data_conv.is_owned = ptr_is_owned(data);
10939         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10940         data_conv.is_owned = false;
10941         LDKMonitorUpdateId update_id_conv;
10942         update_id_conv.inner = untag_ptr(update_id);
10943         update_id_conv.is_owned = ptr_is_owned(update_id);
10944         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10945         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10946         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10947         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
10948         return tag_ptr(ret_conv, true);
10949 }
10950
10951 typedef struct LDKChannelMessageHandler_JCalls {
10952         atomic_size_t refcnt;
10953         JavaVM *vm;
10954         jweak o;
10955         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10956         jmethodID handle_open_channel_meth;
10957         jmethodID handle_accept_channel_meth;
10958         jmethodID handle_funding_created_meth;
10959         jmethodID handle_funding_signed_meth;
10960         jmethodID handle_channel_ready_meth;
10961         jmethodID handle_shutdown_meth;
10962         jmethodID handle_closing_signed_meth;
10963         jmethodID handle_update_add_htlc_meth;
10964         jmethodID handle_update_fulfill_htlc_meth;
10965         jmethodID handle_update_fail_htlc_meth;
10966         jmethodID handle_update_fail_malformed_htlc_meth;
10967         jmethodID handle_commitment_signed_meth;
10968         jmethodID handle_revoke_and_ack_meth;
10969         jmethodID handle_update_fee_meth;
10970         jmethodID handle_announcement_signatures_meth;
10971         jmethodID peer_disconnected_meth;
10972         jmethodID peer_connected_meth;
10973         jmethodID handle_channel_reestablish_meth;
10974         jmethodID handle_channel_update_meth;
10975         jmethodID handle_error_meth;
10976 } LDKChannelMessageHandler_JCalls;
10977 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10978         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10979         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10980                 JNIEnv *env;
10981                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10982                 if (get_jenv_res == JNI_EDETACHED) {
10983                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10984                 } else {
10985                         DO_ASSERT(get_jenv_res == JNI_OK);
10986                 }
10987                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10988                 if (get_jenv_res == JNI_EDETACHED) {
10989                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10990                 }
10991                 FREE(j_calls);
10992         }
10993 }
10994 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
10995         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10996         JNIEnv *env;
10997         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10998         if (get_jenv_res == JNI_EDETACHED) {
10999                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11000         } else {
11001                 DO_ASSERT(get_jenv_res == JNI_OK);
11002         }
11003         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11004         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11005         LDKInitFeatures their_features_var = their_features;
11006         int64_t their_features_ref = 0;
11007         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11008         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11009         LDKOpenChannel msg_var = *msg;
11010         int64_t msg_ref = 0;
11011         msg_var = OpenChannel_clone(&msg_var);
11012         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11013         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11014         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11015         CHECK(obj != NULL);
11016         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11017         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11018                 (*env)->ExceptionDescribe(env);
11019                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
11020         }
11021         if (get_jenv_res == JNI_EDETACHED) {
11022                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11023         }
11024 }
11025 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
11026         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11027         JNIEnv *env;
11028         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11029         if (get_jenv_res == JNI_EDETACHED) {
11030                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11031         } else {
11032                 DO_ASSERT(get_jenv_res == JNI_OK);
11033         }
11034         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11035         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11036         LDKInitFeatures their_features_var = their_features;
11037         int64_t their_features_ref = 0;
11038         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11039         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11040         LDKAcceptChannel msg_var = *msg;
11041         int64_t msg_ref = 0;
11042         msg_var = AcceptChannel_clone(&msg_var);
11043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11044         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11045         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11046         CHECK(obj != NULL);
11047         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
11048         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11049                 (*env)->ExceptionDescribe(env);
11050                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
11051         }
11052         if (get_jenv_res == JNI_EDETACHED) {
11053                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11054         }
11055 }
11056 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
11057         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11058         JNIEnv *env;
11059         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11060         if (get_jenv_res == JNI_EDETACHED) {
11061                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11062         } else {
11063                 DO_ASSERT(get_jenv_res == JNI_OK);
11064         }
11065         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11066         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11067         LDKFundingCreated msg_var = *msg;
11068         int64_t msg_ref = 0;
11069         msg_var = FundingCreated_clone(&msg_var);
11070         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11071         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11072         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11073         CHECK(obj != NULL);
11074         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
11075         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11076                 (*env)->ExceptionDescribe(env);
11077                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
11078         }
11079         if (get_jenv_res == JNI_EDETACHED) {
11080                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11081         }
11082 }
11083 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
11084         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11085         JNIEnv *env;
11086         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11087         if (get_jenv_res == JNI_EDETACHED) {
11088                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11089         } else {
11090                 DO_ASSERT(get_jenv_res == JNI_OK);
11091         }
11092         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11093         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11094         LDKFundingSigned msg_var = *msg;
11095         int64_t msg_ref = 0;
11096         msg_var = FundingSigned_clone(&msg_var);
11097         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11098         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11099         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11100         CHECK(obj != NULL);
11101         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
11102         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11103                 (*env)->ExceptionDescribe(env);
11104                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
11105         }
11106         if (get_jenv_res == JNI_EDETACHED) {
11107                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11108         }
11109 }
11110 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
11111         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11112         JNIEnv *env;
11113         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11114         if (get_jenv_res == JNI_EDETACHED) {
11115                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11116         } else {
11117                 DO_ASSERT(get_jenv_res == JNI_OK);
11118         }
11119         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11120         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11121         LDKChannelReady msg_var = *msg;
11122         int64_t msg_ref = 0;
11123         msg_var = ChannelReady_clone(&msg_var);
11124         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11125         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11126         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11127         CHECK(obj != NULL);
11128         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
11129         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11130                 (*env)->ExceptionDescribe(env);
11131                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
11132         }
11133         if (get_jenv_res == JNI_EDETACHED) {
11134                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11135         }
11136 }
11137 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
11138         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11139         JNIEnv *env;
11140         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11141         if (get_jenv_res == JNI_EDETACHED) {
11142                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11143         } else {
11144                 DO_ASSERT(get_jenv_res == JNI_OK);
11145         }
11146         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11147         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11148         LDKInitFeatures their_features_var = *their_features;
11149         int64_t their_features_ref = 0;
11150         their_features_var = InitFeatures_clone(&their_features_var);
11151         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11152         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
11153         LDKShutdown msg_var = *msg;
11154         int64_t msg_ref = 0;
11155         msg_var = Shutdown_clone(&msg_var);
11156         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11157         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11158         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11159         CHECK(obj != NULL);
11160         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
11161         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11162                 (*env)->ExceptionDescribe(env);
11163                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
11164         }
11165         if (get_jenv_res == JNI_EDETACHED) {
11166                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11167         }
11168 }
11169 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11170         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11171         JNIEnv *env;
11172         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11173         if (get_jenv_res == JNI_EDETACHED) {
11174                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11175         } else {
11176                 DO_ASSERT(get_jenv_res == JNI_OK);
11177         }
11178         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11179         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11180         LDKClosingSigned msg_var = *msg;
11181         int64_t msg_ref = 0;
11182         msg_var = ClosingSigned_clone(&msg_var);
11183         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11184         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11185         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11186         CHECK(obj != NULL);
11187         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
11188         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11189                 (*env)->ExceptionDescribe(env);
11190                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
11191         }
11192         if (get_jenv_res == JNI_EDETACHED) {
11193                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11194         }
11195 }
11196 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11197         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11198         JNIEnv *env;
11199         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11200         if (get_jenv_res == JNI_EDETACHED) {
11201                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11202         } else {
11203                 DO_ASSERT(get_jenv_res == JNI_OK);
11204         }
11205         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11206         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11207         LDKUpdateAddHTLC msg_var = *msg;
11208         int64_t msg_ref = 0;
11209         msg_var = UpdateAddHTLC_clone(&msg_var);
11210         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11211         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11212         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11213         CHECK(obj != NULL);
11214         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11215         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11216                 (*env)->ExceptionDescribe(env);
11217                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11218         }
11219         if (get_jenv_res == JNI_EDETACHED) {
11220                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11221         }
11222 }
11223 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11224         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11225         JNIEnv *env;
11226         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11227         if (get_jenv_res == JNI_EDETACHED) {
11228                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11229         } else {
11230                 DO_ASSERT(get_jenv_res == JNI_OK);
11231         }
11232         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11233         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11234         LDKUpdateFulfillHTLC msg_var = *msg;
11235         int64_t msg_ref = 0;
11236         msg_var = UpdateFulfillHTLC_clone(&msg_var);
11237         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11238         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11239         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11240         CHECK(obj != NULL);
11241         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11242         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11243                 (*env)->ExceptionDescribe(env);
11244                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11245         }
11246         if (get_jenv_res == JNI_EDETACHED) {
11247                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11248         }
11249 }
11250 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11251         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11252         JNIEnv *env;
11253         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11254         if (get_jenv_res == JNI_EDETACHED) {
11255                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11256         } else {
11257                 DO_ASSERT(get_jenv_res == JNI_OK);
11258         }
11259         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11260         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11261         LDKUpdateFailHTLC msg_var = *msg;
11262         int64_t msg_ref = 0;
11263         msg_var = UpdateFailHTLC_clone(&msg_var);
11264         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11265         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11266         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11267         CHECK(obj != NULL);
11268         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11269         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11270                 (*env)->ExceptionDescribe(env);
11271                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11272         }
11273         if (get_jenv_res == JNI_EDETACHED) {
11274                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11275         }
11276 }
11277 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11278         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11279         JNIEnv *env;
11280         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11281         if (get_jenv_res == JNI_EDETACHED) {
11282                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11283         } else {
11284                 DO_ASSERT(get_jenv_res == JNI_OK);
11285         }
11286         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11287         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11288         LDKUpdateFailMalformedHTLC msg_var = *msg;
11289         int64_t msg_ref = 0;
11290         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11291         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11292         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11293         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11294         CHECK(obj != NULL);
11295         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
11296         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11297                 (*env)->ExceptionDescribe(env);
11298                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
11299         }
11300         if (get_jenv_res == JNI_EDETACHED) {
11301                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11302         }
11303 }
11304 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11305         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11306         JNIEnv *env;
11307         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11308         if (get_jenv_res == JNI_EDETACHED) {
11309                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11310         } else {
11311                 DO_ASSERT(get_jenv_res == JNI_OK);
11312         }
11313         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11314         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11315         LDKCommitmentSigned msg_var = *msg;
11316         int64_t msg_ref = 0;
11317         msg_var = CommitmentSigned_clone(&msg_var);
11318         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11319         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11320         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11321         CHECK(obj != NULL);
11322         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
11323         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11324                 (*env)->ExceptionDescribe(env);
11325                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
11326         }
11327         if (get_jenv_res == JNI_EDETACHED) {
11328                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11329         }
11330 }
11331 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11332         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11333         JNIEnv *env;
11334         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11335         if (get_jenv_res == JNI_EDETACHED) {
11336                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11337         } else {
11338                 DO_ASSERT(get_jenv_res == JNI_OK);
11339         }
11340         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11341         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11342         LDKRevokeAndACK msg_var = *msg;
11343         int64_t msg_ref = 0;
11344         msg_var = RevokeAndACK_clone(&msg_var);
11345         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11346         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11347         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11348         CHECK(obj != NULL);
11349         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
11350         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11351                 (*env)->ExceptionDescribe(env);
11352                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
11353         }
11354         if (get_jenv_res == JNI_EDETACHED) {
11355                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11356         }
11357 }
11358 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11359         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11360         JNIEnv *env;
11361         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11362         if (get_jenv_res == JNI_EDETACHED) {
11363                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11364         } else {
11365                 DO_ASSERT(get_jenv_res == JNI_OK);
11366         }
11367         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11368         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11369         LDKUpdateFee msg_var = *msg;
11370         int64_t msg_ref = 0;
11371         msg_var = UpdateFee_clone(&msg_var);
11372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11373         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11374         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11375         CHECK(obj != NULL);
11376         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
11377         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11378                 (*env)->ExceptionDescribe(env);
11379                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
11380         }
11381         if (get_jenv_res == JNI_EDETACHED) {
11382                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11383         }
11384 }
11385 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11386         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11387         JNIEnv *env;
11388         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11389         if (get_jenv_res == JNI_EDETACHED) {
11390                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11391         } else {
11392                 DO_ASSERT(get_jenv_res == JNI_OK);
11393         }
11394         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11395         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11396         LDKAnnouncementSignatures msg_var = *msg;
11397         int64_t msg_ref = 0;
11398         msg_var = AnnouncementSignatures_clone(&msg_var);
11399         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11400         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11402         CHECK(obj != NULL);
11403         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
11404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11405                 (*env)->ExceptionDescribe(env);
11406                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
11407         }
11408         if (get_jenv_res == JNI_EDETACHED) {
11409                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11410         }
11411 }
11412 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
11413         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11414         JNIEnv *env;
11415         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11416         if (get_jenv_res == JNI_EDETACHED) {
11417                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11418         } else {
11419                 DO_ASSERT(get_jenv_res == JNI_OK);
11420         }
11421         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11422         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11423         jboolean no_connection_possible_conv = no_connection_possible;
11424         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11425         CHECK(obj != NULL);
11426         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
11427         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11428                 (*env)->ExceptionDescribe(env);
11429                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
11430         }
11431         if (get_jenv_res == JNI_EDETACHED) {
11432                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11433         }
11434 }
11435 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
11436         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11437         JNIEnv *env;
11438         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11439         if (get_jenv_res == JNI_EDETACHED) {
11440                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11441         } else {
11442                 DO_ASSERT(get_jenv_res == JNI_OK);
11443         }
11444         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11445         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11446         LDKInit msg_var = *msg;
11447         int64_t msg_ref = 0;
11448         msg_var = Init_clone(&msg_var);
11449         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11450         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11451         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11452         CHECK(obj != NULL);
11453         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
11454         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11455                 (*env)->ExceptionDescribe(env);
11456                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
11457         }
11458         if (get_jenv_res == JNI_EDETACHED) {
11459                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11460         }
11461 }
11462 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
11463         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11464         JNIEnv *env;
11465         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11466         if (get_jenv_res == JNI_EDETACHED) {
11467                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11468         } else {
11469                 DO_ASSERT(get_jenv_res == JNI_OK);
11470         }
11471         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11472         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11473         LDKChannelReestablish msg_var = *msg;
11474         int64_t msg_ref = 0;
11475         msg_var = ChannelReestablish_clone(&msg_var);
11476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11477         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11478         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11479         CHECK(obj != NULL);
11480         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
11481         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11482                 (*env)->ExceptionDescribe(env);
11483                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
11484         }
11485         if (get_jenv_res == JNI_EDETACHED) {
11486                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11487         }
11488 }
11489 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11490         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11491         JNIEnv *env;
11492         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11493         if (get_jenv_res == JNI_EDETACHED) {
11494                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11495         } else {
11496                 DO_ASSERT(get_jenv_res == JNI_OK);
11497         }
11498         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11499         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11500         LDKChannelUpdate msg_var = *msg;
11501         int64_t msg_ref = 0;
11502         msg_var = ChannelUpdate_clone(&msg_var);
11503         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11504         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11505         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11506         CHECK(obj != NULL);
11507         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
11508         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11509                 (*env)->ExceptionDescribe(env);
11510                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
11511         }
11512         if (get_jenv_res == JNI_EDETACHED) {
11513                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11514         }
11515 }
11516 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11517         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11518         JNIEnv *env;
11519         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11520         if (get_jenv_res == JNI_EDETACHED) {
11521                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11522         } else {
11523                 DO_ASSERT(get_jenv_res == JNI_OK);
11524         }
11525         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11526         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11527         LDKErrorMessage msg_var = *msg;
11528         int64_t msg_ref = 0;
11529         msg_var = ErrorMessage_clone(&msg_var);
11530         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11531         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11532         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11533         CHECK(obj != NULL);
11534         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
11535         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11536                 (*env)->ExceptionDescribe(env);
11537                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
11538         }
11539         if (get_jenv_res == JNI_EDETACHED) {
11540                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11541         }
11542 }
11543 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11544         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11545         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11546         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11547 }
11548 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11549         jclass c = (*env)->GetObjectClass(env, o);
11550         CHECK(c != NULL);
11551         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11552         atomic_init(&calls->refcnt, 1);
11553         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11554         calls->o = (*env)->NewWeakGlobalRef(env, o);
11555         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
11556         CHECK(calls->handle_open_channel_meth != NULL);
11557         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
11558         CHECK(calls->handle_accept_channel_meth != NULL);
11559         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
11560         CHECK(calls->handle_funding_created_meth != NULL);
11561         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
11562         CHECK(calls->handle_funding_signed_meth != NULL);
11563         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
11564         CHECK(calls->handle_channel_ready_meth != NULL);
11565         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
11566         CHECK(calls->handle_shutdown_meth != NULL);
11567         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
11568         CHECK(calls->handle_closing_signed_meth != NULL);
11569         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
11570         CHECK(calls->handle_update_add_htlc_meth != NULL);
11571         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
11572         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
11573         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
11574         CHECK(calls->handle_update_fail_htlc_meth != NULL);
11575         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
11576         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
11577         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
11578         CHECK(calls->handle_commitment_signed_meth != NULL);
11579         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
11580         CHECK(calls->handle_revoke_and_ack_meth != NULL);
11581         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
11582         CHECK(calls->handle_update_fee_meth != NULL);
11583         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
11584         CHECK(calls->handle_announcement_signatures_meth != NULL);
11585         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
11586         CHECK(calls->peer_disconnected_meth != NULL);
11587         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
11588         CHECK(calls->peer_connected_meth != NULL);
11589         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
11590         CHECK(calls->handle_channel_reestablish_meth != NULL);
11591         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
11592         CHECK(calls->handle_channel_update_meth != NULL);
11593         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
11594         CHECK(calls->handle_error_meth != NULL);
11595
11596         LDKChannelMessageHandler ret = {
11597                 .this_arg = (void*) calls,
11598                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11599                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11600                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
11601                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
11602                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
11603                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
11604                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
11605                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
11606                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
11607                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
11608                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
11609                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
11610                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
11611                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
11612                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
11613                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
11614                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
11615                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
11616                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
11617                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
11618                 .free = LDKChannelMessageHandler_JCalls_free,
11619                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11620         };
11621         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11622         return ret;
11623 }
11624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11625         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11626         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11627         return tag_ptr(res_ptr, true);
11628 }
11629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11630         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
11631         return tag_ptr(&inp->MessageSendEventsProvider, false);
11632 }
11633 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) {
11634         void* this_arg_ptr = untag_ptr(this_arg);
11635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11636         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11637         LDKPublicKey their_node_id_ref;
11638         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11639         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11640         LDKInitFeatures their_features_conv;
11641         their_features_conv.inner = untag_ptr(their_features);
11642         their_features_conv.is_owned = ptr_is_owned(their_features);
11643         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11644         their_features_conv = InitFeatures_clone(&their_features_conv);
11645         LDKOpenChannel msg_conv;
11646         msg_conv.inner = untag_ptr(msg);
11647         msg_conv.is_owned = ptr_is_owned(msg);
11648         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11649         msg_conv.is_owned = false;
11650         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11651 }
11652
11653 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) {
11654         void* this_arg_ptr = untag_ptr(this_arg);
11655         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11656         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11657         LDKPublicKey their_node_id_ref;
11658         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11659         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11660         LDKInitFeatures their_features_conv;
11661         their_features_conv.inner = untag_ptr(their_features);
11662         their_features_conv.is_owned = ptr_is_owned(their_features);
11663         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11664         their_features_conv = InitFeatures_clone(&their_features_conv);
11665         LDKAcceptChannel msg_conv;
11666         msg_conv.inner = untag_ptr(msg);
11667         msg_conv.is_owned = ptr_is_owned(msg);
11668         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11669         msg_conv.is_owned = false;
11670         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11671 }
11672
11673 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) {
11674         void* this_arg_ptr = untag_ptr(this_arg);
11675         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11676         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11677         LDKPublicKey their_node_id_ref;
11678         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11679         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11680         LDKFundingCreated msg_conv;
11681         msg_conv.inner = untag_ptr(msg);
11682         msg_conv.is_owned = ptr_is_owned(msg);
11683         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11684         msg_conv.is_owned = false;
11685         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11686 }
11687
11688 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) {
11689         void* this_arg_ptr = untag_ptr(this_arg);
11690         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11691         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11692         LDKPublicKey their_node_id_ref;
11693         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11694         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11695         LDKFundingSigned msg_conv;
11696         msg_conv.inner = untag_ptr(msg);
11697         msg_conv.is_owned = ptr_is_owned(msg);
11698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11699         msg_conv.is_owned = false;
11700         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11701 }
11702
11703 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) {
11704         void* this_arg_ptr = untag_ptr(this_arg);
11705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11706         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11707         LDKPublicKey their_node_id_ref;
11708         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11709         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11710         LDKChannelReady msg_conv;
11711         msg_conv.inner = untag_ptr(msg);
11712         msg_conv.is_owned = ptr_is_owned(msg);
11713         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11714         msg_conv.is_owned = false;
11715         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11716 }
11717
11718 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) {
11719         void* this_arg_ptr = untag_ptr(this_arg);
11720         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11721         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11722         LDKPublicKey their_node_id_ref;
11723         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11724         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11725         LDKInitFeatures their_features_conv;
11726         their_features_conv.inner = untag_ptr(their_features);
11727         their_features_conv.is_owned = ptr_is_owned(their_features);
11728         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11729         their_features_conv.is_owned = false;
11730         LDKShutdown msg_conv;
11731         msg_conv.inner = untag_ptr(msg);
11732         msg_conv.is_owned = ptr_is_owned(msg);
11733         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11734         msg_conv.is_owned = false;
11735         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
11736 }
11737
11738 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) {
11739         void* this_arg_ptr = untag_ptr(this_arg);
11740         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11741         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11742         LDKPublicKey their_node_id_ref;
11743         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11744         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11745         LDKClosingSigned msg_conv;
11746         msg_conv.inner = untag_ptr(msg);
11747         msg_conv.is_owned = ptr_is_owned(msg);
11748         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11749         msg_conv.is_owned = false;
11750         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11751 }
11752
11753 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) {
11754         void* this_arg_ptr = untag_ptr(this_arg);
11755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11756         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11757         LDKPublicKey their_node_id_ref;
11758         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11759         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11760         LDKUpdateAddHTLC msg_conv;
11761         msg_conv.inner = untag_ptr(msg);
11762         msg_conv.is_owned = ptr_is_owned(msg);
11763         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11764         msg_conv.is_owned = false;
11765         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11766 }
11767
11768 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) {
11769         void* this_arg_ptr = untag_ptr(this_arg);
11770         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11771         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11772         LDKPublicKey their_node_id_ref;
11773         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11774         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11775         LDKUpdateFulfillHTLC msg_conv;
11776         msg_conv.inner = untag_ptr(msg);
11777         msg_conv.is_owned = ptr_is_owned(msg);
11778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11779         msg_conv.is_owned = false;
11780         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11781 }
11782
11783 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) {
11784         void* this_arg_ptr = untag_ptr(this_arg);
11785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11786         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11787         LDKPublicKey their_node_id_ref;
11788         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11789         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11790         LDKUpdateFailHTLC msg_conv;
11791         msg_conv.inner = untag_ptr(msg);
11792         msg_conv.is_owned = ptr_is_owned(msg);
11793         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11794         msg_conv.is_owned = false;
11795         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11796 }
11797
11798 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) {
11799         void* this_arg_ptr = untag_ptr(this_arg);
11800         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11801         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11802         LDKPublicKey their_node_id_ref;
11803         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11804         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11805         LDKUpdateFailMalformedHTLC msg_conv;
11806         msg_conv.inner = untag_ptr(msg);
11807         msg_conv.is_owned = ptr_is_owned(msg);
11808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11809         msg_conv.is_owned = false;
11810         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11811 }
11812
11813 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) {
11814         void* this_arg_ptr = untag_ptr(this_arg);
11815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11816         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11817         LDKPublicKey their_node_id_ref;
11818         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11819         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11820         LDKCommitmentSigned msg_conv;
11821         msg_conv.inner = untag_ptr(msg);
11822         msg_conv.is_owned = ptr_is_owned(msg);
11823         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11824         msg_conv.is_owned = false;
11825         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11826 }
11827
11828 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) {
11829         void* this_arg_ptr = untag_ptr(this_arg);
11830         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11831         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11832         LDKPublicKey their_node_id_ref;
11833         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11834         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11835         LDKRevokeAndACK msg_conv;
11836         msg_conv.inner = untag_ptr(msg);
11837         msg_conv.is_owned = ptr_is_owned(msg);
11838         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11839         msg_conv.is_owned = false;
11840         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11841 }
11842
11843 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) {
11844         void* this_arg_ptr = untag_ptr(this_arg);
11845         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11846         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11847         LDKPublicKey their_node_id_ref;
11848         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11849         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11850         LDKUpdateFee msg_conv;
11851         msg_conv.inner = untag_ptr(msg);
11852         msg_conv.is_owned = ptr_is_owned(msg);
11853         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11854         msg_conv.is_owned = false;
11855         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11856 }
11857
11858 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) {
11859         void* this_arg_ptr = untag_ptr(this_arg);
11860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11861         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11862         LDKPublicKey their_node_id_ref;
11863         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11864         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11865         LDKAnnouncementSignatures msg_conv;
11866         msg_conv.inner = untag_ptr(msg);
11867         msg_conv.is_owned = ptr_is_owned(msg);
11868         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11869         msg_conv.is_owned = false;
11870         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11871 }
11872
11873 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) {
11874         void* this_arg_ptr = untag_ptr(this_arg);
11875         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11876         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11877         LDKPublicKey their_node_id_ref;
11878         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11879         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11880         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
11881 }
11882
11883 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) {
11884         void* this_arg_ptr = untag_ptr(this_arg);
11885         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11886         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11887         LDKPublicKey their_node_id_ref;
11888         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11889         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11890         LDKInit msg_conv;
11891         msg_conv.inner = untag_ptr(msg);
11892         msg_conv.is_owned = ptr_is_owned(msg);
11893         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11894         msg_conv.is_owned = false;
11895         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11896 }
11897
11898 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) {
11899         void* this_arg_ptr = untag_ptr(this_arg);
11900         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11901         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11902         LDKPublicKey their_node_id_ref;
11903         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11904         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11905         LDKChannelReestablish msg_conv;
11906         msg_conv.inner = untag_ptr(msg);
11907         msg_conv.is_owned = ptr_is_owned(msg);
11908         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11909         msg_conv.is_owned = false;
11910         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11911 }
11912
11913 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) {
11914         void* this_arg_ptr = untag_ptr(this_arg);
11915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11916         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11917         LDKPublicKey their_node_id_ref;
11918         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11919         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11920         LDKChannelUpdate msg_conv;
11921         msg_conv.inner = untag_ptr(msg);
11922         msg_conv.is_owned = ptr_is_owned(msg);
11923         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11924         msg_conv.is_owned = false;
11925         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11926 }
11927
11928 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) {
11929         void* this_arg_ptr = untag_ptr(this_arg);
11930         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11931         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11932         LDKPublicKey their_node_id_ref;
11933         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11934         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11935         LDKErrorMessage msg_conv;
11936         msg_conv.inner = untag_ptr(msg);
11937         msg_conv.is_owned = ptr_is_owned(msg);
11938         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11939         msg_conv.is_owned = false;
11940         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11941 }
11942
11943 typedef struct LDKRoutingMessageHandler_JCalls {
11944         atomic_size_t refcnt;
11945         JavaVM *vm;
11946         jweak o;
11947         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11948         jmethodID handle_node_announcement_meth;
11949         jmethodID handle_channel_announcement_meth;
11950         jmethodID handle_channel_update_meth;
11951         jmethodID get_next_channel_announcements_meth;
11952         jmethodID get_next_node_announcements_meth;
11953         jmethodID peer_connected_meth;
11954         jmethodID handle_reply_channel_range_meth;
11955         jmethodID handle_reply_short_channel_ids_end_meth;
11956         jmethodID handle_query_channel_range_meth;
11957         jmethodID handle_query_short_channel_ids_meth;
11958 } LDKRoutingMessageHandler_JCalls;
11959 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11960         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11961         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11962                 JNIEnv *env;
11963                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11964                 if (get_jenv_res == JNI_EDETACHED) {
11965                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11966                 } else {
11967                         DO_ASSERT(get_jenv_res == JNI_OK);
11968                 }
11969                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11970                 if (get_jenv_res == JNI_EDETACHED) {
11971                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11972                 }
11973                 FREE(j_calls);
11974         }
11975 }
11976 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11977         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11978         JNIEnv *env;
11979         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11980         if (get_jenv_res == JNI_EDETACHED) {
11981                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11982         } else {
11983                 DO_ASSERT(get_jenv_res == JNI_OK);
11984         }
11985         LDKNodeAnnouncement msg_var = *msg;
11986         int64_t msg_ref = 0;
11987         msg_var = NodeAnnouncement_clone(&msg_var);
11988         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11989         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11990         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11991         CHECK(obj != NULL);
11992         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11993         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11994                 (*env)->ExceptionDescribe(env);
11995                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11996         }
11997         void* ret_ptr = untag_ptr(ret);
11998         CHECK_ACCESS(ret_ptr);
11999         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12000         FREE(untag_ptr(ret));
12001         if (get_jenv_res == JNI_EDETACHED) {
12002                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12003         }
12004         return ret_conv;
12005 }
12006 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
12007         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12008         JNIEnv *env;
12009         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12010         if (get_jenv_res == JNI_EDETACHED) {
12011                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12012         } else {
12013                 DO_ASSERT(get_jenv_res == JNI_OK);
12014         }
12015         LDKChannelAnnouncement msg_var = *msg;
12016         int64_t msg_ref = 0;
12017         msg_var = ChannelAnnouncement_clone(&msg_var);
12018         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12019         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12020         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12021         CHECK(obj != NULL);
12022         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
12023         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12024                 (*env)->ExceptionDescribe(env);
12025                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
12026         }
12027         void* ret_ptr = untag_ptr(ret);
12028         CHECK_ACCESS(ret_ptr);
12029         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12030         FREE(untag_ptr(ret));
12031         if (get_jenv_res == JNI_EDETACHED) {
12032                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12033         }
12034         return ret_conv;
12035 }
12036 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
12037         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12038         JNIEnv *env;
12039         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12040         if (get_jenv_res == JNI_EDETACHED) {
12041                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12042         } else {
12043                 DO_ASSERT(get_jenv_res == JNI_OK);
12044         }
12045         LDKChannelUpdate msg_var = *msg;
12046         int64_t msg_ref = 0;
12047         msg_var = ChannelUpdate_clone(&msg_var);
12048         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12049         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12050         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12051         CHECK(obj != NULL);
12052         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
12053         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12054                 (*env)->ExceptionDescribe(env);
12055                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
12056         }
12057         void* ret_ptr = untag_ptr(ret);
12058         CHECK_ACCESS(ret_ptr);
12059         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12060         FREE(untag_ptr(ret));
12061         if (get_jenv_res == JNI_EDETACHED) {
12062                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12063         }
12064         return ret_conv;
12065 }
12066 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
12067         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12068         JNIEnv *env;
12069         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12070         if (get_jenv_res == JNI_EDETACHED) {
12071                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12072         } else {
12073                 DO_ASSERT(get_jenv_res == JNI_OK);
12074         }
12075         int64_t starting_point_conv = starting_point;
12076         int8_t batch_amount_conv = batch_amount;
12077         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12078         CHECK(obj != NULL);
12079         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
12080         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12081                 (*env)->ExceptionDescribe(env);
12082                 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12083         }
12084         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
12085         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12086         if (ret_constr.datalen > 0)
12087                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
12088         else
12089                 ret_constr.data = NULL;
12090         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12091         for (size_t h = 0; h < ret_constr.datalen; h++) {
12092                 int64_t ret_conv_59 = ret_vals[h];
12093                 void* ret_conv_59_ptr = untag_ptr(ret_conv_59);
12094                 CHECK_ACCESS(ret_conv_59_ptr);
12095                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
12096                 FREE(untag_ptr(ret_conv_59));
12097                 ret_constr.data[h] = ret_conv_59_conv;
12098         }
12099         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12100         if (get_jenv_res == JNI_EDETACHED) {
12101                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12102         }
12103         return ret_constr;
12104 }
12105 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
12106         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12107         JNIEnv *env;
12108         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12109         if (get_jenv_res == JNI_EDETACHED) {
12110                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12111         } else {
12112                 DO_ASSERT(get_jenv_res == JNI_OK);
12113         }
12114         int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
12115         (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
12116         int8_t batch_amount_conv = batch_amount;
12117         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12118         CHECK(obj != NULL);
12119         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
12120         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12121                 (*env)->ExceptionDescribe(env);
12122                 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12123         }
12124         LDKCVec_NodeAnnouncementZ ret_constr;
12125         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12126         if (ret_constr.datalen > 0)
12127                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12128         else
12129                 ret_constr.data = NULL;
12130         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12131         for (size_t s = 0; s < ret_constr.datalen; s++) {
12132                 int64_t ret_conv_18 = ret_vals[s];
12133                 LDKNodeAnnouncement ret_conv_18_conv;
12134                 ret_conv_18_conv.inner = untag_ptr(ret_conv_18);
12135                 ret_conv_18_conv.is_owned = ptr_is_owned(ret_conv_18);
12136                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
12137                 ret_constr.data[s] = ret_conv_18_conv;
12138         }
12139         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12140         if (get_jenv_res == JNI_EDETACHED) {
12141                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12142         }
12143         return ret_constr;
12144 }
12145 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
12146         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12147         JNIEnv *env;
12148         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12149         if (get_jenv_res == JNI_EDETACHED) {
12150                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12151         } else {
12152                 DO_ASSERT(get_jenv_res == JNI_OK);
12153         }
12154         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12155         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12156         LDKInit init_var = *init;
12157         int64_t init_ref = 0;
12158         init_var = Init_clone(&init_var);
12159         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12160         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
12161         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12162         CHECK(obj != NULL);
12163         (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
12164         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12165                 (*env)->ExceptionDescribe(env);
12166                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
12167         }
12168         if (get_jenv_res == JNI_EDETACHED) {
12169                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12170         }
12171 }
12172 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12173         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12174         JNIEnv *env;
12175         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12176         if (get_jenv_res == JNI_EDETACHED) {
12177                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12178         } else {
12179                 DO_ASSERT(get_jenv_res == JNI_OK);
12180         }
12181         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12182         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12183         LDKReplyChannelRange msg_var = msg;
12184         int64_t msg_ref = 0;
12185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12186         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12187         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12188         CHECK(obj != NULL);
12189         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
12190         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12191                 (*env)->ExceptionDescribe(env);
12192                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12193         }
12194         void* ret_ptr = untag_ptr(ret);
12195         CHECK_ACCESS(ret_ptr);
12196         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12197         FREE(untag_ptr(ret));
12198         if (get_jenv_res == JNI_EDETACHED) {
12199                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12200         }
12201         return ret_conv;
12202 }
12203 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12204         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12205         JNIEnv *env;
12206         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12207         if (get_jenv_res == JNI_EDETACHED) {
12208                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12209         } else {
12210                 DO_ASSERT(get_jenv_res == JNI_OK);
12211         }
12212         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12213         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12214         LDKReplyShortChannelIdsEnd msg_var = msg;
12215         int64_t msg_ref = 0;
12216         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12217         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12218         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12219         CHECK(obj != NULL);
12220         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
12221         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12222                 (*env)->ExceptionDescribe(env);
12223                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
12224         }
12225         void* ret_ptr = untag_ptr(ret);
12226         CHECK_ACCESS(ret_ptr);
12227         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12228         FREE(untag_ptr(ret));
12229         if (get_jenv_res == JNI_EDETACHED) {
12230                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12231         }
12232         return ret_conv;
12233 }
12234 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12235         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12236         JNIEnv *env;
12237         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12238         if (get_jenv_res == JNI_EDETACHED) {
12239                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12240         } else {
12241                 DO_ASSERT(get_jenv_res == JNI_OK);
12242         }
12243         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12244         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12245         LDKQueryChannelRange msg_var = msg;
12246         int64_t msg_ref = 0;
12247         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12248         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12249         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12250         CHECK(obj != NULL);
12251         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
12252         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12253                 (*env)->ExceptionDescribe(env);
12254                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12255         }
12256         void* ret_ptr = untag_ptr(ret);
12257         CHECK_ACCESS(ret_ptr);
12258         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12259         FREE(untag_ptr(ret));
12260         if (get_jenv_res == JNI_EDETACHED) {
12261                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12262         }
12263         return ret_conv;
12264 }
12265 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12266         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12267         JNIEnv *env;
12268         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12269         if (get_jenv_res == JNI_EDETACHED) {
12270                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12271         } else {
12272                 DO_ASSERT(get_jenv_res == JNI_OK);
12273         }
12274         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12275         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12276         LDKQueryShortChannelIds msg_var = msg;
12277         int64_t msg_ref = 0;
12278         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12279         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12280         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12281         CHECK(obj != NULL);
12282         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
12283         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12284                 (*env)->ExceptionDescribe(env);
12285                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
12286         }
12287         void* ret_ptr = untag_ptr(ret);
12288         CHECK_ACCESS(ret_ptr);
12289         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12290         FREE(untag_ptr(ret));
12291         if (get_jenv_res == JNI_EDETACHED) {
12292                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12293         }
12294         return ret_conv;
12295 }
12296 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12297         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12298         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12299         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12300 }
12301 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12302         jclass c = (*env)->GetObjectClass(env, o);
12303         CHECK(c != NULL);
12304         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12305         atomic_init(&calls->refcnt, 1);
12306         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12307         calls->o = (*env)->NewWeakGlobalRef(env, o);
12308         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
12309         CHECK(calls->handle_node_announcement_meth != NULL);
12310         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
12311         CHECK(calls->handle_channel_announcement_meth != NULL);
12312         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
12313         CHECK(calls->handle_channel_update_meth != NULL);
12314         calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
12315         CHECK(calls->get_next_channel_announcements_meth != NULL);
12316         calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
12317         CHECK(calls->get_next_node_announcements_meth != NULL);
12318         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12319         CHECK(calls->peer_connected_meth != NULL);
12320         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
12321         CHECK(calls->handle_reply_channel_range_meth != NULL);
12322         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
12323         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
12324         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
12325         CHECK(calls->handle_query_channel_range_meth != NULL);
12326         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
12327         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
12328
12329         LDKRoutingMessageHandler ret = {
12330                 .this_arg = (void*) calls,
12331                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12332                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12333                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12334                 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
12335                 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
12336                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12337                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12338                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12339                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12340                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12341                 .free = LDKRoutingMessageHandler_JCalls_free,
12342                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12343         };
12344         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12345         return ret;
12346 }
12347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12348         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12349         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12350         return tag_ptr(res_ptr, true);
12351 }
12352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12353         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
12354         return tag_ptr(&inp->MessageSendEventsProvider, false);
12355 }
12356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12357         void* this_arg_ptr = untag_ptr(this_arg);
12358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12359         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12360         LDKNodeAnnouncement msg_conv;
12361         msg_conv.inner = untag_ptr(msg);
12362         msg_conv.is_owned = ptr_is_owned(msg);
12363         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12364         msg_conv.is_owned = false;
12365         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12366         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12367         return tag_ptr(ret_conv, true);
12368 }
12369
12370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12371         void* this_arg_ptr = untag_ptr(this_arg);
12372         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12373         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12374         LDKChannelAnnouncement msg_conv;
12375         msg_conv.inner = untag_ptr(msg);
12376         msg_conv.is_owned = ptr_is_owned(msg);
12377         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12378         msg_conv.is_owned = false;
12379         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12380         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12381         return tag_ptr(ret_conv, true);
12382 }
12383
12384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12385         void* this_arg_ptr = untag_ptr(this_arg);
12386         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12387         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12388         LDKChannelUpdate msg_conv;
12389         msg_conv.inner = untag_ptr(msg);
12390         msg_conv.is_owned = ptr_is_owned(msg);
12391         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12392         msg_conv.is_owned = false;
12393         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12394         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12395         return tag_ptr(ret_conv, true);
12396 }
12397
12398 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) {
12399         void* this_arg_ptr = untag_ptr(this_arg);
12400         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12401         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12402         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
12403         int64_tArray ret_arr = NULL;
12404         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12405         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12406         for (size_t h = 0; h < ret_var.datalen; h++) {
12407                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12408                 *ret_conv_59_conv = ret_var.data[h];
12409                 ret_arr_ptr[h] = tag_ptr(ret_conv_59_conv, true);
12410         }
12411         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12412         FREE(ret_var.data);
12413         return ret_arr;
12414 }
12415
12416 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) {
12417         void* this_arg_ptr = untag_ptr(this_arg);
12418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12419         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12420         LDKPublicKey starting_point_ref;
12421         CHECK((*env)->GetArrayLength(env, starting_point) == 33);
12422         (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
12423         LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
12424         int64_tArray ret_arr = NULL;
12425         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12426         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12427         for (size_t s = 0; s < ret_var.datalen; s++) {
12428                 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
12429                 int64_t ret_conv_18_ref = 0;
12430                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
12431                 ret_conv_18_ref = tag_ptr(ret_conv_18_var.inner, ret_conv_18_var.is_owned);
12432                 ret_arr_ptr[s] = ret_conv_18_ref;
12433         }
12434         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12435         FREE(ret_var.data);
12436         return ret_arr;
12437 }
12438
12439 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) {
12440         void* this_arg_ptr = untag_ptr(this_arg);
12441         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12442         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12443         LDKPublicKey their_node_id_ref;
12444         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12445         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12446         LDKInit init_conv;
12447         init_conv.inner = untag_ptr(init);
12448         init_conv.is_owned = ptr_is_owned(init);
12449         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12450         init_conv.is_owned = false;
12451         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
12452 }
12453
12454 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) {
12455         void* this_arg_ptr = untag_ptr(this_arg);
12456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12457         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12458         LDKPublicKey their_node_id_ref;
12459         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12460         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12461         LDKReplyChannelRange msg_conv;
12462         msg_conv.inner = untag_ptr(msg);
12463         msg_conv.is_owned = ptr_is_owned(msg);
12464         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12465         msg_conv = ReplyChannelRange_clone(&msg_conv);
12466         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12467         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12468         return tag_ptr(ret_conv, true);
12469 }
12470
12471 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) {
12472         void* this_arg_ptr = untag_ptr(this_arg);
12473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12474         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12475         LDKPublicKey their_node_id_ref;
12476         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12477         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12478         LDKReplyShortChannelIdsEnd msg_conv;
12479         msg_conv.inner = untag_ptr(msg);
12480         msg_conv.is_owned = ptr_is_owned(msg);
12481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12482         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12483         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12484         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12485         return tag_ptr(ret_conv, true);
12486 }
12487
12488 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) {
12489         void* this_arg_ptr = untag_ptr(this_arg);
12490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12491         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12492         LDKPublicKey their_node_id_ref;
12493         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12494         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12495         LDKQueryChannelRange msg_conv;
12496         msg_conv.inner = untag_ptr(msg);
12497         msg_conv.is_owned = ptr_is_owned(msg);
12498         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12499         msg_conv = QueryChannelRange_clone(&msg_conv);
12500         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12501         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12502         return tag_ptr(ret_conv, true);
12503 }
12504
12505 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) {
12506         void* this_arg_ptr = untag_ptr(this_arg);
12507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12508         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12509         LDKPublicKey their_node_id_ref;
12510         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12511         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12512         LDKQueryShortChannelIds msg_conv;
12513         msg_conv.inner = untag_ptr(msg);
12514         msg_conv.is_owned = ptr_is_owned(msg);
12515         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12516         msg_conv = QueryShortChannelIds_clone(&msg_conv);
12517         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12518         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12519         return tag_ptr(ret_conv, true);
12520 }
12521
12522 typedef struct LDKCustomMessageReader_JCalls {
12523         atomic_size_t refcnt;
12524         JavaVM *vm;
12525         jweak o;
12526         jmethodID read_meth;
12527 } LDKCustomMessageReader_JCalls;
12528 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
12529         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12530         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12531                 JNIEnv *env;
12532                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12533                 if (get_jenv_res == JNI_EDETACHED) {
12534                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12535                 } else {
12536                         DO_ASSERT(get_jenv_res == JNI_OK);
12537                 }
12538                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12539                 if (get_jenv_res == JNI_EDETACHED) {
12540                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12541                 }
12542                 FREE(j_calls);
12543         }
12544 }
12545 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
12546         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12547         JNIEnv *env;
12548         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12549         if (get_jenv_res == JNI_EDETACHED) {
12550                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12551         } else {
12552                 DO_ASSERT(get_jenv_res == JNI_OK);
12553         }
12554         int16_t message_type_conv = message_type;
12555         LDKu8slice buffer_var = buffer;
12556         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
12557         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
12558         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12559         CHECK(obj != NULL);
12560         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
12561         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12562                 (*env)->ExceptionDescribe(env);
12563                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
12564         }
12565         void* ret_ptr = untag_ptr(ret);
12566         CHECK_ACCESS(ret_ptr);
12567         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
12568         FREE(untag_ptr(ret));
12569         if (get_jenv_res == JNI_EDETACHED) {
12570                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12571         }
12572         return ret_conv;
12573 }
12574 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
12575         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
12576         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12577 }
12578 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
12579         jclass c = (*env)->GetObjectClass(env, o);
12580         CHECK(c != NULL);
12581         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
12582         atomic_init(&calls->refcnt, 1);
12583         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12584         calls->o = (*env)->NewWeakGlobalRef(env, o);
12585         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
12586         CHECK(calls->read_meth != NULL);
12587
12588         LDKCustomMessageReader ret = {
12589                 .this_arg = (void*) calls,
12590                 .read = read_LDKCustomMessageReader_jcall,
12591                 .free = LDKCustomMessageReader_JCalls_free,
12592         };
12593         return ret;
12594 }
12595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
12596         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
12597         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
12598         return tag_ptr(res_ptr, true);
12599 }
12600 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) {
12601         void* this_arg_ptr = untag_ptr(this_arg);
12602         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12603         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
12604         LDKu8slice buffer_ref;
12605         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
12606         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
12607         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12608         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
12609         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
12610         return tag_ptr(ret_conv, true);
12611 }
12612
12613 typedef struct LDKCustomMessageHandler_JCalls {
12614         atomic_size_t refcnt;
12615         JavaVM *vm;
12616         jweak o;
12617         LDKCustomMessageReader_JCalls* CustomMessageReader;
12618         jmethodID handle_custom_message_meth;
12619         jmethodID get_and_clear_pending_msg_meth;
12620 } LDKCustomMessageHandler_JCalls;
12621 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
12622         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12623         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12624                 JNIEnv *env;
12625                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12626                 if (get_jenv_res == JNI_EDETACHED) {
12627                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12628                 } else {
12629                         DO_ASSERT(get_jenv_res == JNI_OK);
12630                 }
12631                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12632                 if (get_jenv_res == JNI_EDETACHED) {
12633                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12634                 }
12635                 FREE(j_calls);
12636         }
12637 }
12638 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
12639         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12640         JNIEnv *env;
12641         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12642         if (get_jenv_res == JNI_EDETACHED) {
12643                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12644         } else {
12645                 DO_ASSERT(get_jenv_res == JNI_OK);
12646         }
12647         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
12648         *msg_ret = msg;
12649         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
12650         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
12651         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12652         CHECK(obj != NULL);
12653         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
12654         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12655                 (*env)->ExceptionDescribe(env);
12656                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
12657         }
12658         void* ret_ptr = untag_ptr(ret);
12659         CHECK_ACCESS(ret_ptr);
12660         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12661         FREE(untag_ptr(ret));
12662         if (get_jenv_res == JNI_EDETACHED) {
12663                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12664         }
12665         return ret_conv;
12666 }
12667 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
12668         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12669         JNIEnv *env;
12670         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12671         if (get_jenv_res == JNI_EDETACHED) {
12672                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12673         } else {
12674                 DO_ASSERT(get_jenv_res == JNI_OK);
12675         }
12676         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12677         CHECK(obj != NULL);
12678         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
12679         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12680                 (*env)->ExceptionDescribe(env);
12681                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
12682         }
12683         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
12684         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12685         if (ret_constr.datalen > 0)
12686                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12687         else
12688                 ret_constr.data = NULL;
12689         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12690         for (size_t z = 0; z < ret_constr.datalen; z++) {
12691                 int64_t ret_conv_25 = ret_vals[z];
12692                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
12693                 CHECK_ACCESS(ret_conv_25_ptr);
12694                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
12695                 FREE(untag_ptr(ret_conv_25));
12696                 ret_constr.data[z] = ret_conv_25_conv;
12697         }
12698         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12699         if (get_jenv_res == JNI_EDETACHED) {
12700                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12701         }
12702         return ret_constr;
12703 }
12704 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
12705         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
12706         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12707         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
12708 }
12709 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12710         jclass c = (*env)->GetObjectClass(env, o);
12711         CHECK(c != NULL);
12712         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
12713         atomic_init(&calls->refcnt, 1);
12714         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12715         calls->o = (*env)->NewWeakGlobalRef(env, o);
12716         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
12717         CHECK(calls->handle_custom_message_meth != NULL);
12718         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
12719         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
12720
12721         LDKCustomMessageHandler ret = {
12722                 .this_arg = (void*) calls,
12723                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
12724                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
12725                 .free = LDKCustomMessageHandler_JCalls_free,
12726                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
12727         };
12728         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
12729         return ret;
12730 }
12731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12732         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
12733         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
12734         return tag_ptr(res_ptr, true);
12735 }
12736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
12737         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
12738         return tag_ptr(&inp->CustomMessageReader, false);
12739 }
12740 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) {
12741         void* this_arg_ptr = untag_ptr(this_arg);
12742         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12743         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12744         void* msg_ptr = untag_ptr(msg);
12745         CHECK_ACCESS(msg_ptr);
12746         LDKType msg_conv = *(LDKType*)(msg_ptr);
12747         if (msg_conv.free == LDKType_JCalls_free) {
12748                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12749                 LDKType_JCalls_cloned(&msg_conv);
12750         }
12751         LDKPublicKey sender_node_id_ref;
12752         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
12753         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
12754         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12755         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
12756         return tag_ptr(ret_conv, true);
12757 }
12758
12759 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
12760         void* this_arg_ptr = untag_ptr(this_arg);
12761         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12762         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12763         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
12764         int64_tArray ret_arr = NULL;
12765         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12766         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12767         for (size_t z = 0; z < ret_var.datalen; z++) {
12768                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12769                 *ret_conv_25_conv = ret_var.data[z];
12770                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
12771         }
12772         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12773         FREE(ret_var.data);
12774         return ret_arr;
12775 }
12776
12777 typedef struct LDKSocketDescriptor_JCalls {
12778         atomic_size_t refcnt;
12779         JavaVM *vm;
12780         jweak o;
12781         jmethodID send_data_meth;
12782         jmethodID disconnect_socket_meth;
12783         jmethodID eq_meth;
12784         jmethodID hash_meth;
12785 } LDKSocketDescriptor_JCalls;
12786 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
12787         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12788         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12789                 JNIEnv *env;
12790                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12791                 if (get_jenv_res == JNI_EDETACHED) {
12792                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12793                 } else {
12794                         DO_ASSERT(get_jenv_res == JNI_OK);
12795                 }
12796                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12797                 if (get_jenv_res == JNI_EDETACHED) {
12798                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12799                 }
12800                 FREE(j_calls);
12801         }
12802 }
12803 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
12804         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12805         JNIEnv *env;
12806         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12807         if (get_jenv_res == JNI_EDETACHED) {
12808                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12809         } else {
12810                 DO_ASSERT(get_jenv_res == JNI_OK);
12811         }
12812         LDKu8slice data_var = data;
12813         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
12814         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
12815         jboolean resume_read_conv = resume_read;
12816         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12817         CHECK(obj != NULL);
12818         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
12819         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12820                 (*env)->ExceptionDescribe(env);
12821                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
12822         }
12823         if (get_jenv_res == JNI_EDETACHED) {
12824                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12825         }
12826         return ret;
12827 }
12828 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
12829         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12830         JNIEnv *env;
12831         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12832         if (get_jenv_res == JNI_EDETACHED) {
12833                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12834         } else {
12835                 DO_ASSERT(get_jenv_res == JNI_OK);
12836         }
12837         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12838         CHECK(obj != NULL);
12839         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
12840         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12841                 (*env)->ExceptionDescribe(env);
12842                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
12843         }
12844         if (get_jenv_res == JNI_EDETACHED) {
12845                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12846         }
12847 }
12848 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
12849         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12850         JNIEnv *env;
12851         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12852         if (get_jenv_res == JNI_EDETACHED) {
12853                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12854         } else {
12855                 DO_ASSERT(get_jenv_res == JNI_OK);
12856         }
12857         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12858         *other_arg_clone = SocketDescriptor_clone(other_arg);
12859         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12860         CHECK(obj != NULL);
12861         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
12862         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12863                 (*env)->ExceptionDescribe(env);
12864                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
12865         }
12866         if (get_jenv_res == JNI_EDETACHED) {
12867                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12868         }
12869         return ret;
12870 }
12871 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
12872         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12873         JNIEnv *env;
12874         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12875         if (get_jenv_res == JNI_EDETACHED) {
12876                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12877         } else {
12878                 DO_ASSERT(get_jenv_res == JNI_OK);
12879         }
12880         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12881         CHECK(obj != NULL);
12882         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
12883         if (UNLIKELY((*env)->ExceptionCheck(env))) {
12884                 (*env)->ExceptionDescribe(env);
12885                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
12886         }
12887         if (get_jenv_res == JNI_EDETACHED) {
12888                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12889         }
12890         return ret;
12891 }
12892 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
12893         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
12894         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12895 }
12896 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
12897         jclass c = (*env)->GetObjectClass(env, o);
12898         CHECK(c != NULL);
12899         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
12900         atomic_init(&calls->refcnt, 1);
12901         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12902         calls->o = (*env)->NewWeakGlobalRef(env, o);
12903         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
12904         CHECK(calls->send_data_meth != NULL);
12905         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
12906         CHECK(calls->disconnect_socket_meth != NULL);
12907         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
12908         CHECK(calls->eq_meth != NULL);
12909         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
12910         CHECK(calls->hash_meth != NULL);
12911
12912         LDKSocketDescriptor ret = {
12913                 .this_arg = (void*) calls,
12914                 .send_data = send_data_LDKSocketDescriptor_jcall,
12915                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12916                 .eq = eq_LDKSocketDescriptor_jcall,
12917                 .hash = hash_LDKSocketDescriptor_jcall,
12918                 .cloned = LDKSocketDescriptor_JCalls_cloned,
12919                 .free = LDKSocketDescriptor_JCalls_free,
12920         };
12921         return ret;
12922 }
12923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12924         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12925         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12926         return tag_ptr(res_ptr, true);
12927 }
12928 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) {
12929         void* this_arg_ptr = untag_ptr(this_arg);
12930         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12931         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12932         LDKu8slice data_ref;
12933         data_ref.datalen = (*env)->GetArrayLength(env, data);
12934         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12935         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12936         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12937         return ret_conv;
12938 }
12939
12940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12941         void* this_arg_ptr = untag_ptr(this_arg);
12942         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12943         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12944         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12945 }
12946
12947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12948         void* this_arg_ptr = untag_ptr(this_arg);
12949         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12950         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12951         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
12952         return ret_conv;
12953 }
12954
12955 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
12956 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
12957 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
12958 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
12959 static jclass LDKEffectiveCapacity_Total_class = NULL;
12960 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
12961 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
12962 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
12963 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
12964 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
12965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
12966         LDKEffectiveCapacity_ExactLiquidity_class =
12967                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
12968         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
12969         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
12970         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
12971         LDKEffectiveCapacity_MaximumHTLC_class =
12972                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
12973         CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
12974         LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
12975         CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
12976         LDKEffectiveCapacity_Total_class =
12977                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
12978         CHECK(LDKEffectiveCapacity_Total_class != NULL);
12979         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
12980         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
12981         LDKEffectiveCapacity_Infinite_class =
12982                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
12983         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
12984         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
12985         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
12986         LDKEffectiveCapacity_Unknown_class =
12987                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
12988         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
12989         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
12990         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
12991 }
12992 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12993         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
12994         switch(obj->tag) {
12995                 case LDKEffectiveCapacity_ExactLiquidity: {
12996                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
12997                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
12998                 }
12999                 case LDKEffectiveCapacity_MaximumHTLC: {
13000                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
13001                         return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
13002                 }
13003                 case LDKEffectiveCapacity_Total: {
13004                         int64_t capacity_msat_conv = obj->total.capacity_msat;
13005                         int64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
13006                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_ref);
13007                 }
13008                 case LDKEffectiveCapacity_Infinite: {
13009                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
13010                 }
13011                 case LDKEffectiveCapacity_Unknown: {
13012                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
13013                 }
13014                 default: abort();
13015         }
13016 }
13017 typedef struct LDKLockableScore_JCalls {
13018         atomic_size_t refcnt;
13019         JavaVM *vm;
13020         jweak o;
13021         jmethodID lock_meth;
13022 } LDKLockableScore_JCalls;
13023 static void LDKLockableScore_JCalls_free(void* this_arg) {
13024         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13025         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13026                 JNIEnv *env;
13027                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13028                 if (get_jenv_res == JNI_EDETACHED) {
13029                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13030                 } else {
13031                         DO_ASSERT(get_jenv_res == JNI_OK);
13032                 }
13033                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13034                 if (get_jenv_res == JNI_EDETACHED) {
13035                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13036                 }
13037                 FREE(j_calls);
13038         }
13039 }
13040 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
13041         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13042         JNIEnv *env;
13043         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13044         if (get_jenv_res == JNI_EDETACHED) {
13045                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13046         } else {
13047                 DO_ASSERT(get_jenv_res == JNI_OK);
13048         }
13049         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13050         CHECK(obj != NULL);
13051         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
13052         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13053                 (*env)->ExceptionDescribe(env);
13054                 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
13055         }
13056         void* ret_ptr = untag_ptr(ret);
13057         CHECK_ACCESS(ret_ptr);
13058         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
13059         if (ret_conv.free == LDKScore_JCalls_free) {
13060                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13061                 LDKScore_JCalls_cloned(&ret_conv);
13062         }// WARNING: we may need a move here but no clone is available for LDKScore
13063         
13064         if (get_jenv_res == JNI_EDETACHED) {
13065                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13066         }
13067         return ret_conv;
13068 }
13069 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
13070         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
13071         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13072 }
13073 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
13074         jclass c = (*env)->GetObjectClass(env, o);
13075         CHECK(c != NULL);
13076         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
13077         atomic_init(&calls->refcnt, 1);
13078         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13079         calls->o = (*env)->NewWeakGlobalRef(env, o);
13080         calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
13081         CHECK(calls->lock_meth != NULL);
13082
13083         LDKLockableScore ret = {
13084                 .this_arg = (void*) calls,
13085                 .lock = lock_LDKLockableScore_jcall,
13086                 .free = LDKLockableScore_JCalls_free,
13087         };
13088         return ret;
13089 }
13090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
13091         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
13092         *res_ptr = LDKLockableScore_init(env, clz, o);
13093         return tag_ptr(res_ptr, true);
13094 }
13095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
13096         void* this_arg_ptr = untag_ptr(this_arg);
13097         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13098         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
13099         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
13100         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
13101         return tag_ptr(ret_ret, true);
13102 }
13103
13104 static jclass LDKGossipSync_P2P_class = NULL;
13105 static jmethodID LDKGossipSync_P2P_meth = NULL;
13106 static jclass LDKGossipSync_Rapid_class = NULL;
13107 static jmethodID LDKGossipSync_Rapid_meth = NULL;
13108 static jclass LDKGossipSync_None_class = NULL;
13109 static jmethodID LDKGossipSync_None_meth = NULL;
13110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
13111         LDKGossipSync_P2P_class =
13112                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
13113         CHECK(LDKGossipSync_P2P_class != NULL);
13114         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
13115         CHECK(LDKGossipSync_P2P_meth != NULL);
13116         LDKGossipSync_Rapid_class =
13117                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
13118         CHECK(LDKGossipSync_Rapid_class != NULL);
13119         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
13120         CHECK(LDKGossipSync_Rapid_meth != NULL);
13121         LDKGossipSync_None_class =
13122                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
13123         CHECK(LDKGossipSync_None_class != NULL);
13124         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
13125         CHECK(LDKGossipSync_None_meth != NULL);
13126 }
13127 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13128         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
13129         switch(obj->tag) {
13130                 case LDKGossipSync_P2P: {
13131                         LDKP2PGossipSync p2p_var = obj->p2p;
13132                         int64_t p2p_ref = 0;
13133                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
13134                         p2p_ref = tag_ptr(p2p_var.inner, false);
13135                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
13136                 }
13137                 case LDKGossipSync_Rapid: {
13138                         LDKRapidGossipSync rapid_var = obj->rapid;
13139                         int64_t rapid_ref = 0;
13140                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
13141                         rapid_ref = tag_ptr(rapid_var.inner, false);
13142                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
13143                 }
13144                 case LDKGossipSync_None: {
13145                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
13146                 }
13147                 default: abort();
13148         }
13149 }
13150 static jclass LDKFallback_SegWitProgram_class = NULL;
13151 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13152 static jclass LDKFallback_PubKeyHash_class = NULL;
13153 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13154 static jclass LDKFallback_ScriptHash_class = NULL;
13155 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13157         LDKFallback_SegWitProgram_class =
13158                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13159         CHECK(LDKFallback_SegWitProgram_class != NULL);
13160         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13161         CHECK(LDKFallback_SegWitProgram_meth != NULL);
13162         LDKFallback_PubKeyHash_class =
13163                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13164         CHECK(LDKFallback_PubKeyHash_class != NULL);
13165         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13166         CHECK(LDKFallback_PubKeyHash_meth != NULL);
13167         LDKFallback_ScriptHash_class =
13168                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13169         CHECK(LDKFallback_ScriptHash_class != NULL);
13170         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13171         CHECK(LDKFallback_ScriptHash_meth != NULL);
13172 }
13173 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13174         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
13175         switch(obj->tag) {
13176                 case LDKFallback_SegWitProgram: {
13177                         uint8_t version_val = obj->seg_wit_program.version._0;
13178                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13179                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13180                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13181                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13182                 }
13183                 case LDKFallback_PubKeyHash: {
13184                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13185                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13186                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13187                 }
13188                 case LDKFallback_ScriptHash: {
13189                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13190                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13191                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13192                 }
13193                 default: abort();
13194         }
13195 }
13196 typedef struct LDKPayer_JCalls {
13197         atomic_size_t refcnt;
13198         JavaVM *vm;
13199         jweak o;
13200         jmethodID node_id_meth;
13201         jmethodID first_hops_meth;
13202         jmethodID send_payment_meth;
13203         jmethodID send_spontaneous_payment_meth;
13204         jmethodID retry_payment_meth;
13205         jmethodID abandon_payment_meth;
13206 } LDKPayer_JCalls;
13207 static void LDKPayer_JCalls_free(void* this_arg) {
13208         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13209         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13210                 JNIEnv *env;
13211                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13212                 if (get_jenv_res == JNI_EDETACHED) {
13213                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13214                 } else {
13215                         DO_ASSERT(get_jenv_res == JNI_OK);
13216                 }
13217                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13218                 if (get_jenv_res == JNI_EDETACHED) {
13219                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13220                 }
13221                 FREE(j_calls);
13222         }
13223 }
13224 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13225         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13226         JNIEnv *env;
13227         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13228         if (get_jenv_res == JNI_EDETACHED) {
13229                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13230         } else {
13231                 DO_ASSERT(get_jenv_res == JNI_OK);
13232         }
13233         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13234         CHECK(obj != NULL);
13235         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13236         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13237                 (*env)->ExceptionDescribe(env);
13238                 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13239         }
13240         LDKPublicKey ret_ref;
13241         CHECK((*env)->GetArrayLength(env, ret) == 33);
13242         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13243         if (get_jenv_res == JNI_EDETACHED) {
13244                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13245         }
13246         return ret_ref;
13247 }
13248 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13249         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13250         JNIEnv *env;
13251         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13252         if (get_jenv_res == JNI_EDETACHED) {
13253                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13254         } else {
13255                 DO_ASSERT(get_jenv_res == JNI_OK);
13256         }
13257         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13258         CHECK(obj != NULL);
13259         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13260         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13261                 (*env)->ExceptionDescribe(env);
13262                 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13263         }
13264         LDKCVec_ChannelDetailsZ ret_constr;
13265         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13266         if (ret_constr.datalen > 0)
13267                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13268         else
13269                 ret_constr.data = NULL;
13270         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13271         for (size_t q = 0; q < ret_constr.datalen; q++) {
13272                 int64_t ret_conv_16 = ret_vals[q];
13273                 LDKChannelDetails ret_conv_16_conv;
13274                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
13275                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
13276                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13277                 ret_constr.data[q] = ret_conv_16_conv;
13278         }
13279         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13280         if (get_jenv_res == JNI_EDETACHED) {
13281                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13282         }
13283         return ret_constr;
13284 }
13285 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13286         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13287         JNIEnv *env;
13288         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13289         if (get_jenv_res == JNI_EDETACHED) {
13290                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13291         } else {
13292                 DO_ASSERT(get_jenv_res == JNI_OK);
13293         }
13294         LDKRoute route_var = *route;
13295         int64_t route_ref = 0;
13296         route_var = Route_clone(&route_var);
13297         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13298         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13299         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13300         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13301         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13302         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13303         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13304         CHECK(obj != NULL);
13305         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13306         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13307                 (*env)->ExceptionDescribe(env);
13308                 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13309         }
13310         void* ret_ptr = untag_ptr(ret);
13311         CHECK_ACCESS(ret_ptr);
13312         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13313         FREE(untag_ptr(ret));
13314         if (get_jenv_res == JNI_EDETACHED) {
13315                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13316         }
13317         return ret_conv;
13318 }
13319 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
13320         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13321         JNIEnv *env;
13322         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13323         if (get_jenv_res == JNI_EDETACHED) {
13324                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13325         } else {
13326                 DO_ASSERT(get_jenv_res == JNI_OK);
13327         }
13328         LDKRoute route_var = *route;
13329         int64_t route_ref = 0;
13330         route_var = Route_clone(&route_var);
13331         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13332         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13333         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13334         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13335         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13336         CHECK(obj != NULL);
13337         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13338         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13339                 (*env)->ExceptionDescribe(env);
13340                 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13341         }
13342         void* ret_ptr = untag_ptr(ret);
13343         CHECK_ACCESS(ret_ptr);
13344         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13345         FREE(untag_ptr(ret));
13346         if (get_jenv_res == JNI_EDETACHED) {
13347                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13348         }
13349         return ret_conv;
13350 }
13351 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
13352         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13353         JNIEnv *env;
13354         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13355         if (get_jenv_res == JNI_EDETACHED) {
13356                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13357         } else {
13358                 DO_ASSERT(get_jenv_res == JNI_OK);
13359         }
13360         LDKRoute route_var = *route;
13361         int64_t route_ref = 0;
13362         route_var = Route_clone(&route_var);
13363         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13364         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
13365         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13366         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13367         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13368         CHECK(obj != NULL);
13369         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
13370         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13371                 (*env)->ExceptionDescribe(env);
13372                 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
13373         }
13374         void* ret_ptr = untag_ptr(ret);
13375         CHECK_ACCESS(ret_ptr);
13376         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
13377         FREE(untag_ptr(ret));
13378         if (get_jenv_res == JNI_EDETACHED) {
13379                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13380         }
13381         return ret_conv;
13382 }
13383 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
13384         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13385         JNIEnv *env;
13386         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13387         if (get_jenv_res == JNI_EDETACHED) {
13388                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13389         } else {
13390                 DO_ASSERT(get_jenv_res == JNI_OK);
13391         }
13392         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13393         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13394         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13395         CHECK(obj != NULL);
13396         (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
13397         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13398                 (*env)->ExceptionDescribe(env);
13399                 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
13400         }
13401         if (get_jenv_res == JNI_EDETACHED) {
13402                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13403         }
13404 }
13405 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
13406         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
13407         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13408 }
13409 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
13410         jclass c = (*env)->GetObjectClass(env, o);
13411         CHECK(c != NULL);
13412         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
13413         atomic_init(&calls->refcnt, 1);
13414         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13415         calls->o = (*env)->NewWeakGlobalRef(env, o);
13416         calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
13417         CHECK(calls->node_id_meth != NULL);
13418         calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
13419         CHECK(calls->first_hops_meth != NULL);
13420         calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
13421         CHECK(calls->send_payment_meth != NULL);
13422         calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
13423         CHECK(calls->send_spontaneous_payment_meth != NULL);
13424         calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
13425         CHECK(calls->retry_payment_meth != NULL);
13426         calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
13427         CHECK(calls->abandon_payment_meth != NULL);
13428
13429         LDKPayer ret = {
13430                 .this_arg = (void*) calls,
13431                 .node_id = node_id_LDKPayer_jcall,
13432                 .first_hops = first_hops_LDKPayer_jcall,
13433                 .send_payment = send_payment_LDKPayer_jcall,
13434                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
13435                 .retry_payment = retry_payment_LDKPayer_jcall,
13436                 .abandon_payment = abandon_payment_LDKPayer_jcall,
13437                 .free = LDKPayer_JCalls_free,
13438         };
13439         return ret;
13440 }
13441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
13442         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
13443         *res_ptr = LDKPayer_init(env, clz, o);
13444         return tag_ptr(res_ptr, true);
13445 }
13446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13447         void* this_arg_ptr = untag_ptr(this_arg);
13448         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13449         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13450         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13451         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
13452         return ret_arr;
13453 }
13454
13455 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
13456         void* this_arg_ptr = untag_ptr(this_arg);
13457         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13458         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13459         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
13460         int64_tArray ret_arr = NULL;
13461         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13462         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13463         for (size_t q = 0; q < ret_var.datalen; q++) {
13464                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
13465                 int64_t ret_conv_16_ref = 0;
13466                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
13467                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
13468                 ret_arr_ptr[q] = ret_conv_16_ref;
13469         }
13470         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13471         FREE(ret_var.data);
13472         return ret_arr;
13473 }
13474
13475 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) {
13476         void* this_arg_ptr = untag_ptr(this_arg);
13477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13478         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13479         LDKRoute route_conv;
13480         route_conv.inner = untag_ptr(route);
13481         route_conv.is_owned = ptr_is_owned(route);
13482         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13483         route_conv.is_owned = false;
13484         LDKThirtyTwoBytes payment_hash_ref;
13485         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13486         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13487         LDKThirtyTwoBytes payment_secret_ref;
13488         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13489         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13490         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13491         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
13492         return tag_ptr(ret_conv, true);
13493 }
13494
13495 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) {
13496         void* this_arg_ptr = untag_ptr(this_arg);
13497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13498         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13499         LDKRoute route_conv;
13500         route_conv.inner = untag_ptr(route);
13501         route_conv.is_owned = ptr_is_owned(route);
13502         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13503         route_conv.is_owned = false;
13504         LDKThirtyTwoBytes payment_preimage_ref;
13505         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13506         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13507         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13508         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
13509         return tag_ptr(ret_conv, true);
13510 }
13511
13512 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) {
13513         void* this_arg_ptr = untag_ptr(this_arg);
13514         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13515         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13516         LDKRoute route_conv;
13517         route_conv.inner = untag_ptr(route);
13518         route_conv.is_owned = ptr_is_owned(route);
13519         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13520         route_conv.is_owned = false;
13521         LDKThirtyTwoBytes payment_id_ref;
13522         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13523         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13524         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13525         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
13526         return tag_ptr(ret_conv, true);
13527 }
13528
13529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
13530         void* this_arg_ptr = untag_ptr(this_arg);
13531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13532         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13533         LDKThirtyTwoBytes payment_id_ref;
13534         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13535         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13536         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
13537 }
13538
13539 typedef struct LDKRouter_JCalls {
13540         atomic_size_t refcnt;
13541         JavaVM *vm;
13542         jweak o;
13543         jmethodID find_route_meth;
13544 } LDKRouter_JCalls;
13545 static void LDKRouter_JCalls_free(void* this_arg) {
13546         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13547         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13548                 JNIEnv *env;
13549                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13550                 if (get_jenv_res == JNI_EDETACHED) {
13551                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13552                 } else {
13553                         DO_ASSERT(get_jenv_res == JNI_OK);
13554                 }
13555                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13556                 if (get_jenv_res == JNI_EDETACHED) {
13557                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13558                 }
13559                 FREE(j_calls);
13560         }
13561 }
13562 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) {
13563         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13564         JNIEnv *env;
13565         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13566         if (get_jenv_res == JNI_EDETACHED) {
13567                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13568         } else {
13569                 DO_ASSERT(get_jenv_res == JNI_OK);
13570         }
13571         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
13572         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
13573         LDKRouteParameters route_params_var = *route_params;
13574         int64_t route_params_ref = 0;
13575         route_params_var = RouteParameters_clone(&route_params_var);
13576         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
13577         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
13578         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13579         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
13580         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
13581         int64_tArray first_hops_arr = NULL;
13582         if (first_hops != NULL) {
13583                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
13584                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
13585                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
13586                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
13587                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
13588                         int64_t first_hops_conv_16_ref = 0;
13589                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
13590                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
13591                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
13592                 }
13593                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
13594         }
13595         // WARNING: This object doesn't live past this scope, needs clone!
13596         int64_t ret_scorer = tag_ptr(scorer, false);
13597         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13598         CHECK(obj != NULL);
13599         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);
13600         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13601                 (*env)->ExceptionDescribe(env);
13602                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
13603         }
13604         void* ret_ptr = untag_ptr(ret);
13605         CHECK_ACCESS(ret_ptr);
13606         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
13607         FREE(untag_ptr(ret));
13608         if (get_jenv_res == JNI_EDETACHED) {
13609                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13610         }
13611         return ret_conv;
13612 }
13613 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
13614         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
13615         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13616 }
13617 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
13618         jclass c = (*env)->GetObjectClass(env, o);
13619         CHECK(c != NULL);
13620         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
13621         atomic_init(&calls->refcnt, 1);
13622         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13623         calls->o = (*env)->NewWeakGlobalRef(env, o);
13624         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
13625         CHECK(calls->find_route_meth != NULL);
13626
13627         LDKRouter ret = {
13628                 .this_arg = (void*) calls,
13629                 .find_route = find_route_LDKRouter_jcall,
13630                 .free = LDKRouter_JCalls_free,
13631         };
13632         return ret;
13633 }
13634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
13635         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
13636         *res_ptr = LDKRouter_init(env, clz, o);
13637         return tag_ptr(res_ptr, true);
13638 }
13639 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) {
13640         void* this_arg_ptr = untag_ptr(this_arg);
13641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13642         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
13643         LDKPublicKey payer_ref;
13644         CHECK((*env)->GetArrayLength(env, payer) == 33);
13645         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
13646         LDKRouteParameters route_params_conv;
13647         route_params_conv.inner = untag_ptr(route_params);
13648         route_params_conv.is_owned = ptr_is_owned(route_params);
13649         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
13650         route_params_conv.is_owned = false;
13651         unsigned char payment_hash_arr[32];
13652         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13653         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
13654         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
13655         LDKCVec_ChannelDetailsZ first_hops_constr;
13656         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
13657         if (first_hops != NULL) {
13658                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
13659                 if (first_hops_constr.datalen > 0)
13660                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13661                 else
13662                         first_hops_constr.data = NULL;
13663                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
13664                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13665                         int64_t first_hops_conv_16 = first_hops_vals[q];
13666                         LDKChannelDetails first_hops_conv_16_conv;
13667                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
13668                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
13669                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
13670                         first_hops_conv_16_conv.is_owned = false;
13671                         first_hops_constr.data[q] = first_hops_conv_16_conv;
13672                 }
13673                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
13674                 first_hops_ptr = &first_hops_constr;
13675         }
13676         void* scorer_ptr = untag_ptr(scorer);
13677         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
13678         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
13679         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13680         *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);
13681         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
13682         return tag_ptr(ret_conv, true);
13683 }
13684
13685 static jclass LDKRetry_Attempts_class = NULL;
13686 static jmethodID LDKRetry_Attempts_meth = NULL;
13687 static jclass LDKRetry_Timeout_class = NULL;
13688 static jmethodID LDKRetry_Timeout_meth = NULL;
13689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
13690         LDKRetry_Attempts_class =
13691                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
13692         CHECK(LDKRetry_Attempts_class != NULL);
13693         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
13694         CHECK(LDKRetry_Attempts_meth != NULL);
13695         LDKRetry_Timeout_class =
13696                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
13697         CHECK(LDKRetry_Timeout_class != NULL);
13698         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
13699         CHECK(LDKRetry_Timeout_meth != NULL);
13700 }
13701 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13702         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
13703         switch(obj->tag) {
13704                 case LDKRetry_Attempts: {
13705                         int64_t attempts_conv = obj->attempts;
13706                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
13707                 }
13708                 case LDKRetry_Timeout: {
13709                         int64_t timeout_conv = obj->timeout;
13710                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
13711                 }
13712                 default: abort();
13713         }
13714 }
13715 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13716         LDKStr ret_str = _ldk_get_compiled_version();
13717         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13718         Str_free(ret_str);
13719         return ret_conv;
13720 }
13721
13722 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13723         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
13724         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13725         Str_free(ret_str);
13726         return ret_conv;
13727 }
13728
13729 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
13730         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
13731         *ret_copy = Bech32Error_clone(arg);
13732         int64_t ret_ref = tag_ptr(ret_copy, true);
13733         return ret_ref;
13734 }
13735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13736         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
13737         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
13738         return ret_conv;
13739 }
13740
13741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13742         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
13743         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
13744         *ret_copy = Bech32Error_clone(orig_conv);
13745         int64_t ret_ref = tag_ptr(ret_copy, true);
13746         return ret_ref;
13747 }
13748
13749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
13750         if (!ptr_is_owned(o)) return;
13751         void* o_ptr = untag_ptr(o);
13752         CHECK_ACCESS(o_ptr);
13753         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
13754         FREE(untag_ptr(o));
13755         Bech32Error_free(o_conv);
13756 }
13757
13758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
13759         LDKTransaction _res_ref;
13760         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
13761         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
13762         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
13763         _res_ref.data_is_owned = true;
13764         Transaction_free(_res_ref);
13765 }
13766
13767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
13768         LDKCVec_u8Z script_pubkey_ref;
13769         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13770         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
13771         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
13772         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13773         *ret_ref = TxOut_new(script_pubkey_ref, value);
13774         return tag_ptr(ret_ref, true);
13775 }
13776
13777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
13778         if (!ptr_is_owned(_res)) return;
13779         void* _res_ptr = untag_ptr(_res);
13780         CHECK_ACCESS(_res_ptr);
13781         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
13782         FREE(untag_ptr(_res));
13783         TxOut_free(_res_conv);
13784 }
13785
13786 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
13787         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13788         *ret_ref = TxOut_clone(arg);
13789         return tag_ptr(ret_ref, true);
13790 }
13791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13792         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
13793         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
13794         return ret_conv;
13795 }
13796
13797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13798         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
13799         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13800         *ret_ref = TxOut_clone(orig_conv);
13801         return tag_ptr(ret_ref, true);
13802 }
13803
13804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
13805         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
13806         Str_free(dummy);
13807 }
13808
13809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
13810         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13811         *ret_conv = CResult_NoneNoneZ_ok();
13812         return tag_ptr(ret_conv, true);
13813 }
13814
13815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
13816         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13817         *ret_conv = CResult_NoneNoneZ_err();
13818         return tag_ptr(ret_conv, true);
13819 }
13820
13821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13822         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
13823         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
13824         return ret_conv;
13825 }
13826
13827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13828         if (!ptr_is_owned(_res)) return;
13829         void* _res_ptr = untag_ptr(_res);
13830         CHECK_ACCESS(_res_ptr);
13831         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
13832         FREE(untag_ptr(_res));
13833         CResult_NoneNoneZ_free(_res_conv);
13834 }
13835
13836 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
13837         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13838         *ret_conv = CResult_NoneNoneZ_clone(arg);
13839         return tag_ptr(ret_conv, true);
13840 }
13841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13842         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
13843         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
13844         return ret_conv;
13845 }
13846
13847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13848         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
13849         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13850         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
13851         return tag_ptr(ret_conv, true);
13852 }
13853
13854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13855         LDKCounterpartyCommitmentSecrets o_conv;
13856         o_conv.inner = untag_ptr(o);
13857         o_conv.is_owned = ptr_is_owned(o);
13858         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13859         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
13860         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13861         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
13862         return tag_ptr(ret_conv, true);
13863 }
13864
13865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13866         LDKDecodeError e_conv;
13867         e_conv.inner = untag_ptr(e);
13868         e_conv.is_owned = ptr_is_owned(e);
13869         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13870         e_conv = DecodeError_clone(&e_conv);
13871         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13872         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
13873         return tag_ptr(ret_conv, true);
13874 }
13875
13876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13877         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
13878         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
13879         return ret_conv;
13880 }
13881
13882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13883         if (!ptr_is_owned(_res)) return;
13884         void* _res_ptr = untag_ptr(_res);
13885         CHECK_ACCESS(_res_ptr);
13886         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
13887         FREE(untag_ptr(_res));
13888         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
13889 }
13890
13891 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
13892         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13893         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
13894         return tag_ptr(ret_conv, true);
13895 }
13896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13897         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
13898         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
13899         return ret_conv;
13900 }
13901
13902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13903         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
13904         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13905         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
13906         return tag_ptr(ret_conv, true);
13907 }
13908
13909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13910         LDKSecretKey o_ref;
13911         CHECK((*env)->GetArrayLength(env, o) == 32);
13912         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
13913         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13914         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
13915         return tag_ptr(ret_conv, true);
13916 }
13917
13918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13919         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13920         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13921         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
13922         return tag_ptr(ret_conv, true);
13923 }
13924
13925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13926         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
13927         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
13928         return ret_conv;
13929 }
13930
13931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13932         if (!ptr_is_owned(_res)) return;
13933         void* _res_ptr = untag_ptr(_res);
13934         CHECK_ACCESS(_res_ptr);
13935         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
13936         FREE(untag_ptr(_res));
13937         CResult_SecretKeyErrorZ_free(_res_conv);
13938 }
13939
13940 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
13941         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13942         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
13943         return tag_ptr(ret_conv, true);
13944 }
13945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13946         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
13947         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
13948         return ret_conv;
13949 }
13950
13951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13952         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
13953         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13954         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
13955         return tag_ptr(ret_conv, true);
13956 }
13957
13958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13959         LDKPublicKey o_ref;
13960         CHECK((*env)->GetArrayLength(env, o) == 33);
13961         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
13962         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13963         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
13964         return tag_ptr(ret_conv, true);
13965 }
13966
13967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13968         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13969         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13970         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
13971         return tag_ptr(ret_conv, true);
13972 }
13973
13974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13975         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
13976         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
13977         return ret_conv;
13978 }
13979
13980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13981         if (!ptr_is_owned(_res)) return;
13982         void* _res_ptr = untag_ptr(_res);
13983         CHECK_ACCESS(_res_ptr);
13984         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
13985         FREE(untag_ptr(_res));
13986         CResult_PublicKeyErrorZ_free(_res_conv);
13987 }
13988
13989 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
13990         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13991         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
13992         return tag_ptr(ret_conv, true);
13993 }
13994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13995         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
13996         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
13997         return ret_conv;
13998 }
13999
14000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14001         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
14002         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14003         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
14004         return tag_ptr(ret_conv, true);
14005 }
14006
14007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14008         LDKTxCreationKeys o_conv;
14009         o_conv.inner = untag_ptr(o);
14010         o_conv.is_owned = ptr_is_owned(o);
14011         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14012         o_conv = TxCreationKeys_clone(&o_conv);
14013         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14014         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14015         return tag_ptr(ret_conv, true);
14016 }
14017
14018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14019         LDKDecodeError e_conv;
14020         e_conv.inner = untag_ptr(e);
14021         e_conv.is_owned = ptr_is_owned(e);
14022         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14023         e_conv = DecodeError_clone(&e_conv);
14024         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14025         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14026         return tag_ptr(ret_conv, true);
14027 }
14028
14029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14030         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
14031         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14032         return ret_conv;
14033 }
14034
14035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14036         if (!ptr_is_owned(_res)) return;
14037         void* _res_ptr = untag_ptr(_res);
14038         CHECK_ACCESS(_res_ptr);
14039         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14040         FREE(untag_ptr(_res));
14041         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14042 }
14043
14044 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14045         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14046         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14047         return tag_ptr(ret_conv, true);
14048 }
14049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14050         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
14051         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14052         return ret_conv;
14053 }
14054
14055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14056         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
14057         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14058         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14059         return tag_ptr(ret_conv, true);
14060 }
14061
14062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14063         LDKChannelPublicKeys o_conv;
14064         o_conv.inner = untag_ptr(o);
14065         o_conv.is_owned = ptr_is_owned(o);
14066         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14067         o_conv = ChannelPublicKeys_clone(&o_conv);
14068         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14069         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14070         return tag_ptr(ret_conv, true);
14071 }
14072
14073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14074         LDKDecodeError e_conv;
14075         e_conv.inner = untag_ptr(e);
14076         e_conv.is_owned = ptr_is_owned(e);
14077         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14078         e_conv = DecodeError_clone(&e_conv);
14079         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14080         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14081         return tag_ptr(ret_conv, true);
14082 }
14083
14084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14085         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
14086         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14087         return ret_conv;
14088 }
14089
14090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14091         if (!ptr_is_owned(_res)) return;
14092         void* _res_ptr = untag_ptr(_res);
14093         CHECK_ACCESS(_res_ptr);
14094         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
14095         FREE(untag_ptr(_res));
14096         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
14097 }
14098
14099 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
14100         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14101         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
14102         return tag_ptr(ret_conv, true);
14103 }
14104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14105         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
14106         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
14107         return ret_conv;
14108 }
14109
14110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14111         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
14112         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14113         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
14114         return tag_ptr(ret_conv, true);
14115 }
14116
14117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14118         LDKTxCreationKeys o_conv;
14119         o_conv.inner = untag_ptr(o);
14120         o_conv.is_owned = ptr_is_owned(o);
14121         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14122         o_conv = TxCreationKeys_clone(&o_conv);
14123         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14124         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
14125         return tag_ptr(ret_conv, true);
14126 }
14127
14128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14129         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14130         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14131         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
14132         return tag_ptr(ret_conv, true);
14133 }
14134
14135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14136         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
14137         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
14138         return ret_conv;
14139 }
14140
14141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14142         if (!ptr_is_owned(_res)) return;
14143         void* _res_ptr = untag_ptr(_res);
14144         CHECK_ACCESS(_res_ptr);
14145         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14146         FREE(untag_ptr(_res));
14147         CResult_TxCreationKeysErrorZ_free(_res_conv);
14148 }
14149
14150 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14151         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14152         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14153         return tag_ptr(ret_conv, true);
14154 }
14155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14156         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
14157         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14158         return ret_conv;
14159 }
14160
14161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14162         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
14163         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14164         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14165         return tag_ptr(ret_conv, true);
14166 }
14167
14168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14169         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14170         *ret_copy = COption_u32Z_some(o);
14171         int64_t ret_ref = tag_ptr(ret_copy, true);
14172         return ret_ref;
14173 }
14174
14175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14176         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14177         *ret_copy = COption_u32Z_none();
14178         int64_t ret_ref = tag_ptr(ret_copy, true);
14179         return ret_ref;
14180 }
14181
14182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14183         if (!ptr_is_owned(_res)) return;
14184         void* _res_ptr = untag_ptr(_res);
14185         CHECK_ACCESS(_res_ptr);
14186         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14187         FREE(untag_ptr(_res));
14188         COption_u32Z_free(_res_conv);
14189 }
14190
14191 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14192         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14193         *ret_copy = COption_u32Z_clone(arg);
14194         int64_t ret_ref = tag_ptr(ret_copy, true);
14195         return ret_ref;
14196 }
14197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14198         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
14199         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
14200         return ret_conv;
14201 }
14202
14203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14204         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
14205         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14206         *ret_copy = COption_u32Z_clone(orig_conv);
14207         int64_t ret_ref = tag_ptr(ret_copy, true);
14208         return ret_ref;
14209 }
14210
14211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14212         LDKHTLCOutputInCommitment o_conv;
14213         o_conv.inner = untag_ptr(o);
14214         o_conv.is_owned = ptr_is_owned(o);
14215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14216         o_conv = HTLCOutputInCommitment_clone(&o_conv);
14217         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14218         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14219         return tag_ptr(ret_conv, true);
14220 }
14221
14222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14223         LDKDecodeError e_conv;
14224         e_conv.inner = untag_ptr(e);
14225         e_conv.is_owned = ptr_is_owned(e);
14226         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14227         e_conv = DecodeError_clone(&e_conv);
14228         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14229         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14230         return tag_ptr(ret_conv, true);
14231 }
14232
14233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14234         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
14235         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14236         return ret_conv;
14237 }
14238
14239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14240         if (!ptr_is_owned(_res)) return;
14241         void* _res_ptr = untag_ptr(_res);
14242         CHECK_ACCESS(_res_ptr);
14243         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14244         FREE(untag_ptr(_res));
14245         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14246 }
14247
14248 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14249         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14250         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14251         return tag_ptr(ret_conv, true);
14252 }
14253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14254         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
14255         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14256         return ret_conv;
14257 }
14258
14259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14260         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
14261         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14262         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14263         return tag_ptr(ret_conv, true);
14264 }
14265
14266 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14267         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14268         return ret_conv;
14269 }
14270
14271 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14272         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14273         return ret_conv;
14274 }
14275
14276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14277         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14278         COption_NoneZ_free(_res_conv);
14279 }
14280
14281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14282         LDKCounterpartyChannelTransactionParameters o_conv;
14283         o_conv.inner = untag_ptr(o);
14284         o_conv.is_owned = ptr_is_owned(o);
14285         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14286         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14287         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14288         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14289         return tag_ptr(ret_conv, true);
14290 }
14291
14292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14293         LDKDecodeError e_conv;
14294         e_conv.inner = untag_ptr(e);
14295         e_conv.is_owned = ptr_is_owned(e);
14296         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14297         e_conv = DecodeError_clone(&e_conv);
14298         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14299         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14300         return tag_ptr(ret_conv, true);
14301 }
14302
14303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14304         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
14305         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14306         return ret_conv;
14307 }
14308
14309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14310         if (!ptr_is_owned(_res)) return;
14311         void* _res_ptr = untag_ptr(_res);
14312         CHECK_ACCESS(_res_ptr);
14313         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14314         FREE(untag_ptr(_res));
14315         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14316 }
14317
14318 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14319         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14320         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14321         return tag_ptr(ret_conv, true);
14322 }
14323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14324         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
14325         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14326         return ret_conv;
14327 }
14328
14329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14330         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
14331         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14332         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14333         return tag_ptr(ret_conv, true);
14334 }
14335
14336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14337         LDKChannelTransactionParameters o_conv;
14338         o_conv.inner = untag_ptr(o);
14339         o_conv.is_owned = ptr_is_owned(o);
14340         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14341         o_conv = ChannelTransactionParameters_clone(&o_conv);
14342         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14343         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14344         return tag_ptr(ret_conv, true);
14345 }
14346
14347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14348         LDKDecodeError e_conv;
14349         e_conv.inner = untag_ptr(e);
14350         e_conv.is_owned = ptr_is_owned(e);
14351         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14352         e_conv = DecodeError_clone(&e_conv);
14353         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14354         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
14355         return tag_ptr(ret_conv, true);
14356 }
14357
14358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14359         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
14360         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14361         return ret_conv;
14362 }
14363
14364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14365         if (!ptr_is_owned(_res)) return;
14366         void* _res_ptr = untag_ptr(_res);
14367         CHECK_ACCESS(_res_ptr);
14368         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14369         FREE(untag_ptr(_res));
14370         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14371 }
14372
14373 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14374         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14375         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
14376         return tag_ptr(ret_conv, true);
14377 }
14378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14379         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
14380         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14381         return ret_conv;
14382 }
14383
14384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14385         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
14386         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14387         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14388         return tag_ptr(ret_conv, true);
14389 }
14390
14391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14392         LDKCVec_SignatureZ _res_constr;
14393         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14394         if (_res_constr.datalen > 0)
14395                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14396         else
14397                 _res_constr.data = NULL;
14398         for (size_t i = 0; i < _res_constr.datalen; i++) {
14399                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14400                 LDKSignature _res_conv_8_ref;
14401                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
14402                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
14403                 _res_constr.data[i] = _res_conv_8_ref;
14404         }
14405         CVec_SignatureZ_free(_res_constr);
14406 }
14407
14408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14409         LDKHolderCommitmentTransaction o_conv;
14410         o_conv.inner = untag_ptr(o);
14411         o_conv.is_owned = ptr_is_owned(o);
14412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14413         o_conv = HolderCommitmentTransaction_clone(&o_conv);
14414         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14415         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
14416         return tag_ptr(ret_conv, true);
14417 }
14418
14419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14420         LDKDecodeError e_conv;
14421         e_conv.inner = untag_ptr(e);
14422         e_conv.is_owned = ptr_is_owned(e);
14423         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14424         e_conv = DecodeError_clone(&e_conv);
14425         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14426         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
14427         return tag_ptr(ret_conv, true);
14428 }
14429
14430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14431         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14432         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14433         return ret_conv;
14434 }
14435
14436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14437         if (!ptr_is_owned(_res)) return;
14438         void* _res_ptr = untag_ptr(_res);
14439         CHECK_ACCESS(_res_ptr);
14440         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14441         FREE(untag_ptr(_res));
14442         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
14443 }
14444
14445 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14446         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14447         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
14448         return tag_ptr(ret_conv, true);
14449 }
14450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14451         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14452         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14453         return ret_conv;
14454 }
14455
14456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14457         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14458         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14459         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14460         return tag_ptr(ret_conv, true);
14461 }
14462
14463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14464         LDKBuiltCommitmentTransaction o_conv;
14465         o_conv.inner = untag_ptr(o);
14466         o_conv.is_owned = ptr_is_owned(o);
14467         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14468         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
14469         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14470         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
14471         return tag_ptr(ret_conv, true);
14472 }
14473
14474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14475         LDKDecodeError e_conv;
14476         e_conv.inner = untag_ptr(e);
14477         e_conv.is_owned = ptr_is_owned(e);
14478         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14479         e_conv = DecodeError_clone(&e_conv);
14480         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14481         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
14482         return tag_ptr(ret_conv, true);
14483 }
14484
14485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14486         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14487         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14488         return ret_conv;
14489 }
14490
14491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14492         if (!ptr_is_owned(_res)) return;
14493         void* _res_ptr = untag_ptr(_res);
14494         CHECK_ACCESS(_res_ptr);
14495         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14496         FREE(untag_ptr(_res));
14497         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
14498 }
14499
14500 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14501         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14502         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
14503         return tag_ptr(ret_conv, true);
14504 }
14505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14506         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14507         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14508         return ret_conv;
14509 }
14510
14511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14512         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14513         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14514         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14515         return tag_ptr(ret_conv, true);
14516 }
14517
14518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14519         LDKTrustedClosingTransaction o_conv;
14520         o_conv.inner = untag_ptr(o);
14521         o_conv.is_owned = ptr_is_owned(o);
14522         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14523         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
14524         
14525         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14526         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
14527         return tag_ptr(ret_conv, true);
14528 }
14529
14530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14531         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14532         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
14533         return tag_ptr(ret_conv, true);
14534 }
14535
14536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14537         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
14538         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
14539         return ret_conv;
14540 }
14541
14542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14543         if (!ptr_is_owned(_res)) return;
14544         void* _res_ptr = untag_ptr(_res);
14545         CHECK_ACCESS(_res_ptr);
14546         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
14547         FREE(untag_ptr(_res));
14548         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
14549 }
14550
14551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14552         LDKCommitmentTransaction 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 = CommitmentTransaction_clone(&o_conv);
14557         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14558         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
14559         return tag_ptr(ret_conv, true);
14560 }
14561
14562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14563         LDKDecodeError 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 = DecodeError_clone(&e_conv);
14568         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14569         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
14570         return tag_ptr(ret_conv, true);
14571 }
14572
14573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14574         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
14575         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14576         return ret_conv;
14577 }
14578
14579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_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_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
14584         FREE(untag_ptr(_res));
14585         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
14586 }
14587
14588 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14589         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14590         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
14591         return tag_ptr(ret_conv, true);
14592 }
14593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14594         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
14595         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14596         return ret_conv;
14597 }
14598
14599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14600         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
14601         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14602         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
14603         return tag_ptr(ret_conv, true);
14604 }
14605
14606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14607         LDKTrustedCommitmentTransaction o_conv;
14608         o_conv.inner = untag_ptr(o);
14609         o_conv.is_owned = ptr_is_owned(o);
14610         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14611         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
14612         
14613         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14614         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
14615         return tag_ptr(ret_conv, true);
14616 }
14617
14618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14619         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14620         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
14621         return tag_ptr(ret_conv, true);
14622 }
14623
14624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14625         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
14626         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
14627         return ret_conv;
14628 }
14629
14630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14631         if (!ptr_is_owned(_res)) return;
14632         void* _res_ptr = untag_ptr(_res);
14633         CHECK_ACCESS(_res_ptr);
14634         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
14635         FREE(untag_ptr(_res));
14636         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
14637 }
14638
14639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14640         LDKCVec_SignatureZ o_constr;
14641         o_constr.datalen = (*env)->GetArrayLength(env, o);
14642         if (o_constr.datalen > 0)
14643                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14644         else
14645                 o_constr.data = NULL;
14646         for (size_t i = 0; i < o_constr.datalen; i++) {
14647                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
14648                 LDKSignature o_conv_8_ref;
14649                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
14650                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
14651                 o_constr.data[i] = o_conv_8_ref;
14652         }
14653         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14654         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
14655         return tag_ptr(ret_conv, true);
14656 }
14657
14658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
14659         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14660         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
14661         return tag_ptr(ret_conv, true);
14662 }
14663
14664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14665         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
14666         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
14667         return ret_conv;
14668 }
14669
14670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14671         if (!ptr_is_owned(_res)) return;
14672         void* _res_ptr = untag_ptr(_res);
14673         CHECK_ACCESS(_res_ptr);
14674         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
14675         FREE(untag_ptr(_res));
14676         CResult_CVec_SignatureZNoneZ_free(_res_conv);
14677 }
14678
14679 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
14680         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14681         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
14682         return tag_ptr(ret_conv, true);
14683 }
14684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14685         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
14686         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
14687         return ret_conv;
14688 }
14689
14690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14691         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
14692         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14693         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
14694         return tag_ptr(ret_conv, true);
14695 }
14696
14697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14698         LDKShutdownScript o_conv;
14699         o_conv.inner = untag_ptr(o);
14700         o_conv.is_owned = ptr_is_owned(o);
14701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14702         o_conv = ShutdownScript_clone(&o_conv);
14703         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14704         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
14705         return tag_ptr(ret_conv, true);
14706 }
14707
14708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14709         LDKDecodeError e_conv;
14710         e_conv.inner = untag_ptr(e);
14711         e_conv.is_owned = ptr_is_owned(e);
14712         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14713         e_conv = DecodeError_clone(&e_conv);
14714         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14715         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
14716         return tag_ptr(ret_conv, true);
14717 }
14718
14719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14720         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
14721         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
14722         return ret_conv;
14723 }
14724
14725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14726         if (!ptr_is_owned(_res)) return;
14727         void* _res_ptr = untag_ptr(_res);
14728         CHECK_ACCESS(_res_ptr);
14729         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
14730         FREE(untag_ptr(_res));
14731         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
14732 }
14733
14734 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
14735         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14736         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
14737         return tag_ptr(ret_conv, true);
14738 }
14739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14740         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
14741         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
14742         return ret_conv;
14743 }
14744
14745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14746         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
14747         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14748         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
14749         return tag_ptr(ret_conv, true);
14750 }
14751
14752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14753         LDKShutdownScript o_conv;
14754         o_conv.inner = untag_ptr(o);
14755         o_conv.is_owned = ptr_is_owned(o);
14756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14757         o_conv = ShutdownScript_clone(&o_conv);
14758         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14759         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
14760         return tag_ptr(ret_conv, true);
14761 }
14762
14763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14764         LDKInvalidShutdownScript e_conv;
14765         e_conv.inner = untag_ptr(e);
14766         e_conv.is_owned = ptr_is_owned(e);
14767         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14768         e_conv = InvalidShutdownScript_clone(&e_conv);
14769         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14770         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
14771         return tag_ptr(ret_conv, true);
14772 }
14773
14774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14775         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
14776         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
14777         return ret_conv;
14778 }
14779
14780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14781         if (!ptr_is_owned(_res)) return;
14782         void* _res_ptr = untag_ptr(_res);
14783         CHECK_ACCESS(_res_ptr);
14784         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
14785         FREE(untag_ptr(_res));
14786         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
14787 }
14788
14789 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
14790         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14791         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
14792         return tag_ptr(ret_conv, true);
14793 }
14794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14795         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
14796         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
14797         return ret_conv;
14798 }
14799
14800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14801         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
14802         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14803         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
14804         return tag_ptr(ret_conv, true);
14805 }
14806
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
14808         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14809         *ret_conv = CResult_NoneErrorZ_ok();
14810         return tag_ptr(ret_conv, true);
14811 }
14812
14813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14814         LDKIOError e_conv = LDKIOError_from_java(env, e);
14815         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14816         *ret_conv = CResult_NoneErrorZ_err(e_conv);
14817         return tag_ptr(ret_conv, true);
14818 }
14819
14820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14821         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
14822         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
14823         return ret_conv;
14824 }
14825
14826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14827         if (!ptr_is_owned(_res)) return;
14828         void* _res_ptr = untag_ptr(_res);
14829         CHECK_ACCESS(_res_ptr);
14830         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
14831         FREE(untag_ptr(_res));
14832         CResult_NoneErrorZ_free(_res_conv);
14833 }
14834
14835 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
14836         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14837         *ret_conv = CResult_NoneErrorZ_clone(arg);
14838         return tag_ptr(ret_conv, true);
14839 }
14840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14841         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
14842         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
14843         return ret_conv;
14844 }
14845
14846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14847         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
14848         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14849         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
14850         return tag_ptr(ret_conv, true);
14851 }
14852
14853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14854         LDKRouteHop o_conv;
14855         o_conv.inner = untag_ptr(o);
14856         o_conv.is_owned = ptr_is_owned(o);
14857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14858         o_conv = RouteHop_clone(&o_conv);
14859         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14860         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
14861         return tag_ptr(ret_conv, true);
14862 }
14863
14864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14865         LDKDecodeError e_conv;
14866         e_conv.inner = untag_ptr(e);
14867         e_conv.is_owned = ptr_is_owned(e);
14868         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14869         e_conv = DecodeError_clone(&e_conv);
14870         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14871         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
14872         return tag_ptr(ret_conv, true);
14873 }
14874
14875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14876         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
14877         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
14878         return ret_conv;
14879 }
14880
14881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14882         if (!ptr_is_owned(_res)) return;
14883         void* _res_ptr = untag_ptr(_res);
14884         CHECK_ACCESS(_res_ptr);
14885         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
14886         FREE(untag_ptr(_res));
14887         CResult_RouteHopDecodeErrorZ_free(_res_conv);
14888 }
14889
14890 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
14891         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14892         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
14893         return tag_ptr(ret_conv, true);
14894 }
14895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14896         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
14897         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
14898         return ret_conv;
14899 }
14900
14901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14902         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
14903         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14904         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
14905         return tag_ptr(ret_conv, true);
14906 }
14907
14908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14909         LDKCVec_RouteHopZ _res_constr;
14910         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14911         if (_res_constr.datalen > 0)
14912                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14913         else
14914                 _res_constr.data = NULL;
14915         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14916         for (size_t k = 0; k < _res_constr.datalen; k++) {
14917                 int64_t _res_conv_10 = _res_vals[k];
14918                 LDKRouteHop _res_conv_10_conv;
14919                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
14920                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
14921                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
14922                 _res_constr.data[k] = _res_conv_10_conv;
14923         }
14924         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14925         CVec_RouteHopZ_free(_res_constr);
14926 }
14927
14928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14929         LDKCVec_CVec_RouteHopZZ _res_constr;
14930         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14931         if (_res_constr.datalen > 0)
14932                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14933         else
14934                 _res_constr.data = NULL;
14935         for (size_t m = 0; m < _res_constr.datalen; m++) {
14936                 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
14937                 LDKCVec_RouteHopZ _res_conv_12_constr;
14938                 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
14939                 if (_res_conv_12_constr.datalen > 0)
14940                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14941                 else
14942                         _res_conv_12_constr.data = NULL;
14943                 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
14944                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
14945                         int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
14946                         LDKRouteHop _res_conv_12_conv_10_conv;
14947                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
14948                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
14949                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
14950                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
14951                 }
14952                 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
14953                 _res_constr.data[m] = _res_conv_12_constr;
14954         }
14955         CVec_CVec_RouteHopZZ_free(_res_constr);
14956 }
14957
14958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14959         LDKRoute o_conv;
14960         o_conv.inner = untag_ptr(o);
14961         o_conv.is_owned = ptr_is_owned(o);
14962         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14963         o_conv = Route_clone(&o_conv);
14964         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14965         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
14966         return tag_ptr(ret_conv, true);
14967 }
14968
14969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14970         LDKDecodeError e_conv;
14971         e_conv.inner = untag_ptr(e);
14972         e_conv.is_owned = ptr_is_owned(e);
14973         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14974         e_conv = DecodeError_clone(&e_conv);
14975         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14976         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
14977         return tag_ptr(ret_conv, true);
14978 }
14979
14980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14981         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
14982         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
14983         return ret_conv;
14984 }
14985
14986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14987         if (!ptr_is_owned(_res)) return;
14988         void* _res_ptr = untag_ptr(_res);
14989         CHECK_ACCESS(_res_ptr);
14990         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
14991         FREE(untag_ptr(_res));
14992         CResult_RouteDecodeErrorZ_free(_res_conv);
14993 }
14994
14995 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
14996         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14997         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
14998         return tag_ptr(ret_conv, true);
14999 }
15000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15001         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
15002         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
15003         return ret_conv;
15004 }
15005
15006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15007         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
15008         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15009         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
15010         return tag_ptr(ret_conv, true);
15011 }
15012
15013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15014         LDKRouteParameters o_conv;
15015         o_conv.inner = untag_ptr(o);
15016         o_conv.is_owned = ptr_is_owned(o);
15017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15018         o_conv = RouteParameters_clone(&o_conv);
15019         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15020         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
15021         return tag_ptr(ret_conv, true);
15022 }
15023
15024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15025         LDKDecodeError e_conv;
15026         e_conv.inner = untag_ptr(e);
15027         e_conv.is_owned = ptr_is_owned(e);
15028         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15029         e_conv = DecodeError_clone(&e_conv);
15030         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15031         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
15032         return tag_ptr(ret_conv, true);
15033 }
15034
15035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15036         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
15037         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
15038         return ret_conv;
15039 }
15040
15041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15042         if (!ptr_is_owned(_res)) return;
15043         void* _res_ptr = untag_ptr(_res);
15044         CHECK_ACCESS(_res_ptr);
15045         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
15046         FREE(untag_ptr(_res));
15047         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
15048 }
15049
15050 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
15051         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15052         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
15053         return tag_ptr(ret_conv, true);
15054 }
15055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15056         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
15057         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
15058         return ret_conv;
15059 }
15060
15061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15062         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
15063         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15064         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
15065         return tag_ptr(ret_conv, true);
15066 }
15067
15068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15069         LDKCVec_RouteHintZ _res_constr;
15070         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15071         if (_res_constr.datalen > 0)
15072                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
15073         else
15074                 _res_constr.data = NULL;
15075         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15076         for (size_t l = 0; l < _res_constr.datalen; l++) {
15077                 int64_t _res_conv_11 = _res_vals[l];
15078                 LDKRouteHint _res_conv_11_conv;
15079                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
15080                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
15081                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
15082                 _res_constr.data[l] = _res_conv_11_conv;
15083         }
15084         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15085         CVec_RouteHintZ_free(_res_constr);
15086 }
15087
15088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
15089         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15090         *ret_copy = COption_u64Z_some(o);
15091         int64_t ret_ref = tag_ptr(ret_copy, true);
15092         return ret_ref;
15093 }
15094
15095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
15096         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15097         *ret_copy = COption_u64Z_none();
15098         int64_t ret_ref = tag_ptr(ret_copy, true);
15099         return ret_ref;
15100 }
15101
15102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15103         if (!ptr_is_owned(_res)) return;
15104         void* _res_ptr = untag_ptr(_res);
15105         CHECK_ACCESS(_res_ptr);
15106         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15107         FREE(untag_ptr(_res));
15108         COption_u64Z_free(_res_conv);
15109 }
15110
15111 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15112         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15113         *ret_copy = COption_u64Z_clone(arg);
15114         int64_t ret_ref = tag_ptr(ret_copy, true);
15115         return ret_ref;
15116 }
15117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15118         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
15119         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15120         return ret_conv;
15121 }
15122
15123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15124         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
15125         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15126         *ret_copy = COption_u64Z_clone(orig_conv);
15127         int64_t ret_ref = tag_ptr(ret_copy, true);
15128         return ret_ref;
15129 }
15130
15131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15132         LDKCVec_u64Z _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(int64_t), "LDKCVec_u64Z Elements");
15136         else
15137                 _res_constr.data = NULL;
15138         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15139         for (size_t g = 0; g < _res_constr.datalen; g++) {
15140                 int64_t _res_conv_6 = _res_vals[g];
15141                 _res_constr.data[g] = _res_conv_6;
15142         }
15143         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15144         CVec_u64Z_free(_res_constr);
15145 }
15146
15147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15148         LDKPaymentParameters o_conv;
15149         o_conv.inner = untag_ptr(o);
15150         o_conv.is_owned = ptr_is_owned(o);
15151         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15152         o_conv = PaymentParameters_clone(&o_conv);
15153         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15154         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
15155         return tag_ptr(ret_conv, true);
15156 }
15157
15158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15159         LDKDecodeError e_conv;
15160         e_conv.inner = untag_ptr(e);
15161         e_conv.is_owned = ptr_is_owned(e);
15162         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15163         e_conv = DecodeError_clone(&e_conv);
15164         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15165         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15166         return tag_ptr(ret_conv, true);
15167 }
15168
15169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15170         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
15171         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15172         return ret_conv;
15173 }
15174
15175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15176         if (!ptr_is_owned(_res)) return;
15177         void* _res_ptr = untag_ptr(_res);
15178         CHECK_ACCESS(_res_ptr);
15179         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15180         FREE(untag_ptr(_res));
15181         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15182 }
15183
15184 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15185         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15186         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15187         return tag_ptr(ret_conv, true);
15188 }
15189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15190         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
15191         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15192         return ret_conv;
15193 }
15194
15195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15196         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
15197         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15198         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15199         return tag_ptr(ret_conv, true);
15200 }
15201
15202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15203         LDKCVec_RouteHintHopZ _res_constr;
15204         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15205         if (_res_constr.datalen > 0)
15206                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15207         else
15208                 _res_constr.data = NULL;
15209         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15210         for (size_t o = 0; o < _res_constr.datalen; o++) {
15211                 int64_t _res_conv_14 = _res_vals[o];
15212                 LDKRouteHintHop _res_conv_14_conv;
15213                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
15214                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
15215                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15216                 _res_constr.data[o] = _res_conv_14_conv;
15217         }
15218         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15219         CVec_RouteHintHopZ_free(_res_constr);
15220 }
15221
15222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15223         LDKRouteHint o_conv;
15224         o_conv.inner = untag_ptr(o);
15225         o_conv.is_owned = ptr_is_owned(o);
15226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15227         o_conv = RouteHint_clone(&o_conv);
15228         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15229         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15230         return tag_ptr(ret_conv, true);
15231 }
15232
15233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_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_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15240         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15241         return tag_ptr(ret_conv, true);
15242 }
15243
15244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15245         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
15246         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15247         return ret_conv;
15248 }
15249
15250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_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_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15255         FREE(untag_ptr(_res));
15256         CResult_RouteHintDecodeErrorZ_free(_res_conv);
15257 }
15258
15259 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15260         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15261         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15262         return tag_ptr(ret_conv, true);
15263 }
15264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15265         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
15266         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15267         return ret_conv;
15268 }
15269
15270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15271         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
15272         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15273         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15274         return tag_ptr(ret_conv, true);
15275 }
15276
15277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15278         LDKRouteHintHop o_conv;
15279         o_conv.inner = untag_ptr(o);
15280         o_conv.is_owned = ptr_is_owned(o);
15281         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15282         o_conv = RouteHintHop_clone(&o_conv);
15283         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15284         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15285         return tag_ptr(ret_conv, true);
15286 }
15287
15288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15289         LDKDecodeError e_conv;
15290         e_conv.inner = untag_ptr(e);
15291         e_conv.is_owned = ptr_is_owned(e);
15292         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15293         e_conv = DecodeError_clone(&e_conv);
15294         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15295         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15296         return tag_ptr(ret_conv, true);
15297 }
15298
15299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15300         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
15301         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15302         return ret_conv;
15303 }
15304
15305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15306         if (!ptr_is_owned(_res)) return;
15307         void* _res_ptr = untag_ptr(_res);
15308         CHECK_ACCESS(_res_ptr);
15309         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15310         FREE(untag_ptr(_res));
15311         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15312 }
15313
15314 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15315         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15316         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15317         return tag_ptr(ret_conv, true);
15318 }
15319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15320         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
15321         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15322         return ret_conv;
15323 }
15324
15325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15326         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
15327         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15328         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15329         return tag_ptr(ret_conv, true);
15330 }
15331
15332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15333         LDKCVec_ChannelDetailsZ _res_constr;
15334         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15335         if (_res_constr.datalen > 0)
15336                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15337         else
15338                 _res_constr.data = NULL;
15339         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15340         for (size_t q = 0; q < _res_constr.datalen; q++) {
15341                 int64_t _res_conv_16 = _res_vals[q];
15342                 LDKChannelDetails _res_conv_16_conv;
15343                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
15344                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
15345                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15346                 _res_constr.data[q] = _res_conv_16_conv;
15347         }
15348         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15349         CVec_ChannelDetailsZ_free(_res_constr);
15350 }
15351
15352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15353         LDKRoute o_conv;
15354         o_conv.inner = untag_ptr(o);
15355         o_conv.is_owned = ptr_is_owned(o);
15356         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15357         o_conv = Route_clone(&o_conv);
15358         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15359         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
15360         return tag_ptr(ret_conv, true);
15361 }
15362
15363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15364         LDKLightningError e_conv;
15365         e_conv.inner = untag_ptr(e);
15366         e_conv.is_owned = ptr_is_owned(e);
15367         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15368         e_conv = LightningError_clone(&e_conv);
15369         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15370         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
15371         return tag_ptr(ret_conv, true);
15372 }
15373
15374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15375         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
15376         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
15377         return ret_conv;
15378 }
15379
15380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15381         if (!ptr_is_owned(_res)) return;
15382         void* _res_ptr = untag_ptr(_res);
15383         CHECK_ACCESS(_res_ptr);
15384         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
15385         FREE(untag_ptr(_res));
15386         CResult_RouteLightningErrorZ_free(_res_conv);
15387 }
15388
15389 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
15390         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15391         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
15392         return tag_ptr(ret_conv, true);
15393 }
15394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15395         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
15396         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
15397         return ret_conv;
15398 }
15399
15400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15401         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
15402         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15403         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
15404         return tag_ptr(ret_conv, true);
15405 }
15406
15407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15408         LDKCVec_PublicKeyZ _res_constr;
15409         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15410         if (_res_constr.datalen > 0)
15411                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
15412         else
15413                 _res_constr.data = NULL;
15414         for (size_t i = 0; i < _res_constr.datalen; i++) {
15415                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15416                 LDKPublicKey _res_conv_8_ref;
15417                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
15418                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
15419                 _res_constr.data[i] = _res_conv_8_ref;
15420         }
15421         CVec_PublicKeyZ_free(_res_constr);
15422 }
15423
15424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15425         void* o_ptr = untag_ptr(o);
15426         CHECK_ACCESS(o_ptr);
15427         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
15428         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
15429         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15430         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
15431         return tag_ptr(ret_conv, true);
15432 }
15433
15434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15435         LDKDecodeError e_conv;
15436         e_conv.inner = untag_ptr(e);
15437         e_conv.is_owned = ptr_is_owned(e);
15438         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15439         e_conv = DecodeError_clone(&e_conv);
15440         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15441         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
15442         return tag_ptr(ret_conv, true);
15443 }
15444
15445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15446         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
15447         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
15448         return ret_conv;
15449 }
15450
15451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15452         if (!ptr_is_owned(_res)) return;
15453         void* _res_ptr = untag_ptr(_res);
15454         CHECK_ACCESS(_res_ptr);
15455         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
15456         FREE(untag_ptr(_res));
15457         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
15458 }
15459
15460 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
15461         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15462         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
15463         return tag_ptr(ret_conv, true);
15464 }
15465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15466         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
15467         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
15468         return ret_conv;
15469 }
15470
15471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15472         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
15473         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
15474         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
15475         return tag_ptr(ret_conv, true);
15476 }
15477
15478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15479         void* o_ptr = untag_ptr(o);
15480         CHECK_ACCESS(o_ptr);
15481         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
15482         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
15483         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15484         *ret_copy = COption_ClosureReasonZ_some(o_conv);
15485         int64_t ret_ref = tag_ptr(ret_copy, true);
15486         return ret_ref;
15487 }
15488
15489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
15490         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15491         *ret_copy = COption_ClosureReasonZ_none();
15492         int64_t ret_ref = tag_ptr(ret_copy, true);
15493         return ret_ref;
15494 }
15495
15496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15497         if (!ptr_is_owned(_res)) return;
15498         void* _res_ptr = untag_ptr(_res);
15499         CHECK_ACCESS(_res_ptr);
15500         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
15501         FREE(untag_ptr(_res));
15502         COption_ClosureReasonZ_free(_res_conv);
15503 }
15504
15505 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
15506         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15507         *ret_copy = COption_ClosureReasonZ_clone(arg);
15508         int64_t ret_ref = tag_ptr(ret_copy, true);
15509         return ret_ref;
15510 }
15511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15512         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
15513         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
15514         return ret_conv;
15515 }
15516
15517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15518         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
15519         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15520         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
15521         int64_t ret_ref = tag_ptr(ret_copy, true);
15522         return ret_ref;
15523 }
15524
15525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15526         void* o_ptr = untag_ptr(o);
15527         CHECK_ACCESS(o_ptr);
15528         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
15529         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
15530         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15531         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
15532         return tag_ptr(ret_conv, true);
15533 }
15534
15535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15536         LDKDecodeError e_conv;
15537         e_conv.inner = untag_ptr(e);
15538         e_conv.is_owned = ptr_is_owned(e);
15539         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15540         e_conv = DecodeError_clone(&e_conv);
15541         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15542         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
15543         return tag_ptr(ret_conv, true);
15544 }
15545
15546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15547         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
15548         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
15549         return ret_conv;
15550 }
15551
15552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15553         if (!ptr_is_owned(_res)) return;
15554         void* _res_ptr = untag_ptr(_res);
15555         CHECK_ACCESS(_res_ptr);
15556         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
15557         FREE(untag_ptr(_res));
15558         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
15559 }
15560
15561 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
15562         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15563         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
15564         return tag_ptr(ret_conv, true);
15565 }
15566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15567         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
15568         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
15569         return ret_conv;
15570 }
15571
15572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15573         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
15574         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15575         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
15576         return tag_ptr(ret_conv, true);
15577 }
15578
15579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15580         void* o_ptr = untag_ptr(o);
15581         CHECK_ACCESS(o_ptr);
15582         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
15583         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
15584         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15585         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
15586         int64_t ret_ref = tag_ptr(ret_copy, true);
15587         return ret_ref;
15588 }
15589
15590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
15591         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15592         *ret_copy = COption_HTLCDestinationZ_none();
15593         int64_t ret_ref = tag_ptr(ret_copy, true);
15594         return ret_ref;
15595 }
15596
15597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15598         if (!ptr_is_owned(_res)) return;
15599         void* _res_ptr = untag_ptr(_res);
15600         CHECK_ACCESS(_res_ptr);
15601         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
15602         FREE(untag_ptr(_res));
15603         COption_HTLCDestinationZ_free(_res_conv);
15604 }
15605
15606 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
15607         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15608         *ret_copy = COption_HTLCDestinationZ_clone(arg);
15609         int64_t ret_ref = tag_ptr(ret_copy, true);
15610         return ret_ref;
15611 }
15612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15613         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
15614         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
15615         return ret_conv;
15616 }
15617
15618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15619         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
15620         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
15621         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
15622         int64_t ret_ref = tag_ptr(ret_copy, true);
15623         return ret_ref;
15624 }
15625
15626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15627         void* o_ptr = untag_ptr(o);
15628         CHECK_ACCESS(o_ptr);
15629         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
15630         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
15631         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15632         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
15633         return tag_ptr(ret_conv, true);
15634 }
15635
15636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15637         LDKDecodeError e_conv;
15638         e_conv.inner = untag_ptr(e);
15639         e_conv.is_owned = ptr_is_owned(e);
15640         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15641         e_conv = DecodeError_clone(&e_conv);
15642         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15643         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
15644         return tag_ptr(ret_conv, true);
15645 }
15646
15647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15648         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
15649         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
15650         return ret_conv;
15651 }
15652
15653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15654         if (!ptr_is_owned(_res)) return;
15655         void* _res_ptr = untag_ptr(_res);
15656         CHECK_ACCESS(_res_ptr);
15657         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
15658         FREE(untag_ptr(_res));
15659         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
15660 }
15661
15662 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
15663         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15664         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
15665         return tag_ptr(ret_conv, true);
15666 }
15667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15668         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
15669         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
15670         return ret_conv;
15671 }
15672
15673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15674         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
15675         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
15676         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
15677         return tag_ptr(ret_conv, true);
15678 }
15679
15680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15681         void* o_ptr = untag_ptr(o);
15682         CHECK_ACCESS(o_ptr);
15683         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
15684         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
15685         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15686         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
15687         int64_t ret_ref = tag_ptr(ret_copy, true);
15688         return ret_ref;
15689 }
15690
15691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
15692         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15693         *ret_copy = COption_NetworkUpdateZ_none();
15694         int64_t ret_ref = tag_ptr(ret_copy, true);
15695         return ret_ref;
15696 }
15697
15698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15699         if (!ptr_is_owned(_res)) return;
15700         void* _res_ptr = untag_ptr(_res);
15701         CHECK_ACCESS(_res_ptr);
15702         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
15703         FREE(untag_ptr(_res));
15704         COption_NetworkUpdateZ_free(_res_conv);
15705 }
15706
15707 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
15708         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15709         *ret_copy = COption_NetworkUpdateZ_clone(arg);
15710         int64_t ret_ref = tag_ptr(ret_copy, true);
15711         return ret_ref;
15712 }
15713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15714         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
15715         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
15716         return ret_conv;
15717 }
15718
15719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15720         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
15721         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15722         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
15723         int64_t ret_ref = tag_ptr(ret_copy, true);
15724         return ret_ref;
15725 }
15726
15727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15728         LDKCVec_SpendableOutputDescriptorZ _res_constr;
15729         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15730         if (_res_constr.datalen > 0)
15731                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15732         else
15733                 _res_constr.data = NULL;
15734         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15735         for (size_t b = 0; b < _res_constr.datalen; b++) {
15736                 int64_t _res_conv_27 = _res_vals[b];
15737                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
15738                 CHECK_ACCESS(_res_conv_27_ptr);
15739                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15740                 FREE(untag_ptr(_res_conv_27));
15741                 _res_constr.data[b] = _res_conv_27_conv;
15742         }
15743         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15744         CVec_SpendableOutputDescriptorZ_free(_res_constr);
15745 }
15746
15747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15748         void* o_ptr = untag_ptr(o);
15749         CHECK_ACCESS(o_ptr);
15750         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15751         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
15752         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15753         *ret_copy = COption_EventZ_some(o_conv);
15754         int64_t ret_ref = tag_ptr(ret_copy, true);
15755         return ret_ref;
15756 }
15757
15758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
15759         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15760         *ret_copy = COption_EventZ_none();
15761         int64_t ret_ref = tag_ptr(ret_copy, true);
15762         return ret_ref;
15763 }
15764
15765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15766         if (!ptr_is_owned(_res)) return;
15767         void* _res_ptr = untag_ptr(_res);
15768         CHECK_ACCESS(_res_ptr);
15769         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15770         FREE(untag_ptr(_res));
15771         COption_EventZ_free(_res_conv);
15772 }
15773
15774 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15775         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15776         *ret_copy = COption_EventZ_clone(arg);
15777         int64_t ret_ref = tag_ptr(ret_copy, true);
15778         return ret_ref;
15779 }
15780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15781         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
15782         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
15783         return ret_conv;
15784 }
15785
15786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15787         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
15788         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15789         *ret_copy = COption_EventZ_clone(orig_conv);
15790         int64_t ret_ref = tag_ptr(ret_copy, true);
15791         return ret_ref;
15792 }
15793
15794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15795         void* o_ptr = untag_ptr(o);
15796         CHECK_ACCESS(o_ptr);
15797         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15798         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
15799         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15800         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15801         return tag_ptr(ret_conv, true);
15802 }
15803
15804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15805         LDKDecodeError e_conv;
15806         e_conv.inner = untag_ptr(e);
15807         e_conv.is_owned = ptr_is_owned(e);
15808         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15809         e_conv = DecodeError_clone(&e_conv);
15810         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15811         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15812         return tag_ptr(ret_conv, true);
15813 }
15814
15815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15816         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
15817         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15818         return ret_conv;
15819 }
15820
15821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15822         if (!ptr_is_owned(_res)) return;
15823         void* _res_ptr = untag_ptr(_res);
15824         CHECK_ACCESS(_res_ptr);
15825         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15826         FREE(untag_ptr(_res));
15827         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15828 }
15829
15830 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15831         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15832         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15833         return tag_ptr(ret_conv, true);
15834 }
15835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15836         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
15837         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15838         return ret_conv;
15839 }
15840
15841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15842         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
15843         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15844         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15845         return tag_ptr(ret_conv, true);
15846 }
15847
15848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15849         LDKCVec_MessageSendEventZ _res_constr;
15850         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15851         if (_res_constr.datalen > 0)
15852                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15853         else
15854                 _res_constr.data = NULL;
15855         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15856         for (size_t s = 0; s < _res_constr.datalen; s++) {
15857                 int64_t _res_conv_18 = _res_vals[s];
15858                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
15859                 CHECK_ACCESS(_res_conv_18_ptr);
15860                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15861                 FREE(untag_ptr(_res_conv_18));
15862                 _res_constr.data[s] = _res_conv_18_conv;
15863         }
15864         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15865         CVec_MessageSendEventZ_free(_res_constr);
15866 }
15867
15868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15869         void* o_ptr = untag_ptr(o);
15870         CHECK_ACCESS(o_ptr);
15871         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
15872         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
15873         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15874         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
15875         return tag_ptr(ret_conv, true);
15876 }
15877
15878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15879         LDKAccessError e_conv = LDKAccessError_from_java(env, e);
15880         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15881         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
15882         return tag_ptr(ret_conv, true);
15883 }
15884
15885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15886         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
15887         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
15888         return ret_conv;
15889 }
15890
15891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15892         if (!ptr_is_owned(_res)) return;
15893         void* _res_ptr = untag_ptr(_res);
15894         CHECK_ACCESS(_res_ptr);
15895         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
15896         FREE(untag_ptr(_res));
15897         CResult_TxOutAccessErrorZ_free(_res_conv);
15898 }
15899
15900 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
15901         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15902         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
15903         return tag_ptr(ret_conv, true);
15904 }
15905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15906         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
15907         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
15908         return ret_conv;
15909 }
15910
15911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15912         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
15913         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15914         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
15915         return tag_ptr(ret_conv, true);
15916 }
15917
15918 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
15919         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15920         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
15921         return tag_ptr(ret_conv, true);
15922 }
15923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15924         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
15925         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
15926         return ret_conv;
15927 }
15928
15929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15930         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
15931         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15932         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
15933         return tag_ptr(ret_conv, true);
15934 }
15935
15936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
15937         LDKTransaction b_ref;
15938         b_ref.datalen = (*env)->GetArrayLength(env, b);
15939         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
15940         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
15941         b_ref.data_is_owned = true;
15942         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15943         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
15944         return tag_ptr(ret_conv, true);
15945 }
15946
15947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15948         if (!ptr_is_owned(_res)) return;
15949         void* _res_ptr = untag_ptr(_res);
15950         CHECK_ACCESS(_res_ptr);
15951         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
15952         FREE(untag_ptr(_res));
15953         C2Tuple_usizeTransactionZ_free(_res_conv);
15954 }
15955
15956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15957         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
15958         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15959         if (_res_constr.datalen > 0)
15960                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15961         else
15962                 _res_constr.data = NULL;
15963         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15964         for (size_t c = 0; c < _res_constr.datalen; c++) {
15965                 int64_t _res_conv_28 = _res_vals[c];
15966                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
15967                 CHECK_ACCESS(_res_conv_28_ptr);
15968                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
15969                 FREE(untag_ptr(_res_conv_28));
15970                 _res_constr.data[c] = _res_conv_28_conv;
15971         }
15972         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15973         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
15974 }
15975
15976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15977         LDKCVec_TxidZ _res_constr;
15978         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15979         if (_res_constr.datalen > 0)
15980                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
15981         else
15982                 _res_constr.data = NULL;
15983         for (size_t i = 0; i < _res_constr.datalen; i++) {
15984                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15985                 LDKThirtyTwoBytes _res_conv_8_ref;
15986                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
15987                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
15988                 _res_constr.data[i] = _res_conv_8_ref;
15989         }
15990         CVec_TxidZ_free(_res_constr);
15991 }
15992
15993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
15994         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15995         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
15996         return tag_ptr(ret_conv, true);
15997 }
15998
15999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
16000         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
16001         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16002         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
16003         return tag_ptr(ret_conv, true);
16004 }
16005
16006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16007         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
16008         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
16009         return ret_conv;
16010 }
16011
16012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16013         if (!ptr_is_owned(_res)) return;
16014         void* _res_ptr = untag_ptr(_res);
16015         CHECK_ACCESS(_res_ptr);
16016         LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
16017         FREE(untag_ptr(_res));
16018         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
16019 }
16020
16021 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
16022         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16023         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
16024         return tag_ptr(ret_conv, true);
16025 }
16026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16027         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
16028         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
16029         return ret_conv;
16030 }
16031
16032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16033         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
16034         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
16035         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
16036         return tag_ptr(ret_conv, true);
16037 }
16038
16039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16040         LDKCVec_MonitorEventZ _res_constr;
16041         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16042         if (_res_constr.datalen > 0)
16043                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16044         else
16045                 _res_constr.data = NULL;
16046         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16047         for (size_t o = 0; o < _res_constr.datalen; o++) {
16048                 int64_t _res_conv_14 = _res_vals[o];
16049                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
16050                 CHECK_ACCESS(_res_conv_14_ptr);
16051                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
16052                 FREE(untag_ptr(_res_conv_14));
16053                 _res_constr.data[o] = _res_conv_14_conv;
16054         }
16055         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16056         CVec_MonitorEventZ_free(_res_constr);
16057 }
16058
16059 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
16060         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
16061         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
16062         return tag_ptr(ret_conv, true);
16063 }
16064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16065         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
16066         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
16067         return ret_conv;
16068 }
16069
16070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16071         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
16072         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
16073         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
16074         return tag_ptr(ret_conv, true);
16075 }
16076
16077 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) {
16078         LDKOutPoint a_conv;
16079         a_conv.inner = untag_ptr(a);
16080         a_conv.is_owned = ptr_is_owned(a);
16081         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16082         a_conv = OutPoint_clone(&a_conv);
16083         LDKCVec_MonitorEventZ b_constr;
16084         b_constr.datalen = (*env)->GetArrayLength(env, b);
16085         if (b_constr.datalen > 0)
16086                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
16087         else
16088                 b_constr.data = NULL;
16089         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
16090         for (size_t o = 0; o < b_constr.datalen; o++) {
16091                 int64_t b_conv_14 = b_vals[o];
16092                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
16093                 CHECK_ACCESS(b_conv_14_ptr);
16094                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
16095                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
16096                 b_constr.data[o] = b_conv_14_conv;
16097         }
16098         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
16099         LDKPublicKey c_ref;
16100         CHECK((*env)->GetArrayLength(env, c) == 33);
16101         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
16102         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
16103         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
16104         return tag_ptr(ret_conv, true);
16105 }
16106
16107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16108         if (!ptr_is_owned(_res)) return;
16109         void* _res_ptr = untag_ptr(_res);
16110         CHECK_ACCESS(_res_ptr);
16111         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
16112         FREE(untag_ptr(_res));
16113         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
16114 }
16115
16116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16117         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
16118         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16119         if (_res_constr.datalen > 0)
16120                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
16121         else
16122                 _res_constr.data = NULL;
16123         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16124         for (size_t x = 0; x < _res_constr.datalen; x++) {
16125                 int64_t _res_conv_49 = _res_vals[x];
16126                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
16127                 CHECK_ACCESS(_res_conv_49_ptr);
16128                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
16129                 FREE(untag_ptr(_res_conv_49));
16130                 _res_constr.data[x] = _res_conv_49_conv;
16131         }
16132         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16133         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
16134 }
16135
16136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16137         void* o_ptr = untag_ptr(o);
16138         CHECK_ACCESS(o_ptr);
16139         LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
16140         o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(o));
16141         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16142         *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
16143         int64_t ret_ref = tag_ptr(ret_copy, true);
16144         return ret_ref;
16145 }
16146
16147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
16148         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16149         *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
16150         int64_t ret_ref = tag_ptr(ret_copy, true);
16151         return ret_ref;
16152 }
16153
16154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16155         if (!ptr_is_owned(_res)) return;
16156         void* _res_ptr = untag_ptr(_res);
16157         CHECK_ACCESS(_res_ptr);
16158         LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
16159         FREE(untag_ptr(_res));
16160         COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
16161 }
16162
16163 static inline uint64_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
16164         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16165         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
16166         int64_t ret_ref = tag_ptr(ret_copy, true);
16167         return ret_ref;
16168 }
16169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16170         LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(arg);
16171         int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
16172         return ret_conv;
16173 }
16174
16175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16176         LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)untag_ptr(orig);
16177         LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
16178         *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
16179         int64_t ret_ref = tag_ptr(ret_copy, true);
16180         return ret_ref;
16181 }
16182
16183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16184         LDKFixedPenaltyScorer o_conv;
16185         o_conv.inner = untag_ptr(o);
16186         o_conv.is_owned = ptr_is_owned(o);
16187         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16188         o_conv = FixedPenaltyScorer_clone(&o_conv);
16189         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16190         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
16191         return tag_ptr(ret_conv, true);
16192 }
16193
16194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16195         LDKDecodeError e_conv;
16196         e_conv.inner = untag_ptr(e);
16197         e_conv.is_owned = ptr_is_owned(e);
16198         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16199         e_conv = DecodeError_clone(&e_conv);
16200         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16201         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
16202         return tag_ptr(ret_conv, true);
16203 }
16204
16205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16206         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
16207         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
16208         return ret_conv;
16209 }
16210
16211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16212         if (!ptr_is_owned(_res)) return;
16213         void* _res_ptr = untag_ptr(_res);
16214         CHECK_ACCESS(_res_ptr);
16215         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
16216         FREE(untag_ptr(_res));
16217         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
16218 }
16219
16220 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
16221         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16222         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
16223         return tag_ptr(ret_conv, true);
16224 }
16225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16226         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
16227         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
16228         return ret_conv;
16229 }
16230
16231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16232         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
16233         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16234         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
16235         return tag_ptr(ret_conv, true);
16236 }
16237
16238 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
16239         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16240         *ret_conv = C2Tuple_u64u64Z_clone(arg);
16241         return tag_ptr(ret_conv, true);
16242 }
16243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16244         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
16245         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
16246         return ret_conv;
16247 }
16248
16249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16250         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
16251         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16252         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
16253         return tag_ptr(ret_conv, true);
16254 }
16255
16256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16257         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
16258         *ret_conv = C2Tuple_u64u64Z_new(a, b);
16259         return tag_ptr(ret_conv, true);
16260 }
16261
16262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16263         if (!ptr_is_owned(_res)) return;
16264         void* _res_ptr = untag_ptr(_res);
16265         CHECK_ACCESS(_res_ptr);
16266         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
16267         FREE(untag_ptr(_res));
16268         C2Tuple_u64u64Z_free(_res_conv);
16269 }
16270
16271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16272         void* o_ptr = untag_ptr(o);
16273         CHECK_ACCESS(o_ptr);
16274         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
16275         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
16276         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16277         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
16278         int64_t ret_ref = tag_ptr(ret_copy, true);
16279         return ret_ref;
16280 }
16281
16282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
16283         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16284         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
16285         int64_t ret_ref = tag_ptr(ret_copy, true);
16286         return ret_ref;
16287 }
16288
16289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16290         if (!ptr_is_owned(_res)) return;
16291         void* _res_ptr = untag_ptr(_res);
16292         CHECK_ACCESS(_res_ptr);
16293         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
16294         FREE(untag_ptr(_res));
16295         COption_C2Tuple_u64u64ZZ_free(_res_conv);
16296 }
16297
16298 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
16299         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16300         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
16301         int64_t ret_ref = tag_ptr(ret_copy, true);
16302         return ret_ref;
16303 }
16304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16305         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
16306         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
16307         return ret_conv;
16308 }
16309
16310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16311         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
16312         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
16313         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
16314         int64_t ret_ref = tag_ptr(ret_copy, true);
16315         return ret_ref;
16316 }
16317
16318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16319         LDKCVec_NodeIdZ _res_constr;
16320         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16321         if (_res_constr.datalen > 0)
16322                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
16323         else
16324                 _res_constr.data = NULL;
16325         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16326         for (size_t i = 0; i < _res_constr.datalen; i++) {
16327                 int64_t _res_conv_8 = _res_vals[i];
16328                 LDKNodeId _res_conv_8_conv;
16329                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
16330                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
16331                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
16332                 _res_constr.data[i] = _res_conv_8_conv;
16333         }
16334         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16335         CVec_NodeIdZ_free(_res_constr);
16336 }
16337
16338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16339         LDKProbabilisticScorer o_conv;
16340         o_conv.inner = untag_ptr(o);
16341         o_conv.is_owned = ptr_is_owned(o);
16342         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16343         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16344         
16345         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16346         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16347         return tag_ptr(ret_conv, true);
16348 }
16349
16350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16351         LDKDecodeError e_conv;
16352         e_conv.inner = untag_ptr(e);
16353         e_conv.is_owned = ptr_is_owned(e);
16354         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16355         e_conv = DecodeError_clone(&e_conv);
16356         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16357         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16358         return tag_ptr(ret_conv, true);
16359 }
16360
16361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16362         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
16363         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
16364         return ret_conv;
16365 }
16366
16367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16368         if (!ptr_is_owned(_res)) return;
16369         void* _res_ptr = untag_ptr(_res);
16370         CHECK_ACCESS(_res_ptr);
16371         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
16372         FREE(untag_ptr(_res));
16373         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
16374 }
16375
16376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16377         LDKInitFeatures o_conv;
16378         o_conv.inner = untag_ptr(o);
16379         o_conv.is_owned = ptr_is_owned(o);
16380         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16381         o_conv = InitFeatures_clone(&o_conv);
16382         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16383         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
16384         return tag_ptr(ret_conv, true);
16385 }
16386
16387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16388         LDKDecodeError e_conv;
16389         e_conv.inner = untag_ptr(e);
16390         e_conv.is_owned = ptr_is_owned(e);
16391         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16392         e_conv = DecodeError_clone(&e_conv);
16393         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16394         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
16395         return tag_ptr(ret_conv, true);
16396 }
16397
16398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16399         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
16400         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16401         return ret_conv;
16402 }
16403
16404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16405         if (!ptr_is_owned(_res)) return;
16406         void* _res_ptr = untag_ptr(_res);
16407         CHECK_ACCESS(_res_ptr);
16408         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16409         FREE(untag_ptr(_res));
16410         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16411 }
16412
16413 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16414         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16415         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
16416         return tag_ptr(ret_conv, true);
16417 }
16418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16419         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
16420         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16421         return ret_conv;
16422 }
16423
16424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16425         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
16426         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16427         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
16428         return tag_ptr(ret_conv, true);
16429 }
16430
16431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16432         LDKChannelFeatures o_conv;
16433         o_conv.inner = untag_ptr(o);
16434         o_conv.is_owned = ptr_is_owned(o);
16435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16436         o_conv = ChannelFeatures_clone(&o_conv);
16437         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16438         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16439         return tag_ptr(ret_conv, true);
16440 }
16441
16442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16443         LDKDecodeError e_conv;
16444         e_conv.inner = untag_ptr(e);
16445         e_conv.is_owned = ptr_is_owned(e);
16446         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16447         e_conv = DecodeError_clone(&e_conv);
16448         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16449         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16450         return tag_ptr(ret_conv, true);
16451 }
16452
16453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16454         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
16455         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16456         return ret_conv;
16457 }
16458
16459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16460         if (!ptr_is_owned(_res)) return;
16461         void* _res_ptr = untag_ptr(_res);
16462         CHECK_ACCESS(_res_ptr);
16463         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16464         FREE(untag_ptr(_res));
16465         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16466 }
16467
16468 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16469         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16470         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
16471         return tag_ptr(ret_conv, true);
16472 }
16473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16474         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
16475         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16476         return ret_conv;
16477 }
16478
16479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16480         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
16481         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16482         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
16483         return tag_ptr(ret_conv, true);
16484 }
16485
16486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16487         LDKNodeFeatures o_conv;
16488         o_conv.inner = untag_ptr(o);
16489         o_conv.is_owned = ptr_is_owned(o);
16490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16491         o_conv = NodeFeatures_clone(&o_conv);
16492         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16493         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16494         return tag_ptr(ret_conv, true);
16495 }
16496
16497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16498         LDKDecodeError e_conv;
16499         e_conv.inner = untag_ptr(e);
16500         e_conv.is_owned = ptr_is_owned(e);
16501         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16502         e_conv = DecodeError_clone(&e_conv);
16503         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16504         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16505         return tag_ptr(ret_conv, true);
16506 }
16507
16508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16509         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
16510         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16511         return ret_conv;
16512 }
16513
16514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16515         if (!ptr_is_owned(_res)) return;
16516         void* _res_ptr = untag_ptr(_res);
16517         CHECK_ACCESS(_res_ptr);
16518         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16519         FREE(untag_ptr(_res));
16520         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16521 }
16522
16523 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16524         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16525         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
16526         return tag_ptr(ret_conv, true);
16527 }
16528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16529         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
16530         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16531         return ret_conv;
16532 }
16533
16534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16535         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
16536         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16537         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
16538         return tag_ptr(ret_conv, true);
16539 }
16540
16541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16542         LDKInvoiceFeatures o_conv;
16543         o_conv.inner = untag_ptr(o);
16544         o_conv.is_owned = ptr_is_owned(o);
16545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16546         o_conv = InvoiceFeatures_clone(&o_conv);
16547         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16548         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16549         return tag_ptr(ret_conv, true);
16550 }
16551
16552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16553         LDKDecodeError e_conv;
16554         e_conv.inner = untag_ptr(e);
16555         e_conv.is_owned = ptr_is_owned(e);
16556         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16557         e_conv = DecodeError_clone(&e_conv);
16558         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16559         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
16560         return tag_ptr(ret_conv, true);
16561 }
16562
16563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16564         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
16565         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
16566         return ret_conv;
16567 }
16568
16569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16570         if (!ptr_is_owned(_res)) return;
16571         void* _res_ptr = untag_ptr(_res);
16572         CHECK_ACCESS(_res_ptr);
16573         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
16574         FREE(untag_ptr(_res));
16575         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
16576 }
16577
16578 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16579         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16580         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
16581         return tag_ptr(ret_conv, true);
16582 }
16583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16584         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
16585         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16586         return ret_conv;
16587 }
16588
16589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16590         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
16591         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16592         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
16593         return tag_ptr(ret_conv, true);
16594 }
16595
16596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16597         LDKChannelTypeFeatures o_conv;
16598         o_conv.inner = untag_ptr(o);
16599         o_conv.is_owned = ptr_is_owned(o);
16600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16601         o_conv = ChannelTypeFeatures_clone(&o_conv);
16602         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16603         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
16604         return tag_ptr(ret_conv, true);
16605 }
16606
16607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16608         LDKDecodeError e_conv;
16609         e_conv.inner = untag_ptr(e);
16610         e_conv.is_owned = ptr_is_owned(e);
16611         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16612         e_conv = DecodeError_clone(&e_conv);
16613         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16614         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
16615         return tag_ptr(ret_conv, true);
16616 }
16617
16618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16619         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
16620         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
16621         return ret_conv;
16622 }
16623
16624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16625         if (!ptr_is_owned(_res)) return;
16626         void* _res_ptr = untag_ptr(_res);
16627         CHECK_ACCESS(_res_ptr);
16628         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
16629         FREE(untag_ptr(_res));
16630         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
16631 }
16632
16633 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
16634         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16635         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
16636         return tag_ptr(ret_conv, true);
16637 }
16638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16639         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
16640         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
16641         return ret_conv;
16642 }
16643
16644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16645         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
16646         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16647         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
16648         return tag_ptr(ret_conv, true);
16649 }
16650
16651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16652         LDKNodeId o_conv;
16653         o_conv.inner = untag_ptr(o);
16654         o_conv.is_owned = ptr_is_owned(o);
16655         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16656         o_conv = NodeId_clone(&o_conv);
16657         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16658         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
16659         return tag_ptr(ret_conv, true);
16660 }
16661
16662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16663         LDKDecodeError e_conv;
16664         e_conv.inner = untag_ptr(e);
16665         e_conv.is_owned = ptr_is_owned(e);
16666         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16667         e_conv = DecodeError_clone(&e_conv);
16668         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16669         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
16670         return tag_ptr(ret_conv, true);
16671 }
16672
16673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16674         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
16675         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
16676         return ret_conv;
16677 }
16678
16679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16680         if (!ptr_is_owned(_res)) return;
16681         void* _res_ptr = untag_ptr(_res);
16682         CHECK_ACCESS(_res_ptr);
16683         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
16684         FREE(untag_ptr(_res));
16685         CResult_NodeIdDecodeErrorZ_free(_res_conv);
16686 }
16687
16688 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
16689         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16690         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
16691         return tag_ptr(ret_conv, true);
16692 }
16693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16694         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
16695         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
16696         return ret_conv;
16697 }
16698
16699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16700         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
16701         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
16702         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
16703         return tag_ptr(ret_conv, true);
16704 }
16705
16706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16707         void* o_ptr = untag_ptr(o);
16708         CHECK_ACCESS(o_ptr);
16709         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
16710         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
16711         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16712         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
16713         return tag_ptr(ret_conv, true);
16714 }
16715
16716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16717         LDKDecodeError e_conv;
16718         e_conv.inner = untag_ptr(e);
16719         e_conv.is_owned = ptr_is_owned(e);
16720         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16721         e_conv = DecodeError_clone(&e_conv);
16722         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16723         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
16724         return tag_ptr(ret_conv, true);
16725 }
16726
16727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16728         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
16729         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
16730         return ret_conv;
16731 }
16732
16733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16734         if (!ptr_is_owned(_res)) return;
16735         void* _res_ptr = untag_ptr(_res);
16736         CHECK_ACCESS(_res_ptr);
16737         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
16738         FREE(untag_ptr(_res));
16739         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
16740 }
16741
16742 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
16743         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16744         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
16745         return tag_ptr(ret_conv, true);
16746 }
16747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16748         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
16749         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
16750         return ret_conv;
16751 }
16752
16753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16754         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
16755         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
16756         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
16757         return tag_ptr(ret_conv, true);
16758 }
16759
16760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16761         void* o_ptr = untag_ptr(o);
16762         CHECK_ACCESS(o_ptr);
16763         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
16764         if (o_conv.free == LDKAccess_JCalls_free) {
16765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16766                 LDKAccess_JCalls_cloned(&o_conv);
16767         }
16768         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16769         *ret_copy = COption_AccessZ_some(o_conv);
16770         int64_t ret_ref = tag_ptr(ret_copy, true);
16771         return ret_ref;
16772 }
16773
16774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
16775         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
16776         *ret_copy = COption_AccessZ_none();
16777         int64_t ret_ref = tag_ptr(ret_copy, true);
16778         return ret_ref;
16779 }
16780
16781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16782         if (!ptr_is_owned(_res)) return;
16783         void* _res_ptr = untag_ptr(_res);
16784         CHECK_ACCESS(_res_ptr);
16785         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
16786         FREE(untag_ptr(_res));
16787         COption_AccessZ_free(_res_conv);
16788 }
16789
16790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
16791         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16792         *ret_conv = CResult_boolLightningErrorZ_ok(o);
16793         return tag_ptr(ret_conv, true);
16794 }
16795
16796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16797         LDKLightningError e_conv;
16798         e_conv.inner = untag_ptr(e);
16799         e_conv.is_owned = ptr_is_owned(e);
16800         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16801         e_conv = LightningError_clone(&e_conv);
16802         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16803         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
16804         return tag_ptr(ret_conv, true);
16805 }
16806
16807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16808         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
16809         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
16810         return ret_conv;
16811 }
16812
16813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16814         if (!ptr_is_owned(_res)) return;
16815         void* _res_ptr = untag_ptr(_res);
16816         CHECK_ACCESS(_res_ptr);
16817         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
16818         FREE(untag_ptr(_res));
16819         CResult_boolLightningErrorZ_free(_res_conv);
16820 }
16821
16822 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
16823         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16824         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
16825         return tag_ptr(ret_conv, true);
16826 }
16827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16828         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
16829         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
16830         return ret_conv;
16831 }
16832
16833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16834         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
16835         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16836         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
16837         return tag_ptr(ret_conv, true);
16838 }
16839
16840 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
16841         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16842         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
16843         return tag_ptr(ret_conv, true);
16844 }
16845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16846         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
16847         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
16848         return ret_conv;
16849 }
16850
16851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16852         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
16853         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16854         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
16855         return tag_ptr(ret_conv, true);
16856 }
16857
16858 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) {
16859         LDKChannelAnnouncement a_conv;
16860         a_conv.inner = untag_ptr(a);
16861         a_conv.is_owned = ptr_is_owned(a);
16862         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16863         a_conv = ChannelAnnouncement_clone(&a_conv);
16864         LDKChannelUpdate b_conv;
16865         b_conv.inner = untag_ptr(b);
16866         b_conv.is_owned = ptr_is_owned(b);
16867         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16868         b_conv = ChannelUpdate_clone(&b_conv);
16869         LDKChannelUpdate c_conv;
16870         c_conv.inner = untag_ptr(c);
16871         c_conv.is_owned = ptr_is_owned(c);
16872         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
16873         c_conv = ChannelUpdate_clone(&c_conv);
16874         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
16875         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
16876         return tag_ptr(ret_conv, true);
16877 }
16878
16879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16880         if (!ptr_is_owned(_res)) return;
16881         void* _res_ptr = untag_ptr(_res);
16882         CHECK_ACCESS(_res_ptr);
16883         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
16884         FREE(untag_ptr(_res));
16885         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
16886 }
16887
16888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16889         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
16890         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16891         if (_res_constr.datalen > 0)
16892                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
16893         else
16894                 _res_constr.data = NULL;
16895         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16896         for (size_t h = 0; h < _res_constr.datalen; h++) {
16897                 int64_t _res_conv_59 = _res_vals[h];
16898                 void* _res_conv_59_ptr = untag_ptr(_res_conv_59);
16899                 CHECK_ACCESS(_res_conv_59_ptr);
16900                 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
16901                 FREE(untag_ptr(_res_conv_59));
16902                 _res_constr.data[h] = _res_conv_59_conv;
16903         }
16904         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16905         CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
16906 }
16907
16908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16909         LDKCVec_NodeAnnouncementZ _res_constr;
16910         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16911         if (_res_constr.datalen > 0)
16912                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
16913         else
16914                 _res_constr.data = NULL;
16915         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16916         for (size_t s = 0; s < _res_constr.datalen; s++) {
16917                 int64_t _res_conv_18 = _res_vals[s];
16918                 LDKNodeAnnouncement _res_conv_18_conv;
16919                 _res_conv_18_conv.inner = untag_ptr(_res_conv_18);
16920                 _res_conv_18_conv.is_owned = ptr_is_owned(_res_conv_18);
16921                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
16922                 _res_constr.data[s] = _res_conv_18_conv;
16923         }
16924         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16925         CVec_NodeAnnouncementZ_free(_res_constr);
16926 }
16927
16928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
16929         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16930         *ret_conv = CResult_NoneLightningErrorZ_ok();
16931         return tag_ptr(ret_conv, true);
16932 }
16933
16934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16935         LDKLightningError e_conv;
16936         e_conv.inner = untag_ptr(e);
16937         e_conv.is_owned = ptr_is_owned(e);
16938         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16939         e_conv = LightningError_clone(&e_conv);
16940         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16941         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
16942         return tag_ptr(ret_conv, true);
16943 }
16944
16945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16946         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
16947         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
16948         return ret_conv;
16949 }
16950
16951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16952         if (!ptr_is_owned(_res)) return;
16953         void* _res_ptr = untag_ptr(_res);
16954         CHECK_ACCESS(_res_ptr);
16955         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
16956         FREE(untag_ptr(_res));
16957         CResult_NoneLightningErrorZ_free(_res_conv);
16958 }
16959
16960 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
16961         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16962         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
16963         return tag_ptr(ret_conv, true);
16964 }
16965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16966         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
16967         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
16968         return ret_conv;
16969 }
16970
16971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16972         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
16973         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16974         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
16975         return tag_ptr(ret_conv, true);
16976 }
16977
16978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16979         LDKChannelUpdateInfo o_conv;
16980         o_conv.inner = untag_ptr(o);
16981         o_conv.is_owned = ptr_is_owned(o);
16982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16983         o_conv = ChannelUpdateInfo_clone(&o_conv);
16984         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16985         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
16986         return tag_ptr(ret_conv, true);
16987 }
16988
16989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16990         LDKDecodeError e_conv;
16991         e_conv.inner = untag_ptr(e);
16992         e_conv.is_owned = ptr_is_owned(e);
16993         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16994         e_conv = DecodeError_clone(&e_conv);
16995         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
16996         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
16997         return tag_ptr(ret_conv, true);
16998 }
16999
17000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17001         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
17002         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
17003         return ret_conv;
17004 }
17005
17006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17007         if (!ptr_is_owned(_res)) return;
17008         void* _res_ptr = untag_ptr(_res);
17009         CHECK_ACCESS(_res_ptr);
17010         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
17011         FREE(untag_ptr(_res));
17012         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
17013 }
17014
17015 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
17016         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17017         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
17018         return tag_ptr(ret_conv, true);
17019 }
17020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17021         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
17022         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
17023         return ret_conv;
17024 }
17025
17026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17027         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
17028         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
17029         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
17030         return tag_ptr(ret_conv, true);
17031 }
17032
17033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17034         LDKChannelInfo o_conv;
17035         o_conv.inner = untag_ptr(o);
17036         o_conv.is_owned = ptr_is_owned(o);
17037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17038         o_conv = ChannelInfo_clone(&o_conv);
17039         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17040         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
17041         return tag_ptr(ret_conv, true);
17042 }
17043
17044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17045         LDKDecodeError e_conv;
17046         e_conv.inner = untag_ptr(e);
17047         e_conv.is_owned = ptr_is_owned(e);
17048         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17049         e_conv = DecodeError_clone(&e_conv);
17050         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17051         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
17052         return tag_ptr(ret_conv, true);
17053 }
17054
17055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17056         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
17057         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
17058         return ret_conv;
17059 }
17060
17061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17062         if (!ptr_is_owned(_res)) return;
17063         void* _res_ptr = untag_ptr(_res);
17064         CHECK_ACCESS(_res_ptr);
17065         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
17066         FREE(untag_ptr(_res));
17067         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
17068 }
17069
17070 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
17071         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17072         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
17073         return tag_ptr(ret_conv, true);
17074 }
17075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17076         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
17077         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
17078         return ret_conv;
17079 }
17080
17081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17082         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
17083         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
17084         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
17085         return tag_ptr(ret_conv, true);
17086 }
17087
17088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17089         LDKRoutingFees o_conv;
17090         o_conv.inner = untag_ptr(o);
17091         o_conv.is_owned = ptr_is_owned(o);
17092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17093         o_conv = RoutingFees_clone(&o_conv);
17094         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17095         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
17096         return tag_ptr(ret_conv, true);
17097 }
17098
17099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17100         LDKDecodeError e_conv;
17101         e_conv.inner = untag_ptr(e);
17102         e_conv.is_owned = ptr_is_owned(e);
17103         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17104         e_conv = DecodeError_clone(&e_conv);
17105         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17106         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
17107         return tag_ptr(ret_conv, true);
17108 }
17109
17110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17111         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
17112         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
17113         return ret_conv;
17114 }
17115
17116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17117         if (!ptr_is_owned(_res)) return;
17118         void* _res_ptr = untag_ptr(_res);
17119         CHECK_ACCESS(_res_ptr);
17120         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
17121         FREE(untag_ptr(_res));
17122         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
17123 }
17124
17125 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
17126         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17127         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
17128         return tag_ptr(ret_conv, true);
17129 }
17130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17131         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
17132         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
17133         return ret_conv;
17134 }
17135
17136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17137         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
17138         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
17139         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
17140         return tag_ptr(ret_conv, true);
17141 }
17142
17143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17144         LDKCVec_NetAddressZ _res_constr;
17145         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17146         if (_res_constr.datalen > 0)
17147                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17148         else
17149                 _res_constr.data = NULL;
17150         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17151         for (size_t m = 0; m < _res_constr.datalen; m++) {
17152                 int64_t _res_conv_12 = _res_vals[m];
17153                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
17154                 CHECK_ACCESS(_res_conv_12_ptr);
17155                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17156                 FREE(untag_ptr(_res_conv_12));
17157                 _res_constr.data[m] = _res_conv_12_conv;
17158         }
17159         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17160         CVec_NetAddressZ_free(_res_constr);
17161 }
17162
17163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17164         LDKNodeAnnouncementInfo o_conv;
17165         o_conv.inner = untag_ptr(o);
17166         o_conv.is_owned = ptr_is_owned(o);
17167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17168         o_conv = NodeAnnouncementInfo_clone(&o_conv);
17169         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17170         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
17171         return tag_ptr(ret_conv, true);
17172 }
17173
17174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17175         LDKDecodeError e_conv;
17176         e_conv.inner = untag_ptr(e);
17177         e_conv.is_owned = ptr_is_owned(e);
17178         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17179         e_conv = DecodeError_clone(&e_conv);
17180         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17181         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
17182         return tag_ptr(ret_conv, true);
17183 }
17184
17185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17186         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
17187         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
17188         return ret_conv;
17189 }
17190
17191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17192         if (!ptr_is_owned(_res)) return;
17193         void* _res_ptr = untag_ptr(_res);
17194         CHECK_ACCESS(_res_ptr);
17195         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
17196         FREE(untag_ptr(_res));
17197         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
17198 }
17199
17200 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
17201         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17202         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
17203         return tag_ptr(ret_conv, true);
17204 }
17205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17206         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
17207         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
17208         return ret_conv;
17209 }
17210
17211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17212         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
17213         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
17214         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
17215         return tag_ptr(ret_conv, true);
17216 }
17217
17218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17219         LDKNodeAlias o_conv;
17220         o_conv.inner = untag_ptr(o);
17221         o_conv.is_owned = ptr_is_owned(o);
17222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17223         o_conv = NodeAlias_clone(&o_conv);
17224         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17225         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
17226         return tag_ptr(ret_conv, true);
17227 }
17228
17229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17230         LDKDecodeError e_conv;
17231         e_conv.inner = untag_ptr(e);
17232         e_conv.is_owned = ptr_is_owned(e);
17233         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17234         e_conv = DecodeError_clone(&e_conv);
17235         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17236         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
17237         return tag_ptr(ret_conv, true);
17238 }
17239
17240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17241         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
17242         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
17243         return ret_conv;
17244 }
17245
17246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17247         if (!ptr_is_owned(_res)) return;
17248         void* _res_ptr = untag_ptr(_res);
17249         CHECK_ACCESS(_res_ptr);
17250         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
17251         FREE(untag_ptr(_res));
17252         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
17253 }
17254
17255 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
17256         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17257         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
17258         return tag_ptr(ret_conv, true);
17259 }
17260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17261         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
17262         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
17263         return ret_conv;
17264 }
17265
17266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17267         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
17268         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
17269         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
17270         return tag_ptr(ret_conv, true);
17271 }
17272
17273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17274         LDKNodeInfo o_conv;
17275         o_conv.inner = untag_ptr(o);
17276         o_conv.is_owned = ptr_is_owned(o);
17277         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17278         o_conv = NodeInfo_clone(&o_conv);
17279         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17280         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
17281         return tag_ptr(ret_conv, true);
17282 }
17283
17284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17285         LDKDecodeError e_conv;
17286         e_conv.inner = untag_ptr(e);
17287         e_conv.is_owned = ptr_is_owned(e);
17288         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17289         e_conv = DecodeError_clone(&e_conv);
17290         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17291         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
17292         return tag_ptr(ret_conv, true);
17293 }
17294
17295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17296         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
17297         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
17298         return ret_conv;
17299 }
17300
17301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17302         if (!ptr_is_owned(_res)) return;
17303         void* _res_ptr = untag_ptr(_res);
17304         CHECK_ACCESS(_res_ptr);
17305         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
17306         FREE(untag_ptr(_res));
17307         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
17308 }
17309
17310 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
17311         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17312         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
17313         return tag_ptr(ret_conv, true);
17314 }
17315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17316         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
17317         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
17318         return ret_conv;
17319 }
17320
17321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17322         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
17323         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17324         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
17325         return tag_ptr(ret_conv, true);
17326 }
17327
17328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17329         LDKNetworkGraph o_conv;
17330         o_conv.inner = untag_ptr(o);
17331         o_conv.is_owned = ptr_is_owned(o);
17332         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17333         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
17334         
17335         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17336         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
17337         return tag_ptr(ret_conv, true);
17338 }
17339
17340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17341         LDKDecodeError e_conv;
17342         e_conv.inner = untag_ptr(e);
17343         e_conv.is_owned = ptr_is_owned(e);
17344         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17345         e_conv = DecodeError_clone(&e_conv);
17346         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17347         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
17348         return tag_ptr(ret_conv, true);
17349 }
17350
17351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17352         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
17353         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
17354         return ret_conv;
17355 }
17356
17357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17358         if (!ptr_is_owned(_res)) return;
17359         void* _res_ptr = untag_ptr(_res);
17360         CHECK_ACCESS(_res_ptr);
17361         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
17362         FREE(untag_ptr(_res));
17363         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
17364 }
17365
17366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
17367         LDKCVec_NetAddressZ o_constr;
17368         o_constr.datalen = (*env)->GetArrayLength(env, o);
17369         if (o_constr.datalen > 0)
17370                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17371         else
17372                 o_constr.data = NULL;
17373         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17374         for (size_t m = 0; m < o_constr.datalen; m++) {
17375                 int64_t o_conv_12 = o_vals[m];
17376                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
17377                 CHECK_ACCESS(o_conv_12_ptr);
17378                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
17379                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
17380                 o_constr.data[m] = o_conv_12_conv;
17381         }
17382         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17383         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17384         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
17385         int64_t ret_ref = tag_ptr(ret_copy, true);
17386         return ret_ref;
17387 }
17388
17389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
17390         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17391         *ret_copy = COption_CVec_NetAddressZZ_none();
17392         int64_t ret_ref = tag_ptr(ret_copy, true);
17393         return ret_ref;
17394 }
17395
17396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17397         if (!ptr_is_owned(_res)) return;
17398         void* _res_ptr = untag_ptr(_res);
17399         CHECK_ACCESS(_res_ptr);
17400         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
17401         FREE(untag_ptr(_res));
17402         COption_CVec_NetAddressZZ_free(_res_conv);
17403 }
17404
17405 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
17406         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17407         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
17408         int64_t ret_ref = tag_ptr(ret_copy, true);
17409         return ret_ref;
17410 }
17411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17412         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
17413         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
17414         return ret_conv;
17415 }
17416
17417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17418         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
17419         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
17420         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
17421         int64_t ret_ref = tag_ptr(ret_copy, true);
17422         return ret_ref;
17423 }
17424
17425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17426         LDKDelayedPaymentOutputDescriptor o_conv;
17427         o_conv.inner = untag_ptr(o);
17428         o_conv.is_owned = ptr_is_owned(o);
17429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17430         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
17431         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17432         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17433         return tag_ptr(ret_conv, true);
17434 }
17435
17436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17437         LDKDecodeError e_conv;
17438         e_conv.inner = untag_ptr(e);
17439         e_conv.is_owned = ptr_is_owned(e);
17440         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17441         e_conv = DecodeError_clone(&e_conv);
17442         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17443         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17444         return tag_ptr(ret_conv, true);
17445 }
17446
17447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17448         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17449         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17450         return ret_conv;
17451 }
17452
17453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17454         if (!ptr_is_owned(_res)) return;
17455         void* _res_ptr = untag_ptr(_res);
17456         CHECK_ACCESS(_res_ptr);
17457         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17458         FREE(untag_ptr(_res));
17459         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17460 }
17461
17462 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17463         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17464         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17465         return tag_ptr(ret_conv, true);
17466 }
17467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17468         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17469         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17470         return ret_conv;
17471 }
17472
17473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17474         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17475         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17476         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17477         return tag_ptr(ret_conv, true);
17478 }
17479
17480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17481         LDKStaticPaymentOutputDescriptor o_conv;
17482         o_conv.inner = untag_ptr(o);
17483         o_conv.is_owned = ptr_is_owned(o);
17484         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17485         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
17486         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17487         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
17488         return tag_ptr(ret_conv, true);
17489 }
17490
17491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17492         LDKDecodeError e_conv;
17493         e_conv.inner = untag_ptr(e);
17494         e_conv.is_owned = ptr_is_owned(e);
17495         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17496         e_conv = DecodeError_clone(&e_conv);
17497         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17498         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
17499         return tag_ptr(ret_conv, true);
17500 }
17501
17502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17503         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17504         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17505         return ret_conv;
17506 }
17507
17508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17509         if (!ptr_is_owned(_res)) return;
17510         void* _res_ptr = untag_ptr(_res);
17511         CHECK_ACCESS(_res_ptr);
17512         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
17513         FREE(untag_ptr(_res));
17514         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
17515 }
17516
17517 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17518         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17519         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
17520         return tag_ptr(ret_conv, true);
17521 }
17522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17523         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17524         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17525         return ret_conv;
17526 }
17527
17528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17529         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17530         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17531         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
17532         return tag_ptr(ret_conv, true);
17533 }
17534
17535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17536         void* o_ptr = untag_ptr(o);
17537         CHECK_ACCESS(o_ptr);
17538         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
17539         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
17540         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17541         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
17542         return tag_ptr(ret_conv, true);
17543 }
17544
17545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17546         LDKDecodeError e_conv;
17547         e_conv.inner = untag_ptr(e);
17548         e_conv.is_owned = ptr_is_owned(e);
17549         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17550         e_conv = DecodeError_clone(&e_conv);
17551         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17552         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
17553         return tag_ptr(ret_conv, true);
17554 }
17555
17556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17557         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
17558         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
17559         return ret_conv;
17560 }
17561
17562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17563         if (!ptr_is_owned(_res)) return;
17564         void* _res_ptr = untag_ptr(_res);
17565         CHECK_ACCESS(_res_ptr);
17566         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
17567         FREE(untag_ptr(_res));
17568         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
17569 }
17570
17571 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
17572         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17573         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
17574         return tag_ptr(ret_conv, true);
17575 }
17576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17577         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
17578         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
17579         return ret_conv;
17580 }
17581
17582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17583         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
17584         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17585         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
17586         return tag_ptr(ret_conv, true);
17587 }
17588
17589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17590         LDKCVec_PaymentPreimageZ _res_constr;
17591         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17592         if (_res_constr.datalen > 0)
17593                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
17594         else
17595                 _res_constr.data = NULL;
17596         for (size_t i = 0; i < _res_constr.datalen; i++) {
17597                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17598                 LDKThirtyTwoBytes _res_conv_8_ref;
17599                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
17600                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
17601                 _res_constr.data[i] = _res_conv_8_ref;
17602         }
17603         CVec_PaymentPreimageZ_free(_res_constr);
17604 }
17605
17606 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
17607         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17608         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
17609         return tag_ptr(ret_conv, true);
17610 }
17611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17612         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
17613         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
17614         return ret_conv;
17615 }
17616
17617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17618         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
17619         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17620         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
17621         return tag_ptr(ret_conv, true);
17622 }
17623
17624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
17625         LDKSignature a_ref;
17626         CHECK((*env)->GetArrayLength(env, a) == 64);
17627         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
17628         LDKCVec_SignatureZ b_constr;
17629         b_constr.datalen = (*env)->GetArrayLength(env, b);
17630         if (b_constr.datalen > 0)
17631                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17632         else
17633                 b_constr.data = NULL;
17634         for (size_t i = 0; i < b_constr.datalen; i++) {
17635                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
17636                 LDKSignature b_conv_8_ref;
17637                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
17638                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
17639                 b_constr.data[i] = b_conv_8_ref;
17640         }
17641         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
17642         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
17643         return tag_ptr(ret_conv, true);
17644 }
17645
17646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17647         if (!ptr_is_owned(_res)) return;
17648         void* _res_ptr = untag_ptr(_res);
17649         CHECK_ACCESS(_res_ptr);
17650         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
17651         FREE(untag_ptr(_res));
17652         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
17653 }
17654
17655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17656         void* o_ptr = untag_ptr(o);
17657         CHECK_ACCESS(o_ptr);
17658         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
17659         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
17660         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17661         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
17662         return tag_ptr(ret_conv, true);
17663 }
17664
17665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
17666         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17667         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
17668         return tag_ptr(ret_conv, true);
17669 }
17670
17671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17672         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
17673         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
17674         return ret_conv;
17675 }
17676
17677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17678         if (!ptr_is_owned(_res)) return;
17679         void* _res_ptr = untag_ptr(_res);
17680         CHECK_ACCESS(_res_ptr);
17681         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
17682         FREE(untag_ptr(_res));
17683         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
17684 }
17685
17686 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
17687         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17688         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
17689         return tag_ptr(ret_conv, true);
17690 }
17691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17692         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
17693         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
17694         return ret_conv;
17695 }
17696
17697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17698         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
17699         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
17700         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
17701         return tag_ptr(ret_conv, true);
17702 }
17703
17704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17705         LDKSignature o_ref;
17706         CHECK((*env)->GetArrayLength(env, o) == 64);
17707         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
17708         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17709         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
17710         return tag_ptr(ret_conv, true);
17711 }
17712
17713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17714         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17715         *ret_conv = CResult_SignatureNoneZ_err();
17716         return tag_ptr(ret_conv, true);
17717 }
17718
17719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17720         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
17721         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
17722         return ret_conv;
17723 }
17724
17725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17726         if (!ptr_is_owned(_res)) return;
17727         void* _res_ptr = untag_ptr(_res);
17728         CHECK_ACCESS(_res_ptr);
17729         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
17730         FREE(untag_ptr(_res));
17731         CResult_SignatureNoneZ_free(_res_conv);
17732 }
17733
17734 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
17735         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17736         *ret_conv = CResult_SignatureNoneZ_clone(arg);
17737         return tag_ptr(ret_conv, true);
17738 }
17739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17740         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
17741         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
17742         return ret_conv;
17743 }
17744
17745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17746         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
17747         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
17748         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
17749         return tag_ptr(ret_conv, true);
17750 }
17751
17752 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
17753         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17754         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
17755         return tag_ptr(ret_conv, true);
17756 }
17757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17758         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
17759         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
17760         return ret_conv;
17761 }
17762
17763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17764         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
17765         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17766         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
17767         return tag_ptr(ret_conv, true);
17768 }
17769
17770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17771         LDKSignature a_ref;
17772         CHECK((*env)->GetArrayLength(env, a) == 64);
17773         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
17774         LDKSignature b_ref;
17775         CHECK((*env)->GetArrayLength(env, b) == 64);
17776         (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
17777         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
17778         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
17779         return tag_ptr(ret_conv, true);
17780 }
17781
17782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_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         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
17787         FREE(untag_ptr(_res));
17788         C2Tuple_SignatureSignatureZ_free(_res_conv);
17789 }
17790
17791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17792         void* o_ptr = untag_ptr(o);
17793         CHECK_ACCESS(o_ptr);
17794         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
17795         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
17796         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17797         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
17798         return tag_ptr(ret_conv, true);
17799 }
17800
17801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
17802         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17803         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
17804         return tag_ptr(ret_conv, true);
17805 }
17806
17807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17808         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
17809         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
17810         return ret_conv;
17811 }
17812
17813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17814         if (!ptr_is_owned(_res)) return;
17815         void* _res_ptr = untag_ptr(_res);
17816         CHECK_ACCESS(_res_ptr);
17817         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
17818         FREE(untag_ptr(_res));
17819         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
17820 }
17821
17822 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
17823         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17824         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
17825         return tag_ptr(ret_conv, true);
17826 }
17827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17828         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
17829         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
17830         return ret_conv;
17831 }
17832
17833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17834         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
17835         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17836         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
17837         return tag_ptr(ret_conv, true);
17838 }
17839
17840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17841         LDKSecretKey o_ref;
17842         CHECK((*env)->GetArrayLength(env, o) == 32);
17843         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
17844         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17845         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
17846         return tag_ptr(ret_conv, true);
17847 }
17848
17849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
17850         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17851         *ret_conv = CResult_SecretKeyNoneZ_err();
17852         return tag_ptr(ret_conv, true);
17853 }
17854
17855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17856         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
17857         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
17858         return ret_conv;
17859 }
17860
17861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17862         if (!ptr_is_owned(_res)) return;
17863         void* _res_ptr = untag_ptr(_res);
17864         CHECK_ACCESS(_res_ptr);
17865         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
17866         FREE(untag_ptr(_res));
17867         CResult_SecretKeyNoneZ_free(_res_conv);
17868 }
17869
17870 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
17871         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17872         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
17873         return tag_ptr(ret_conv, true);
17874 }
17875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17876         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
17877         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
17878         return ret_conv;
17879 }
17880
17881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17882         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
17883         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17884         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
17885         return tag_ptr(ret_conv, true);
17886 }
17887
17888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17889         void* o_ptr = untag_ptr(o);
17890         CHECK_ACCESS(o_ptr);
17891         LDKSign o_conv = *(LDKSign*)(o_ptr);
17892         if (o_conv.free == LDKSign_JCalls_free) {
17893                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17894                 LDKSign_JCalls_cloned(&o_conv);
17895         }
17896         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17897         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
17898         return tag_ptr(ret_conv, true);
17899 }
17900
17901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17902         LDKDecodeError e_conv;
17903         e_conv.inner = untag_ptr(e);
17904         e_conv.is_owned = ptr_is_owned(e);
17905         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17906         e_conv = DecodeError_clone(&e_conv);
17907         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17908         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
17909         return tag_ptr(ret_conv, true);
17910 }
17911
17912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17913         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
17914         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
17915         return ret_conv;
17916 }
17917
17918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17919         if (!ptr_is_owned(_res)) return;
17920         void* _res_ptr = untag_ptr(_res);
17921         CHECK_ACCESS(_res_ptr);
17922         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
17923         FREE(untag_ptr(_res));
17924         CResult_SignDecodeErrorZ_free(_res_conv);
17925 }
17926
17927 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
17928         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17929         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
17930         return tag_ptr(ret_conv, true);
17931 }
17932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17933         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
17934         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
17935         return ret_conv;
17936 }
17937
17938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17939         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
17940         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17941         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
17942         return tag_ptr(ret_conv, true);
17943 }
17944
17945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17946         LDKCVec_u5Z _res_constr;
17947         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17948         if (_res_constr.datalen > 0)
17949                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
17950         else
17951                 _res_constr.data = NULL;
17952         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
17953         for (size_t h = 0; h < _res_constr.datalen; h++) {
17954                 int8_t _res_conv_7 = _res_vals[h];
17955                 
17956                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
17957         }
17958         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
17959         CVec_u5Z_free(_res_constr);
17960 }
17961
17962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17963         LDKRecoverableSignature o_ref;
17964         CHECK((*env)->GetArrayLength(env, o) == 68);
17965         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
17966         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17967         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
17968         return tag_ptr(ret_conv, true);
17969 }
17970
17971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17972         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17973         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
17974         return tag_ptr(ret_conv, true);
17975 }
17976
17977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17978         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
17979         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
17980         return ret_conv;
17981 }
17982
17983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17984         if (!ptr_is_owned(_res)) return;
17985         void* _res_ptr = untag_ptr(_res);
17986         CHECK_ACCESS(_res_ptr);
17987         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
17988         FREE(untag_ptr(_res));
17989         CResult_RecoverableSignatureNoneZ_free(_res_conv);
17990 }
17991
17992 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
17993         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17994         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
17995         return tag_ptr(ret_conv, true);
17996 }
17997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17998         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
17999         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
18000         return ret_conv;
18001 }
18002
18003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18004         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
18005         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
18006         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
18007         return tag_ptr(ret_conv, true);
18008 }
18009
18010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
18011         LDKCVec_u8Z _res_ref;
18012         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
18013         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18014         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
18015         CVec_u8Z_free(_res_ref);
18016 }
18017
18018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18019         LDKCVec_CVec_u8ZZ _res_constr;
18020         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18021         if (_res_constr.datalen > 0)
18022                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18023         else
18024                 _res_constr.data = NULL;
18025         for (size_t i = 0; i < _res_constr.datalen; i++) {
18026                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18027                 LDKCVec_u8Z _res_conv_8_ref;
18028                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
18029                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18030                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
18031                 _res_constr.data[i] = _res_conv_8_ref;
18032         }
18033         CVec_CVec_u8ZZ_free(_res_constr);
18034 }
18035
18036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
18037         LDKCVec_CVec_u8ZZ o_constr;
18038         o_constr.datalen = (*env)->GetArrayLength(env, o);
18039         if (o_constr.datalen > 0)
18040                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
18041         else
18042                 o_constr.data = NULL;
18043         for (size_t i = 0; i < o_constr.datalen; i++) {
18044                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
18045                 LDKCVec_u8Z o_conv_8_ref;
18046                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
18047                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
18048                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
18049                 o_constr.data[i] = o_conv_8_ref;
18050         }
18051         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18052         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
18053         return tag_ptr(ret_conv, true);
18054 }
18055
18056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
18057         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18058         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
18059         return tag_ptr(ret_conv, true);
18060 }
18061
18062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18063         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
18064         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
18065         return ret_conv;
18066 }
18067
18068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18069         if (!ptr_is_owned(_res)) return;
18070         void* _res_ptr = untag_ptr(_res);
18071         CHECK_ACCESS(_res_ptr);
18072         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
18073         FREE(untag_ptr(_res));
18074         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
18075 }
18076
18077 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
18078         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18079         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
18080         return tag_ptr(ret_conv, true);
18081 }
18082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18083         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
18084         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
18085         return ret_conv;
18086 }
18087
18088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18089         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
18090         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
18091         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
18092         return tag_ptr(ret_conv, true);
18093 }
18094
18095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18096         LDKInMemorySigner o_conv;
18097         o_conv.inner = untag_ptr(o);
18098         o_conv.is_owned = ptr_is_owned(o);
18099         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18100         o_conv = InMemorySigner_clone(&o_conv);
18101         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18102         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
18103         return tag_ptr(ret_conv, true);
18104 }
18105
18106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18107         LDKDecodeError e_conv;
18108         e_conv.inner = untag_ptr(e);
18109         e_conv.is_owned = ptr_is_owned(e);
18110         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18111         e_conv = DecodeError_clone(&e_conv);
18112         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18113         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
18114         return tag_ptr(ret_conv, true);
18115 }
18116
18117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18118         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
18119         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
18120         return ret_conv;
18121 }
18122
18123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18124         if (!ptr_is_owned(_res)) return;
18125         void* _res_ptr = untag_ptr(_res);
18126         CHECK_ACCESS(_res_ptr);
18127         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
18128         FREE(untag_ptr(_res));
18129         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
18130 }
18131
18132 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
18133         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18134         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
18135         return tag_ptr(ret_conv, true);
18136 }
18137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18138         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
18139         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
18140         return ret_conv;
18141 }
18142
18143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18144         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
18145         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
18146         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
18147         return tag_ptr(ret_conv, true);
18148 }
18149
18150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18151         LDKCVec_TxOutZ _res_constr;
18152         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18153         if (_res_constr.datalen > 0)
18154                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18155         else
18156                 _res_constr.data = NULL;
18157         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18158         for (size_t h = 0; h < _res_constr.datalen; h++) {
18159                 int64_t _res_conv_7 = _res_vals[h];
18160                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18161                 CHECK_ACCESS(_res_conv_7_ptr);
18162                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
18163                 FREE(untag_ptr(_res_conv_7));
18164                 _res_constr.data[h] = _res_conv_7_conv;
18165         }
18166         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18167         CVec_TxOutZ_free(_res_constr);
18168 }
18169
18170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18171         LDKTransaction o_ref;
18172         o_ref.datalen = (*env)->GetArrayLength(env, o);
18173         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
18174         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
18175         o_ref.data_is_owned = true;
18176         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18177         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
18178         return tag_ptr(ret_conv, true);
18179 }
18180
18181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
18182         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18183         *ret_conv = CResult_TransactionNoneZ_err();
18184         return tag_ptr(ret_conv, true);
18185 }
18186
18187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18188         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
18189         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
18190         return ret_conv;
18191 }
18192
18193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18194         if (!ptr_is_owned(_res)) return;
18195         void* _res_ptr = untag_ptr(_res);
18196         CHECK_ACCESS(_res_ptr);
18197         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
18198         FREE(untag_ptr(_res));
18199         CResult_TransactionNoneZ_free(_res_conv);
18200 }
18201
18202 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
18203         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18204         *ret_conv = CResult_TransactionNoneZ_clone(arg);
18205         return tag_ptr(ret_conv, true);
18206 }
18207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18208         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
18209         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
18210         return ret_conv;
18211 }
18212
18213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18214         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
18215         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18216         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
18217         return tag_ptr(ret_conv, true);
18218 }
18219
18220 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18221         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18222         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18223         return tag_ptr(ret_conv, true);
18224 }
18225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18226         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18227         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18228         return ret_conv;
18229 }
18230
18231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18232         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18233         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18234         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18235         return tag_ptr(ret_conv, true);
18236 }
18237
18238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18239         LDKThirtyTwoBytes a_ref;
18240         CHECK((*env)->GetArrayLength(env, a) == 32);
18241         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18242         LDKChannelMonitor b_conv;
18243         b_conv.inner = untag_ptr(b);
18244         b_conv.is_owned = ptr_is_owned(b);
18245         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18246         b_conv = ChannelMonitor_clone(&b_conv);
18247         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18248         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18249         return tag_ptr(ret_conv, true);
18250 }
18251
18252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18253         if (!ptr_is_owned(_res)) return;
18254         void* _res_ptr = untag_ptr(_res);
18255         CHECK_ACCESS(_res_ptr);
18256         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18257         FREE(untag_ptr(_res));
18258         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18259 }
18260
18261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18262         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
18263         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18264         if (_res_constr.datalen > 0)
18265                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18266         else
18267                 _res_constr.data = NULL;
18268         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18269         for (size_t j = 0; j < _res_constr.datalen; j++) {
18270                 int64_t _res_conv_35 = _res_vals[j];
18271                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
18272                 CHECK_ACCESS(_res_conv_35_ptr);
18273                 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
18274                 FREE(untag_ptr(_res_conv_35));
18275                 _res_constr.data[j] = _res_conv_35_conv;
18276         }
18277         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18278         CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
18279 }
18280
18281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
18282         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
18283         o_constr.datalen = (*env)->GetArrayLength(env, o);
18284         if (o_constr.datalen > 0)
18285                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
18286         else
18287                 o_constr.data = NULL;
18288         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
18289         for (size_t j = 0; j < o_constr.datalen; j++) {
18290                 int64_t o_conv_35 = o_vals[j];
18291                 void* o_conv_35_ptr = untag_ptr(o_conv_35);
18292                 CHECK_ACCESS(o_conv_35_ptr);
18293                 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
18294                 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o_conv_35));
18295                 o_constr.data[j] = o_conv_35_conv;
18296         }
18297         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
18298         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18299         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
18300         return tag_ptr(ret_conv, true);
18301 }
18302
18303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18304         LDKIOError e_conv = LDKIOError_from_java(env, e);
18305         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18306         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
18307         return tag_ptr(ret_conv, true);
18308 }
18309
18310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18311         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(o);
18312         jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
18313         return ret_conv;
18314 }
18315
18316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18317         if (!ptr_is_owned(_res)) return;
18318         void* _res_ptr = untag_ptr(_res);
18319         CHECK_ACCESS(_res_ptr);
18320         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
18321         FREE(untag_ptr(_res));
18322         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
18323 }
18324
18325 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
18326         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18327         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
18328         return tag_ptr(ret_conv, true);
18329 }
18330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18331         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(arg);
18332         int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
18333         return ret_conv;
18334 }
18335
18336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18337         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(orig);
18338         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
18339         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
18340         return tag_ptr(ret_conv, true);
18341 }
18342
18343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
18344         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18345         *ret_copy = COption_u16Z_some(o);
18346         int64_t ret_ref = tag_ptr(ret_copy, true);
18347         return ret_ref;
18348 }
18349
18350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
18351         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18352         *ret_copy = COption_u16Z_none();
18353         int64_t ret_ref = tag_ptr(ret_copy, true);
18354         return ret_ref;
18355 }
18356
18357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
18358         if (!ptr_is_owned(_res)) return;
18359         void* _res_ptr = untag_ptr(_res);
18360         CHECK_ACCESS(_res_ptr);
18361         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
18362         FREE(untag_ptr(_res));
18363         COption_u16Z_free(_res_conv);
18364 }
18365
18366 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
18367         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18368         *ret_copy = COption_u16Z_clone(arg);
18369         int64_t ret_ref = tag_ptr(ret_copy, true);
18370         return ret_ref;
18371 }
18372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18373         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
18374         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
18375         return ret_conv;
18376 }
18377
18378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18379         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
18380         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18381         *ret_copy = COption_u16Z_clone(orig_conv);
18382         int64_t ret_ref = tag_ptr(ret_copy, true);
18383         return ret_ref;
18384 }
18385
18386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
18387         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18388         *ret_conv = CResult_NoneAPIErrorZ_ok();
18389         return tag_ptr(ret_conv, true);
18390 }
18391
18392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18393         void* e_ptr = untag_ptr(e);
18394         CHECK_ACCESS(e_ptr);
18395         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18396         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18397         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18398         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18399         return tag_ptr(ret_conv, true);
18400 }
18401
18402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18403         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18404         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18405         return ret_conv;
18406 }
18407
18408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18409         if (!ptr_is_owned(_res)) return;
18410         void* _res_ptr = untag_ptr(_res);
18411         CHECK_ACCESS(_res_ptr);
18412         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18413         FREE(untag_ptr(_res));
18414         CResult_NoneAPIErrorZ_free(_res_conv);
18415 }
18416
18417 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18418         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18419         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18420         return tag_ptr(ret_conv, true);
18421 }
18422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18423         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18424         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18425         return ret_conv;
18426 }
18427
18428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18429         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18430         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18431         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18432         return tag_ptr(ret_conv, true);
18433 }
18434
18435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18436         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18437         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18438         if (_res_constr.datalen > 0)
18439                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18440         else
18441                 _res_constr.data = NULL;
18442         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18443         for (size_t w = 0; w < _res_constr.datalen; w++) {
18444                 int64_t _res_conv_22 = _res_vals[w];
18445                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18446                 CHECK_ACCESS(_res_conv_22_ptr);
18447                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18448                 FREE(untag_ptr(_res_conv_22));
18449                 _res_constr.data[w] = _res_conv_22_conv;
18450         }
18451         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18452         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18453 }
18454
18455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18456         LDKCVec_APIErrorZ _res_constr;
18457         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18458         if (_res_constr.datalen > 0)
18459                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18460         else
18461                 _res_constr.data = NULL;
18462         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18463         for (size_t k = 0; k < _res_constr.datalen; k++) {
18464                 int64_t _res_conv_10 = _res_vals[k];
18465                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18466                 CHECK_ACCESS(_res_conv_10_ptr);
18467                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18468                 FREE(untag_ptr(_res_conv_10));
18469                 _res_constr.data[k] = _res_conv_10_conv;
18470         }
18471         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18472         CVec_APIErrorZ_free(_res_constr);
18473 }
18474
18475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18476         LDKThirtyTwoBytes o_ref;
18477         CHECK((*env)->GetArrayLength(env, o) == 32);
18478         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18479         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18480         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
18481         return tag_ptr(ret_conv, true);
18482 }
18483
18484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18485         void* e_ptr = untag_ptr(e);
18486         CHECK_ACCESS(e_ptr);
18487         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18488         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18489         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18490         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
18491         return tag_ptr(ret_conv, true);
18492 }
18493
18494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18495         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
18496         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
18497         return ret_conv;
18498 }
18499
18500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18501         if (!ptr_is_owned(_res)) return;
18502         void* _res_ptr = untag_ptr(_res);
18503         CHECK_ACCESS(_res_ptr);
18504         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
18505         FREE(untag_ptr(_res));
18506         CResult__u832APIErrorZ_free(_res_conv);
18507 }
18508
18509 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
18510         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18511         *ret_conv = CResult__u832APIErrorZ_clone(arg);
18512         return tag_ptr(ret_conv, true);
18513 }
18514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18515         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
18516         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
18517         return ret_conv;
18518 }
18519
18520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18521         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
18522         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
18523         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
18524         return tag_ptr(ret_conv, true);
18525 }
18526
18527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18528         LDKThirtyTwoBytes o_ref;
18529         CHECK((*env)->GetArrayLength(env, o) == 32);
18530         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18531         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18532         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
18533         return tag_ptr(ret_conv, true);
18534 }
18535
18536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18537         void* e_ptr = untag_ptr(e);
18538         CHECK_ACCESS(e_ptr);
18539         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18540         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18541         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18542         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
18543         return tag_ptr(ret_conv, true);
18544 }
18545
18546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18547         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
18548         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
18549         return ret_conv;
18550 }
18551
18552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18553         if (!ptr_is_owned(_res)) return;
18554         void* _res_ptr = untag_ptr(_res);
18555         CHECK_ACCESS(_res_ptr);
18556         LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
18557         FREE(untag_ptr(_res));
18558         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
18559 }
18560
18561 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
18562         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18563         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
18564         return tag_ptr(ret_conv, true);
18565 }
18566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18567         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
18568         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
18569         return ret_conv;
18570 }
18571
18572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18573         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
18574         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
18575         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
18576         return tag_ptr(ret_conv, true);
18577 }
18578
18579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
18580         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18581         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
18582         return tag_ptr(ret_conv, true);
18583 }
18584
18585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18586         void* e_ptr = untag_ptr(e);
18587         CHECK_ACCESS(e_ptr);
18588         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18589         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18590         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18591         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
18592         return tag_ptr(ret_conv, true);
18593 }
18594
18595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18596         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
18597         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
18598         return ret_conv;
18599 }
18600
18601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18602         if (!ptr_is_owned(_res)) return;
18603         void* _res_ptr = untag_ptr(_res);
18604         CHECK_ACCESS(_res_ptr);
18605         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
18606         FREE(untag_ptr(_res));
18607         CResult_NonePaymentSendFailureZ_free(_res_conv);
18608 }
18609
18610 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
18611         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18612         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
18613         return tag_ptr(ret_conv, true);
18614 }
18615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18616         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
18617         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
18618         return ret_conv;
18619 }
18620
18621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18622         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
18623         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18624         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
18625         return tag_ptr(ret_conv, true);
18626 }
18627
18628 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
18629         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18630         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
18631         return tag_ptr(ret_conv, true);
18632 }
18633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18634         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
18635         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
18636         return ret_conv;
18637 }
18638
18639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18640         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
18641         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18642         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
18643         return tag_ptr(ret_conv, true);
18644 }
18645
18646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18647         LDKThirtyTwoBytes a_ref;
18648         CHECK((*env)->GetArrayLength(env, a) == 32);
18649         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18650         LDKThirtyTwoBytes b_ref;
18651         CHECK((*env)->GetArrayLength(env, b) == 32);
18652         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18653         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
18654         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
18655         return tag_ptr(ret_conv, true);
18656 }
18657
18658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18659         if (!ptr_is_owned(_res)) return;
18660         void* _res_ptr = untag_ptr(_res);
18661         CHECK_ACCESS(_res_ptr);
18662         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
18663         FREE(untag_ptr(_res));
18664         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
18665 }
18666
18667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18668         void* o_ptr = untag_ptr(o);
18669         CHECK_ACCESS(o_ptr);
18670         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
18671         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
18672         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18673         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
18674         return tag_ptr(ret_conv, true);
18675 }
18676
18677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18678         void* e_ptr = untag_ptr(e);
18679         CHECK_ACCESS(e_ptr);
18680         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
18681         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
18682         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18683         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
18684         return tag_ptr(ret_conv, true);
18685 }
18686
18687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18688         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
18689         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
18690         return ret_conv;
18691 }
18692
18693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18694         if (!ptr_is_owned(_res)) return;
18695         void* _res_ptr = untag_ptr(_res);
18696         CHECK_ACCESS(_res_ptr);
18697         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
18698         FREE(untag_ptr(_res));
18699         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
18700 }
18701
18702 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
18703         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18704         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
18705         return tag_ptr(ret_conv, true);
18706 }
18707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18708         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
18709         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
18710         return ret_conv;
18711 }
18712
18713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18714         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
18715         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
18716         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
18717         return tag_ptr(ret_conv, true);
18718 }
18719
18720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18721         LDKCVec_ThirtyTwoBytesZ _res_constr;
18722         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18723         if (_res_constr.datalen > 0)
18724                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
18725         else
18726                 _res_constr.data = NULL;
18727         for (size_t i = 0; i < _res_constr.datalen; i++) {
18728                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18729                 LDKThirtyTwoBytes _res_conv_8_ref;
18730                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
18731                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
18732                 _res_constr.data[i] = _res_conv_8_ref;
18733         }
18734         CVec_ThirtyTwoBytesZ_free(_res_constr);
18735 }
18736
18737 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
18738         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18739         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
18740         return tag_ptr(ret_conv, true);
18741 }
18742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18743         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
18744         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
18745         return ret_conv;
18746 }
18747
18748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18749         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
18750         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18751         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
18752         return tag_ptr(ret_conv, true);
18753 }
18754
18755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
18756         LDKThirtyTwoBytes a_ref;
18757         CHECK((*env)->GetArrayLength(env, a) == 32);
18758         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18759         LDKThirtyTwoBytes b_ref;
18760         CHECK((*env)->GetArrayLength(env, b) == 32);
18761         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18762         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18763         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
18764         return tag_ptr(ret_conv, true);
18765 }
18766
18767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18768         if (!ptr_is_owned(_res)) return;
18769         void* _res_ptr = untag_ptr(_res);
18770         CHECK_ACCESS(_res_ptr);
18771         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
18772         FREE(untag_ptr(_res));
18773         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
18774 }
18775
18776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18777         void* o_ptr = untag_ptr(o);
18778         CHECK_ACCESS(o_ptr);
18779         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18780         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
18781         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18782         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
18783         return tag_ptr(ret_conv, true);
18784 }
18785
18786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
18787         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18788         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
18789         return tag_ptr(ret_conv, true);
18790 }
18791
18792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18793         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
18794         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
18795         return ret_conv;
18796 }
18797
18798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18799         if (!ptr_is_owned(_res)) return;
18800         void* _res_ptr = untag_ptr(_res);
18801         CHECK_ACCESS(_res_ptr);
18802         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
18803         FREE(untag_ptr(_res));
18804         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
18805 }
18806
18807 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
18808         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18809         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
18810         return tag_ptr(ret_conv, true);
18811 }
18812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18813         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
18814         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
18815         return ret_conv;
18816 }
18817
18818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18819         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
18820         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18821         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
18822         return tag_ptr(ret_conv, true);
18823 }
18824
18825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18826         void* o_ptr = untag_ptr(o);
18827         CHECK_ACCESS(o_ptr);
18828         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18829         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
18830         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18831         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
18832         return tag_ptr(ret_conv, true);
18833 }
18834
18835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18836         void* e_ptr = untag_ptr(e);
18837         CHECK_ACCESS(e_ptr);
18838         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18839         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18840         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18841         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
18842         return tag_ptr(ret_conv, true);
18843 }
18844
18845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18846         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
18847         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
18848         return ret_conv;
18849 }
18850
18851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18852         if (!ptr_is_owned(_res)) return;
18853         void* _res_ptr = untag_ptr(_res);
18854         CHECK_ACCESS(_res_ptr);
18855         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
18856         FREE(untag_ptr(_res));
18857         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
18858 }
18859
18860 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
18861         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18862         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
18863         return tag_ptr(ret_conv, true);
18864 }
18865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18866         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
18867         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
18868         return ret_conv;
18869 }
18870
18871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18872         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
18873         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18874         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
18875         return tag_ptr(ret_conv, true);
18876 }
18877
18878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18879         LDKThirtyTwoBytes o_ref;
18880         CHECK((*env)->GetArrayLength(env, o) == 32);
18881         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18882         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18883         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
18884         return tag_ptr(ret_conv, true);
18885 }
18886
18887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
18888         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18889         *ret_conv = CResult_PaymentSecretNoneZ_err();
18890         return tag_ptr(ret_conv, true);
18891 }
18892
18893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18894         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
18895         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
18896         return ret_conv;
18897 }
18898
18899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18900         if (!ptr_is_owned(_res)) return;
18901         void* _res_ptr = untag_ptr(_res);
18902         CHECK_ACCESS(_res_ptr);
18903         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
18904         FREE(untag_ptr(_res));
18905         CResult_PaymentSecretNoneZ_free(_res_conv);
18906 }
18907
18908 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
18909         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18910         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
18911         return tag_ptr(ret_conv, true);
18912 }
18913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18914         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
18915         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
18916         return ret_conv;
18917 }
18918
18919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18920         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
18921         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18922         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
18923         return tag_ptr(ret_conv, true);
18924 }
18925
18926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18927         LDKThirtyTwoBytes o_ref;
18928         CHECK((*env)->GetArrayLength(env, o) == 32);
18929         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18930         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18931         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
18932         return tag_ptr(ret_conv, true);
18933 }
18934
18935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18936         void* e_ptr = untag_ptr(e);
18937         CHECK_ACCESS(e_ptr);
18938         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18939         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18940         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18941         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
18942         return tag_ptr(ret_conv, true);
18943 }
18944
18945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18946         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
18947         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
18948         return ret_conv;
18949 }
18950
18951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18952         if (!ptr_is_owned(_res)) return;
18953         void* _res_ptr = untag_ptr(_res);
18954         CHECK_ACCESS(_res_ptr);
18955         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
18956         FREE(untag_ptr(_res));
18957         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
18958 }
18959
18960 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
18961         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18962         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
18963         return tag_ptr(ret_conv, true);
18964 }
18965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18966         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
18967         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
18968         return ret_conv;
18969 }
18970
18971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18972         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
18973         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18974         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
18975         return tag_ptr(ret_conv, true);
18976 }
18977
18978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18979         LDKThirtyTwoBytes o_ref;
18980         CHECK((*env)->GetArrayLength(env, o) == 32);
18981         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18982         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18983         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
18984         return tag_ptr(ret_conv, true);
18985 }
18986
18987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18988         void* e_ptr = untag_ptr(e);
18989         CHECK_ACCESS(e_ptr);
18990         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18991         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18992         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18993         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
18994         return tag_ptr(ret_conv, true);
18995 }
18996
18997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18998         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
18999         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
19000         return ret_conv;
19001 }
19002
19003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19004         if (!ptr_is_owned(_res)) return;
19005         void* _res_ptr = untag_ptr(_res);
19006         CHECK_ACCESS(_res_ptr);
19007         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
19008         FREE(untag_ptr(_res));
19009         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
19010 }
19011
19012 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
19013         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19014         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
19015         return tag_ptr(ret_conv, true);
19016 }
19017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19018         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
19019         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
19020         return ret_conv;
19021 }
19022
19023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19024         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
19025         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
19026         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
19027         return tag_ptr(ret_conv, true);
19028 }
19029
19030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19031         LDKCounterpartyForwardingInfo o_conv;
19032         o_conv.inner = untag_ptr(o);
19033         o_conv.is_owned = ptr_is_owned(o);
19034         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19035         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
19036         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19037         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
19038         return tag_ptr(ret_conv, true);
19039 }
19040
19041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19042         LDKDecodeError e_conv;
19043         e_conv.inner = untag_ptr(e);
19044         e_conv.is_owned = ptr_is_owned(e);
19045         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19046         e_conv = DecodeError_clone(&e_conv);
19047         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19048         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
19049         return tag_ptr(ret_conv, true);
19050 }
19051
19052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19053         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
19054         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
19055         return ret_conv;
19056 }
19057
19058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19059         if (!ptr_is_owned(_res)) return;
19060         void* _res_ptr = untag_ptr(_res);
19061         CHECK_ACCESS(_res_ptr);
19062         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
19063         FREE(untag_ptr(_res));
19064         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
19065 }
19066
19067 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
19068         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19069         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
19070         return tag_ptr(ret_conv, true);
19071 }
19072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19073         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
19074         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
19075         return ret_conv;
19076 }
19077
19078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19079         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
19080         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
19081         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
19082         return tag_ptr(ret_conv, true);
19083 }
19084
19085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19086         LDKChannelCounterparty o_conv;
19087         o_conv.inner = untag_ptr(o);
19088         o_conv.is_owned = ptr_is_owned(o);
19089         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19090         o_conv = ChannelCounterparty_clone(&o_conv);
19091         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19092         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
19093         return tag_ptr(ret_conv, true);
19094 }
19095
19096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19097         LDKDecodeError e_conv;
19098         e_conv.inner = untag_ptr(e);
19099         e_conv.is_owned = ptr_is_owned(e);
19100         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19101         e_conv = DecodeError_clone(&e_conv);
19102         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19103         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
19104         return tag_ptr(ret_conv, true);
19105 }
19106
19107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19108         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
19109         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
19110         return ret_conv;
19111 }
19112
19113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19114         if (!ptr_is_owned(_res)) return;
19115         void* _res_ptr = untag_ptr(_res);
19116         CHECK_ACCESS(_res_ptr);
19117         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
19118         FREE(untag_ptr(_res));
19119         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
19120 }
19121
19122 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
19123         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19124         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
19125         return tag_ptr(ret_conv, true);
19126 }
19127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19128         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
19129         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
19130         return ret_conv;
19131 }
19132
19133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19134         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
19135         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
19136         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
19137         return tag_ptr(ret_conv, true);
19138 }
19139
19140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19141         LDKChannelDetails o_conv;
19142         o_conv.inner = untag_ptr(o);
19143         o_conv.is_owned = ptr_is_owned(o);
19144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19145         o_conv = ChannelDetails_clone(&o_conv);
19146         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19147         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
19148         return tag_ptr(ret_conv, true);
19149 }
19150
19151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19152         LDKDecodeError e_conv;
19153         e_conv.inner = untag_ptr(e);
19154         e_conv.is_owned = ptr_is_owned(e);
19155         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19156         e_conv = DecodeError_clone(&e_conv);
19157         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19158         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
19159         return tag_ptr(ret_conv, true);
19160 }
19161
19162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19163         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
19164         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
19165         return ret_conv;
19166 }
19167
19168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19169         if (!ptr_is_owned(_res)) return;
19170         void* _res_ptr = untag_ptr(_res);
19171         CHECK_ACCESS(_res_ptr);
19172         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
19173         FREE(untag_ptr(_res));
19174         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
19175 }
19176
19177 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
19178         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19179         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
19180         return tag_ptr(ret_conv, true);
19181 }
19182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19183         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
19184         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
19185         return ret_conv;
19186 }
19187
19188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19189         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
19190         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
19191         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
19192         return tag_ptr(ret_conv, true);
19193 }
19194
19195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19196         LDKPhantomRouteHints o_conv;
19197         o_conv.inner = untag_ptr(o);
19198         o_conv.is_owned = ptr_is_owned(o);
19199         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19200         o_conv = PhantomRouteHints_clone(&o_conv);
19201         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19202         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
19203         return tag_ptr(ret_conv, true);
19204 }
19205
19206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19207         LDKDecodeError e_conv;
19208         e_conv.inner = untag_ptr(e);
19209         e_conv.is_owned = ptr_is_owned(e);
19210         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19211         e_conv = DecodeError_clone(&e_conv);
19212         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19213         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
19214         return tag_ptr(ret_conv, true);
19215 }
19216
19217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19218         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
19219         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
19220         return ret_conv;
19221 }
19222
19223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19224         if (!ptr_is_owned(_res)) return;
19225         void* _res_ptr = untag_ptr(_res);
19226         CHECK_ACCESS(_res_ptr);
19227         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
19228         FREE(untag_ptr(_res));
19229         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
19230 }
19231
19232 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
19233         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19234         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
19235         return tag_ptr(ret_conv, true);
19236 }
19237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19238         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
19239         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
19240         return ret_conv;
19241 }
19242
19243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19244         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
19245         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
19246         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
19247         return tag_ptr(ret_conv, true);
19248 }
19249
19250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19251         LDKCVec_ChannelMonitorZ _res_constr;
19252         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19253         if (_res_constr.datalen > 0)
19254                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19255         else
19256                 _res_constr.data = NULL;
19257         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19258         for (size_t q = 0; q < _res_constr.datalen; q++) {
19259                 int64_t _res_conv_16 = _res_vals[q];
19260                 LDKChannelMonitor _res_conv_16_conv;
19261                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19262                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19263                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19264                 _res_constr.data[q] = _res_conv_16_conv;
19265         }
19266         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19267         CVec_ChannelMonitorZ_free(_res_constr);
19268 }
19269
19270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19271         LDKThirtyTwoBytes a_ref;
19272         CHECK((*env)->GetArrayLength(env, a) == 32);
19273         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19274         LDKChannelManager b_conv;
19275         b_conv.inner = untag_ptr(b);
19276         b_conv.is_owned = ptr_is_owned(b);
19277         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19278         // WARNING: we need a move here but no clone is available for LDKChannelManager
19279         
19280         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
19281         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
19282         return tag_ptr(ret_conv, true);
19283 }
19284
19285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19286         if (!ptr_is_owned(_res)) return;
19287         void* _res_ptr = untag_ptr(_res);
19288         CHECK_ACCESS(_res_ptr);
19289         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
19290         FREE(untag_ptr(_res));
19291         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
19292 }
19293
19294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19295         void* o_ptr = untag_ptr(o);
19296         CHECK_ACCESS(o_ptr);
19297         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
19298         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
19299         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19300         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
19301         return tag_ptr(ret_conv, true);
19302 }
19303
19304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19305         LDKDecodeError e_conv;
19306         e_conv.inner = untag_ptr(e);
19307         e_conv.is_owned = ptr_is_owned(e);
19308         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19309         e_conv = DecodeError_clone(&e_conv);
19310         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19311         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
19312         return tag_ptr(ret_conv, true);
19313 }
19314
19315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19316         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
19317         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
19318         return ret_conv;
19319 }
19320
19321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19322         if (!ptr_is_owned(_res)) return;
19323         void* _res_ptr = untag_ptr(_res);
19324         CHECK_ACCESS(_res_ptr);
19325         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
19326         FREE(untag_ptr(_res));
19327         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
19328 }
19329
19330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19331         LDKChannelConfig o_conv;
19332         o_conv.inner = untag_ptr(o);
19333         o_conv.is_owned = ptr_is_owned(o);
19334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19335         o_conv = ChannelConfig_clone(&o_conv);
19336         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19337         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
19338         return tag_ptr(ret_conv, true);
19339 }
19340
19341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19342         LDKDecodeError e_conv;
19343         e_conv.inner = untag_ptr(e);
19344         e_conv.is_owned = ptr_is_owned(e);
19345         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19346         e_conv = DecodeError_clone(&e_conv);
19347         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19348         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
19349         return tag_ptr(ret_conv, true);
19350 }
19351
19352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19353         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
19354         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
19355         return ret_conv;
19356 }
19357
19358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19359         if (!ptr_is_owned(_res)) return;
19360         void* _res_ptr = untag_ptr(_res);
19361         CHECK_ACCESS(_res_ptr);
19362         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
19363         FREE(untag_ptr(_res));
19364         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
19365 }
19366
19367 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
19368         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19369         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
19370         return tag_ptr(ret_conv, true);
19371 }
19372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19373         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
19374         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
19375         return ret_conv;
19376 }
19377
19378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19379         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
19380         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
19381         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
19382         return tag_ptr(ret_conv, true);
19383 }
19384
19385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19386         LDKOutPoint o_conv;
19387         o_conv.inner = untag_ptr(o);
19388         o_conv.is_owned = ptr_is_owned(o);
19389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19390         o_conv = OutPoint_clone(&o_conv);
19391         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19392         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
19393         return tag_ptr(ret_conv, true);
19394 }
19395
19396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19397         LDKDecodeError e_conv;
19398         e_conv.inner = untag_ptr(e);
19399         e_conv.is_owned = ptr_is_owned(e);
19400         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19401         e_conv = DecodeError_clone(&e_conv);
19402         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19403         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
19404         return tag_ptr(ret_conv, true);
19405 }
19406
19407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19408         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
19409         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
19410         return ret_conv;
19411 }
19412
19413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19414         if (!ptr_is_owned(_res)) return;
19415         void* _res_ptr = untag_ptr(_res);
19416         CHECK_ACCESS(_res_ptr);
19417         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
19418         FREE(untag_ptr(_res));
19419         CResult_OutPointDecodeErrorZ_free(_res_conv);
19420 }
19421
19422 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
19423         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19424         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
19425         return tag_ptr(ret_conv, true);
19426 }
19427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19428         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
19429         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
19430         return ret_conv;
19431 }
19432
19433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19434         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
19435         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
19436         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
19437         return tag_ptr(ret_conv, true);
19438 }
19439
19440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19441         void* o_ptr = untag_ptr(o);
19442         CHECK_ACCESS(o_ptr);
19443         LDKType o_conv = *(LDKType*)(o_ptr);
19444         if (o_conv.free == LDKType_JCalls_free) {
19445                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19446                 LDKType_JCalls_cloned(&o_conv);
19447         }
19448         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19449         *ret_copy = COption_TypeZ_some(o_conv);
19450         int64_t ret_ref = tag_ptr(ret_copy, true);
19451         return ret_ref;
19452 }
19453
19454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
19455         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19456         *ret_copy = COption_TypeZ_none();
19457         int64_t ret_ref = tag_ptr(ret_copy, true);
19458         return ret_ref;
19459 }
19460
19461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19462         if (!ptr_is_owned(_res)) return;
19463         void* _res_ptr = untag_ptr(_res);
19464         CHECK_ACCESS(_res_ptr);
19465         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
19466         FREE(untag_ptr(_res));
19467         COption_TypeZ_free(_res_conv);
19468 }
19469
19470 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
19471         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19472         *ret_copy = COption_TypeZ_clone(arg);
19473         int64_t ret_ref = tag_ptr(ret_copy, true);
19474         return ret_ref;
19475 }
19476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19477         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
19478         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
19479         return ret_conv;
19480 }
19481
19482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19483         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
19484         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
19485         *ret_copy = COption_TypeZ_clone(orig_conv);
19486         int64_t ret_ref = tag_ptr(ret_copy, true);
19487         return ret_ref;
19488 }
19489
19490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19491         void* o_ptr = untag_ptr(o);
19492         CHECK_ACCESS(o_ptr);
19493         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
19494         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
19495         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19496         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
19497         return tag_ptr(ret_conv, true);
19498 }
19499
19500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19501         LDKDecodeError e_conv;
19502         e_conv.inner = untag_ptr(e);
19503         e_conv.is_owned = ptr_is_owned(e);
19504         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19505         e_conv = DecodeError_clone(&e_conv);
19506         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19507         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
19508         return tag_ptr(ret_conv, true);
19509 }
19510
19511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19512         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
19513         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
19514         return ret_conv;
19515 }
19516
19517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19518         if (!ptr_is_owned(_res)) return;
19519         void* _res_ptr = untag_ptr(_res);
19520         CHECK_ACCESS(_res_ptr);
19521         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
19522         FREE(untag_ptr(_res));
19523         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
19524 }
19525
19526 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
19527         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19528         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
19529         return tag_ptr(ret_conv, true);
19530 }
19531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19532         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
19533         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
19534         return ret_conv;
19535 }
19536
19537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19538         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
19539         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
19540         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
19541         return tag_ptr(ret_conv, true);
19542 }
19543
19544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19545         LDKThirtyTwoBytes o_ref;
19546         CHECK((*env)->GetArrayLength(env, o) == 32);
19547         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19548         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19549         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
19550         return tag_ptr(ret_conv, true);
19551 }
19552
19553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19554         void* e_ptr = untag_ptr(e);
19555         CHECK_ACCESS(e_ptr);
19556         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
19557         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
19558         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19559         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
19560         return tag_ptr(ret_conv, true);
19561 }
19562
19563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19564         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
19565         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
19566         return ret_conv;
19567 }
19568
19569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19570         if (!ptr_is_owned(_res)) return;
19571         void* _res_ptr = untag_ptr(_res);
19572         CHECK_ACCESS(_res_ptr);
19573         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
19574         FREE(untag_ptr(_res));
19575         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
19576 }
19577
19578 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
19579         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19580         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
19581         return tag_ptr(ret_conv, true);
19582 }
19583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19584         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
19585         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
19586         return ret_conv;
19587 }
19588
19589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19590         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
19591         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
19592         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
19593         return tag_ptr(ret_conv, true);
19594 }
19595
19596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
19597         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
19598         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19599         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
19600         return tag_ptr(ret_conv, true);
19601 }
19602
19603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19604         void* e_ptr = untag_ptr(e);
19605         CHECK_ACCESS(e_ptr);
19606         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19607         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19608         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19609         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
19610         return tag_ptr(ret_conv, true);
19611 }
19612
19613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19614         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
19615         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
19616         return ret_conv;
19617 }
19618
19619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19620         if (!ptr_is_owned(_res)) return;
19621         void* _res_ptr = untag_ptr(_res);
19622         CHECK_ACCESS(_res_ptr);
19623         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
19624         FREE(untag_ptr(_res));
19625         CResult_SiPrefixParseErrorZ_free(_res_conv);
19626 }
19627
19628 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
19629         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19630         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
19631         return tag_ptr(ret_conv, true);
19632 }
19633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19634         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
19635         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
19636         return ret_conv;
19637 }
19638
19639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19640         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
19641         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
19642         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
19643         return tag_ptr(ret_conv, true);
19644 }
19645
19646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19647         LDKInvoice o_conv;
19648         o_conv.inner = untag_ptr(o);
19649         o_conv.is_owned = ptr_is_owned(o);
19650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19651         o_conv = Invoice_clone(&o_conv);
19652         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19653         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
19654         return tag_ptr(ret_conv, true);
19655 }
19656
19657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19658         void* e_ptr = untag_ptr(e);
19659         CHECK_ACCESS(e_ptr);
19660         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
19661         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
19662         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19663         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
19664         return tag_ptr(ret_conv, true);
19665 }
19666
19667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19668         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
19669         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
19670         return ret_conv;
19671 }
19672
19673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19674         if (!ptr_is_owned(_res)) return;
19675         void* _res_ptr = untag_ptr(_res);
19676         CHECK_ACCESS(_res_ptr);
19677         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
19678         FREE(untag_ptr(_res));
19679         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
19680 }
19681
19682 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
19683         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19684         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
19685         return tag_ptr(ret_conv, true);
19686 }
19687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19688         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
19689         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
19690         return ret_conv;
19691 }
19692
19693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19694         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
19695         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
19696         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
19697         return tag_ptr(ret_conv, true);
19698 }
19699
19700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19701         LDKSignedRawInvoice o_conv;
19702         o_conv.inner = untag_ptr(o);
19703         o_conv.is_owned = ptr_is_owned(o);
19704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19705         o_conv = SignedRawInvoice_clone(&o_conv);
19706         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19707         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
19708         return tag_ptr(ret_conv, true);
19709 }
19710
19711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19712         void* e_ptr = untag_ptr(e);
19713         CHECK_ACCESS(e_ptr);
19714         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
19715         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
19716         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19717         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
19718         return tag_ptr(ret_conv, true);
19719 }
19720
19721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19722         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
19723         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
19724         return ret_conv;
19725 }
19726
19727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19728         if (!ptr_is_owned(_res)) return;
19729         void* _res_ptr = untag_ptr(_res);
19730         CHECK_ACCESS(_res_ptr);
19731         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
19732         FREE(untag_ptr(_res));
19733         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
19734 }
19735
19736 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
19737         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19738         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
19739         return tag_ptr(ret_conv, true);
19740 }
19741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19742         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
19743         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
19744         return ret_conv;
19745 }
19746
19747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19748         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
19749         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
19750         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
19751         return tag_ptr(ret_conv, true);
19752 }
19753
19754 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
19755         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19756         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
19757         return tag_ptr(ret_conv, true);
19758 }
19759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19760         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
19761         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
19762         return ret_conv;
19763 }
19764
19765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19766         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
19767         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19768         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
19769         return tag_ptr(ret_conv, true);
19770 }
19771
19772 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) {
19773         LDKRawInvoice a_conv;
19774         a_conv.inner = untag_ptr(a);
19775         a_conv.is_owned = ptr_is_owned(a);
19776         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19777         a_conv = RawInvoice_clone(&a_conv);
19778         LDKThirtyTwoBytes b_ref;
19779         CHECK((*env)->GetArrayLength(env, b) == 32);
19780         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19781         LDKInvoiceSignature c_conv;
19782         c_conv.inner = untag_ptr(c);
19783         c_conv.is_owned = ptr_is_owned(c);
19784         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19785         c_conv = InvoiceSignature_clone(&c_conv);
19786         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19787         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19788         return tag_ptr(ret_conv, true);
19789 }
19790
19791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_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         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19796         FREE(untag_ptr(_res));
19797         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19798 }
19799
19800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19801         LDKPayeePubKey o_conv;
19802         o_conv.inner = untag_ptr(o);
19803         o_conv.is_owned = ptr_is_owned(o);
19804         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19805         o_conv = PayeePubKey_clone(&o_conv);
19806         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19807         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19808         return tag_ptr(ret_conv, true);
19809 }
19810
19811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19812         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
19813         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19814         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19815         return tag_ptr(ret_conv, true);
19816 }
19817
19818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19819         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
19820         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19821         return ret_conv;
19822 }
19823
19824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19825         if (!ptr_is_owned(_res)) return;
19826         void* _res_ptr = untag_ptr(_res);
19827         CHECK_ACCESS(_res_ptr);
19828         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19829         FREE(untag_ptr(_res));
19830         CResult_PayeePubKeyErrorZ_free(_res_conv);
19831 }
19832
19833 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19834         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19835         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19836         return tag_ptr(ret_conv, true);
19837 }
19838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19839         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
19840         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19841         return ret_conv;
19842 }
19843
19844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19845         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
19846         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19847         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19848         return tag_ptr(ret_conv, true);
19849 }
19850
19851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19852         LDKCVec_PrivateRouteZ _res_constr;
19853         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19854         if (_res_constr.datalen > 0)
19855                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19856         else
19857                 _res_constr.data = NULL;
19858         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19859         for (size_t o = 0; o < _res_constr.datalen; o++) {
19860                 int64_t _res_conv_14 = _res_vals[o];
19861                 LDKPrivateRoute _res_conv_14_conv;
19862                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19863                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19864                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19865                 _res_constr.data[o] = _res_conv_14_conv;
19866         }
19867         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19868         CVec_PrivateRouteZ_free(_res_constr);
19869 }
19870
19871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19872         LDKPositiveTimestamp o_conv;
19873         o_conv.inner = untag_ptr(o);
19874         o_conv.is_owned = ptr_is_owned(o);
19875         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19876         o_conv = PositiveTimestamp_clone(&o_conv);
19877         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19878         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19879         return tag_ptr(ret_conv, true);
19880 }
19881
19882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19883         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19884         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19885         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19886         return tag_ptr(ret_conv, true);
19887 }
19888
19889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19890         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
19891         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19892         return ret_conv;
19893 }
19894
19895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19896         if (!ptr_is_owned(_res)) return;
19897         void* _res_ptr = untag_ptr(_res);
19898         CHECK_ACCESS(_res_ptr);
19899         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19900         FREE(untag_ptr(_res));
19901         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19902 }
19903
19904 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19905         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19906         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19907         return tag_ptr(ret_conv, true);
19908 }
19909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19910         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
19911         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19912         return ret_conv;
19913 }
19914
19915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19916         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
19917         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19918         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19919         return tag_ptr(ret_conv, true);
19920 }
19921
19922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
19923         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19924         *ret_conv = CResult_NoneSemanticErrorZ_ok();
19925         return tag_ptr(ret_conv, true);
19926 }
19927
19928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19929         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19930         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19931         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19932         return tag_ptr(ret_conv, true);
19933 }
19934
19935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19936         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
19937         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19938         return ret_conv;
19939 }
19940
19941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19942         if (!ptr_is_owned(_res)) return;
19943         void* _res_ptr = untag_ptr(_res);
19944         CHECK_ACCESS(_res_ptr);
19945         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19946         FREE(untag_ptr(_res));
19947         CResult_NoneSemanticErrorZ_free(_res_conv);
19948 }
19949
19950 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19951         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19952         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19953         return tag_ptr(ret_conv, true);
19954 }
19955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19956         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
19957         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19958         return ret_conv;
19959 }
19960
19961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19962         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
19963         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19964         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19965         return tag_ptr(ret_conv, true);
19966 }
19967
19968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19969         LDKInvoice o_conv;
19970         o_conv.inner = untag_ptr(o);
19971         o_conv.is_owned = ptr_is_owned(o);
19972         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19973         o_conv = Invoice_clone(&o_conv);
19974         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19975         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19976         return tag_ptr(ret_conv, true);
19977 }
19978
19979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19980         LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19981         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19982         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19983         return tag_ptr(ret_conv, true);
19984 }
19985
19986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19987         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
19988         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19989         return ret_conv;
19990 }
19991
19992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19993         if (!ptr_is_owned(_res)) return;
19994         void* _res_ptr = untag_ptr(_res);
19995         CHECK_ACCESS(_res_ptr);
19996         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19997         FREE(untag_ptr(_res));
19998         CResult_InvoiceSemanticErrorZ_free(_res_conv);
19999 }
20000
20001 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
20002         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20003         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
20004         return tag_ptr(ret_conv, true);
20005 }
20006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20007         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
20008         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
20009         return ret_conv;
20010 }
20011
20012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20013         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
20014         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
20015         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
20016         return tag_ptr(ret_conv, true);
20017 }
20018
20019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20020         LDKDescription o_conv;
20021         o_conv.inner = untag_ptr(o);
20022         o_conv.is_owned = ptr_is_owned(o);
20023         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20024         o_conv = Description_clone(&o_conv);
20025         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20026         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
20027         return tag_ptr(ret_conv, true);
20028 }
20029
20030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20031         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20032         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20033         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
20034         return tag_ptr(ret_conv, true);
20035 }
20036
20037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20038         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
20039         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
20040         return ret_conv;
20041 }
20042
20043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20044         if (!ptr_is_owned(_res)) return;
20045         void* _res_ptr = untag_ptr(_res);
20046         CHECK_ACCESS(_res_ptr);
20047         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
20048         FREE(untag_ptr(_res));
20049         CResult_DescriptionCreationErrorZ_free(_res_conv);
20050 }
20051
20052 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
20053         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20054         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
20055         return tag_ptr(ret_conv, true);
20056 }
20057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20058         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
20059         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
20060         return ret_conv;
20061 }
20062
20063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20064         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
20065         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
20066         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
20067         return tag_ptr(ret_conv, true);
20068 }
20069
20070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20071         LDKPrivateRoute o_conv;
20072         o_conv.inner = untag_ptr(o);
20073         o_conv.is_owned = ptr_is_owned(o);
20074         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20075         o_conv = PrivateRoute_clone(&o_conv);
20076         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20077         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
20078         return tag_ptr(ret_conv, true);
20079 }
20080
20081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20082         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
20083         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20084         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
20085         return tag_ptr(ret_conv, true);
20086 }
20087
20088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20089         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
20090         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
20091         return ret_conv;
20092 }
20093
20094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20095         if (!ptr_is_owned(_res)) return;
20096         void* _res_ptr = untag_ptr(_res);
20097         CHECK_ACCESS(_res_ptr);
20098         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
20099         FREE(untag_ptr(_res));
20100         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
20101 }
20102
20103 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
20104         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20105         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
20106         return tag_ptr(ret_conv, true);
20107 }
20108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20109         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
20110         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
20111         return ret_conv;
20112 }
20113
20114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20115         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
20116         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
20117         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
20118         return tag_ptr(ret_conv, true);
20119 }
20120
20121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
20122         LDKStr o_conv = java_to_owned_str(env, o);
20123         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20124         *ret_conv = CResult_StringErrorZ_ok(o_conv);
20125         return tag_ptr(ret_conv, true);
20126 }
20127
20128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20129         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
20130         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20131         *ret_conv = CResult_StringErrorZ_err(e_conv);
20132         return tag_ptr(ret_conv, true);
20133 }
20134
20135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20136         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
20137         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
20138         return ret_conv;
20139 }
20140
20141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20142         if (!ptr_is_owned(_res)) return;
20143         void* _res_ptr = untag_ptr(_res);
20144         CHECK_ACCESS(_res_ptr);
20145         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
20146         FREE(untag_ptr(_res));
20147         CResult_StringErrorZ_free(_res_conv);
20148 }
20149
20150 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
20151         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20152         *ret_conv = CResult_StringErrorZ_clone(arg);
20153         return tag_ptr(ret_conv, true);
20154 }
20155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20156         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
20157         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
20158         return ret_conv;
20159 }
20160
20161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20162         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
20163         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
20164         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
20165         return tag_ptr(ret_conv, true);
20166 }
20167
20168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20169         LDKChannelMonitorUpdate o_conv;
20170         o_conv.inner = untag_ptr(o);
20171         o_conv.is_owned = ptr_is_owned(o);
20172         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20173         o_conv = ChannelMonitorUpdate_clone(&o_conv);
20174         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20175         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
20176         return tag_ptr(ret_conv, true);
20177 }
20178
20179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20180         LDKDecodeError e_conv;
20181         e_conv.inner = untag_ptr(e);
20182         e_conv.is_owned = ptr_is_owned(e);
20183         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20184         e_conv = DecodeError_clone(&e_conv);
20185         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20186         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
20187         return tag_ptr(ret_conv, true);
20188 }
20189
20190 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20191         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
20192         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
20193         return ret_conv;
20194 }
20195
20196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20197         if (!ptr_is_owned(_res)) return;
20198         void* _res_ptr = untag_ptr(_res);
20199         CHECK_ACCESS(_res_ptr);
20200         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
20201         FREE(untag_ptr(_res));
20202         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
20203 }
20204
20205 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
20206         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20207         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
20208         return tag_ptr(ret_conv, true);
20209 }
20210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20211         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
20212         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
20213         return ret_conv;
20214 }
20215
20216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20217         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
20218         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
20219         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
20220         return tag_ptr(ret_conv, true);
20221 }
20222
20223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20224         void* o_ptr = untag_ptr(o);
20225         CHECK_ACCESS(o_ptr);
20226         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
20227         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
20228         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20229         *ret_copy = COption_MonitorEventZ_some(o_conv);
20230         int64_t ret_ref = tag_ptr(ret_copy, true);
20231         return ret_ref;
20232 }
20233
20234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
20235         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20236         *ret_copy = COption_MonitorEventZ_none();
20237         int64_t ret_ref = tag_ptr(ret_copy, true);
20238         return ret_ref;
20239 }
20240
20241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20242         if (!ptr_is_owned(_res)) return;
20243         void* _res_ptr = untag_ptr(_res);
20244         CHECK_ACCESS(_res_ptr);
20245         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
20246         FREE(untag_ptr(_res));
20247         COption_MonitorEventZ_free(_res_conv);
20248 }
20249
20250 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
20251         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20252         *ret_copy = COption_MonitorEventZ_clone(arg);
20253         int64_t ret_ref = tag_ptr(ret_copy, true);
20254         return ret_ref;
20255 }
20256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20257         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
20258         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
20259         return ret_conv;
20260 }
20261
20262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20263         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
20264         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
20265         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
20266         int64_t ret_ref = tag_ptr(ret_copy, true);
20267         return ret_ref;
20268 }
20269
20270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20271         void* o_ptr = untag_ptr(o);
20272         CHECK_ACCESS(o_ptr);
20273         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
20274         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
20275         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20276         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
20277         return tag_ptr(ret_conv, true);
20278 }
20279
20280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20281         LDKDecodeError e_conv;
20282         e_conv.inner = untag_ptr(e);
20283         e_conv.is_owned = ptr_is_owned(e);
20284         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20285         e_conv = DecodeError_clone(&e_conv);
20286         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20287         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
20288         return tag_ptr(ret_conv, true);
20289 }
20290
20291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20292         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
20293         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
20294         return ret_conv;
20295 }
20296
20297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20298         if (!ptr_is_owned(_res)) return;
20299         void* _res_ptr = untag_ptr(_res);
20300         CHECK_ACCESS(_res_ptr);
20301         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
20302         FREE(untag_ptr(_res));
20303         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
20304 }
20305
20306 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
20307         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20308         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
20309         return tag_ptr(ret_conv, true);
20310 }
20311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20312         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
20313         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
20314         return ret_conv;
20315 }
20316
20317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20318         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
20319         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
20320         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
20321         return tag_ptr(ret_conv, true);
20322 }
20323
20324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20325         LDKHTLCUpdate o_conv;
20326         o_conv.inner = untag_ptr(o);
20327         o_conv.is_owned = ptr_is_owned(o);
20328         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20329         o_conv = HTLCUpdate_clone(&o_conv);
20330         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20331         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
20332         return tag_ptr(ret_conv, true);
20333 }
20334
20335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20336         LDKDecodeError e_conv;
20337         e_conv.inner = untag_ptr(e);
20338         e_conv.is_owned = ptr_is_owned(e);
20339         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20340         e_conv = DecodeError_clone(&e_conv);
20341         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20342         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
20343         return tag_ptr(ret_conv, true);
20344 }
20345
20346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20347         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
20348         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
20349         return ret_conv;
20350 }
20351
20352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20353         if (!ptr_is_owned(_res)) return;
20354         void* _res_ptr = untag_ptr(_res);
20355         CHECK_ACCESS(_res_ptr);
20356         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
20357         FREE(untag_ptr(_res));
20358         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
20359 }
20360
20361 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
20362         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20363         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
20364         return tag_ptr(ret_conv, true);
20365 }
20366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20367         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
20368         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
20369         return ret_conv;
20370 }
20371
20372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20373         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
20374         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
20375         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
20376         return tag_ptr(ret_conv, true);
20377 }
20378
20379 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
20380         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20381         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
20382         return tag_ptr(ret_conv, true);
20383 }
20384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20385         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
20386         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
20387         return ret_conv;
20388 }
20389
20390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20391         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
20392         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20393         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
20394         return tag_ptr(ret_conv, true);
20395 }
20396
20397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
20398         LDKOutPoint a_conv;
20399         a_conv.inner = untag_ptr(a);
20400         a_conv.is_owned = ptr_is_owned(a);
20401         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20402         a_conv = OutPoint_clone(&a_conv);
20403         LDKCVec_u8Z b_ref;
20404         b_ref.datalen = (*env)->GetArrayLength(env, b);
20405         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20406         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20407         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
20408         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
20409         return tag_ptr(ret_conv, true);
20410 }
20411
20412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20413         if (!ptr_is_owned(_res)) return;
20414         void* _res_ptr = untag_ptr(_res);
20415         CHECK_ACCESS(_res_ptr);
20416         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
20417         FREE(untag_ptr(_res));
20418         C2Tuple_OutPointScriptZ_free(_res_conv);
20419 }
20420
20421 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
20422         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20423         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
20424         return tag_ptr(ret_conv, true);
20425 }
20426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20427         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
20428         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
20429         return ret_conv;
20430 }
20431
20432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20433         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
20434         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20435         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
20436         return tag_ptr(ret_conv, true);
20437 }
20438
20439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
20440         LDKCVec_u8Z b_ref;
20441         b_ref.datalen = (*env)->GetArrayLength(env, b);
20442         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
20443         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
20444         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
20445         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
20446         return tag_ptr(ret_conv, true);
20447 }
20448
20449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20450         if (!ptr_is_owned(_res)) return;
20451         void* _res_ptr = untag_ptr(_res);
20452         CHECK_ACCESS(_res_ptr);
20453         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
20454         FREE(untag_ptr(_res));
20455         C2Tuple_u32ScriptZ_free(_res_conv);
20456 }
20457
20458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20459         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
20460         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20461         if (_res_constr.datalen > 0)
20462                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20463         else
20464                 _res_constr.data = NULL;
20465         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20466         for (size_t v = 0; v < _res_constr.datalen; v++) {
20467                 int64_t _res_conv_21 = _res_vals[v];
20468                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
20469                 CHECK_ACCESS(_res_conv_21_ptr);
20470                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
20471                 FREE(untag_ptr(_res_conv_21));
20472                 _res_constr.data[v] = _res_conv_21_conv;
20473         }
20474         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20475         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
20476 }
20477
20478 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
20479         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20480         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
20481         return tag_ptr(ret_conv, true);
20482 }
20483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20484         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
20485         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
20486         return ret_conv;
20487 }
20488
20489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20490         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
20491         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20492         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
20493         return tag_ptr(ret_conv, true);
20494 }
20495
20496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
20497         LDKThirtyTwoBytes a_ref;
20498         CHECK((*env)->GetArrayLength(env, a) == 32);
20499         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20500         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
20501         b_constr.datalen = (*env)->GetArrayLength(env, b);
20502         if (b_constr.datalen > 0)
20503                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
20504         else
20505                 b_constr.data = NULL;
20506         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
20507         for (size_t v = 0; v < b_constr.datalen; v++) {
20508                 int64_t b_conv_21 = b_vals[v];
20509                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
20510                 CHECK_ACCESS(b_conv_21_ptr);
20511                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
20512                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
20513                 b_constr.data[v] = b_conv_21_conv;
20514         }
20515         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
20516         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
20517         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
20518         return tag_ptr(ret_conv, true);
20519 }
20520
20521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20522         if (!ptr_is_owned(_res)) return;
20523         void* _res_ptr = untag_ptr(_res);
20524         CHECK_ACCESS(_res_ptr);
20525         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
20526         FREE(untag_ptr(_res));
20527         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
20528 }
20529
20530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20531         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
20532         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20533         if (_res_constr.datalen > 0)
20534                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
20535         else
20536                 _res_constr.data = NULL;
20537         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20538         for (size_t o = 0; o < _res_constr.datalen; o++) {
20539                 int64_t _res_conv_40 = _res_vals[o];
20540                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
20541                 CHECK_ACCESS(_res_conv_40_ptr);
20542                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
20543                 FREE(untag_ptr(_res_conv_40));
20544                 _res_constr.data[o] = _res_conv_40_conv;
20545         }
20546         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20547         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
20548 }
20549
20550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20551         LDKCVec_EventZ _res_constr;
20552         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20553         if (_res_constr.datalen > 0)
20554                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
20555         else
20556                 _res_constr.data = NULL;
20557         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20558         for (size_t h = 0; h < _res_constr.datalen; h++) {
20559                 int64_t _res_conv_7 = _res_vals[h];
20560                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
20561                 CHECK_ACCESS(_res_conv_7_ptr);
20562                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
20563                 FREE(untag_ptr(_res_conv_7));
20564                 _res_constr.data[h] = _res_conv_7_conv;
20565         }
20566         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20567         CVec_EventZ_free(_res_constr);
20568 }
20569
20570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20571         LDKCVec_TransactionZ _res_constr;
20572         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20573         if (_res_constr.datalen > 0)
20574                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
20575         else
20576                 _res_constr.data = NULL;
20577         for (size_t i = 0; i < _res_constr.datalen; i++) {
20578                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20579                 LDKTransaction _res_conv_8_ref;
20580                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
20581                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
20582                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
20583                 _res_conv_8_ref.data_is_owned = true;
20584                 _res_constr.data[i] = _res_conv_8_ref;
20585         }
20586         CVec_TransactionZ_free(_res_constr);
20587 }
20588
20589 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
20590         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20591         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
20592         return tag_ptr(ret_conv, true);
20593 }
20594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20595         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
20596         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
20597         return ret_conv;
20598 }
20599
20600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20601         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
20602         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20603         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
20604         return tag_ptr(ret_conv, true);
20605 }
20606
20607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
20608         void* b_ptr = untag_ptr(b);
20609         CHECK_ACCESS(b_ptr);
20610         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
20611         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
20612         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
20613         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
20614         return tag_ptr(ret_conv, true);
20615 }
20616
20617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20618         if (!ptr_is_owned(_res)) return;
20619         void* _res_ptr = untag_ptr(_res);
20620         CHECK_ACCESS(_res_ptr);
20621         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
20622         FREE(untag_ptr(_res));
20623         C2Tuple_u32TxOutZ_free(_res_conv);
20624 }
20625
20626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20627         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
20628         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20629         if (_res_constr.datalen > 0)
20630                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
20631         else
20632                 _res_constr.data = NULL;
20633         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20634         for (size_t u = 0; u < _res_constr.datalen; u++) {
20635                 int64_t _res_conv_20 = _res_vals[u];
20636                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
20637                 CHECK_ACCESS(_res_conv_20_ptr);
20638                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
20639                 FREE(untag_ptr(_res_conv_20));
20640                 _res_constr.data[u] = _res_conv_20_conv;
20641         }
20642         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20643         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
20644 }
20645
20646 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
20647         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20648         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
20649         return tag_ptr(ret_conv, true);
20650 }
20651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20652         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
20653         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
20654         return ret_conv;
20655 }
20656
20657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20658         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
20659         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20660         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
20661         return tag_ptr(ret_conv, true);
20662 }
20663
20664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
20665         LDKThirtyTwoBytes a_ref;
20666         CHECK((*env)->GetArrayLength(env, a) == 32);
20667         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
20668         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
20669         b_constr.datalen = (*env)->GetArrayLength(env, b);
20670         if (b_constr.datalen > 0)
20671                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
20672         else
20673                 b_constr.data = NULL;
20674         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
20675         for (size_t u = 0; u < b_constr.datalen; u++) {
20676                 int64_t b_conv_20 = b_vals[u];
20677                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
20678                 CHECK_ACCESS(b_conv_20_ptr);
20679                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
20680                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
20681                 b_constr.data[u] = b_conv_20_conv;
20682         }
20683         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
20684         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
20685         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
20686         return tag_ptr(ret_conv, true);
20687 }
20688
20689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20690         if (!ptr_is_owned(_res)) return;
20691         void* _res_ptr = untag_ptr(_res);
20692         CHECK_ACCESS(_res_ptr);
20693         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
20694         FREE(untag_ptr(_res));
20695         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
20696 }
20697
20698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20699         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
20700         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20701         if (_res_constr.datalen > 0)
20702                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
20703         else
20704                 _res_constr.data = NULL;
20705         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20706         for (size_t n = 0; n < _res_constr.datalen; n++) {
20707                 int64_t _res_conv_39 = _res_vals[n];
20708                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
20709                 CHECK_ACCESS(_res_conv_39_ptr);
20710                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
20711                 FREE(untag_ptr(_res_conv_39));
20712                 _res_constr.data[n] = _res_conv_39_conv;
20713         }
20714         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20715         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
20716 }
20717
20718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20719         LDKCVec_BalanceZ _res_constr;
20720         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20721         if (_res_constr.datalen > 0)
20722                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
20723         else
20724                 _res_constr.data = NULL;
20725         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20726         for (size_t j = 0; j < _res_constr.datalen; j++) {
20727                 int64_t _res_conv_9 = _res_vals[j];
20728                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
20729                 CHECK_ACCESS(_res_conv_9_ptr);
20730                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
20731                 FREE(untag_ptr(_res_conv_9));
20732                 _res_constr.data[j] = _res_conv_9_conv;
20733         }
20734         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20735         CVec_BalanceZ_free(_res_constr);
20736 }
20737
20738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20739         void* o_ptr = untag_ptr(o);
20740         CHECK_ACCESS(o_ptr);
20741         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
20742         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
20743         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20744         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
20745         return tag_ptr(ret_conv, true);
20746 }
20747
20748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20749         LDKDecodeError e_conv;
20750         e_conv.inner = untag_ptr(e);
20751         e_conv.is_owned = ptr_is_owned(e);
20752         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20753         e_conv = DecodeError_clone(&e_conv);
20754         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20755         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
20756         return tag_ptr(ret_conv, true);
20757 }
20758
20759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20760         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
20761         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
20762         return ret_conv;
20763 }
20764
20765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20766         if (!ptr_is_owned(_res)) return;
20767         void* _res_ptr = untag_ptr(_res);
20768         CHECK_ACCESS(_res_ptr);
20769         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
20770         FREE(untag_ptr(_res));
20771         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
20772 }
20773
20774 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
20775         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20776         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
20777         return tag_ptr(ret_conv, true);
20778 }
20779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20780         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
20781         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
20782         return ret_conv;
20783 }
20784
20785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20786         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
20787         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
20788         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
20789         return tag_ptr(ret_conv, true);
20790 }
20791
20792 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
20793         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20794         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
20795         return tag_ptr(ret_conv, true);
20796 }
20797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20798         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
20799         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
20800         return ret_conv;
20801 }
20802
20803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20804         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
20805         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20806         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
20807         return tag_ptr(ret_conv, true);
20808 }
20809
20810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20811         LDKPublicKey a_ref;
20812         CHECK((*env)->GetArrayLength(env, a) == 33);
20813         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
20814         void* b_ptr = untag_ptr(b);
20815         CHECK_ACCESS(b_ptr);
20816         LDKType b_conv = *(LDKType*)(b_ptr);
20817         if (b_conv.free == LDKType_JCalls_free) {
20818                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20819                 LDKType_JCalls_cloned(&b_conv);
20820         }
20821         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20822         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
20823         return tag_ptr(ret_conv, true);
20824 }
20825
20826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20827         if (!ptr_is_owned(_res)) return;
20828         void* _res_ptr = untag_ptr(_res);
20829         CHECK_ACCESS(_res_ptr);
20830         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
20831         FREE(untag_ptr(_res));
20832         C2Tuple_PublicKeyTypeZ_free(_res_conv);
20833 }
20834
20835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20836         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
20837         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20838         if (_res_constr.datalen > 0)
20839                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
20840         else
20841                 _res_constr.data = NULL;
20842         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20843         for (size_t z = 0; z < _res_constr.datalen; z++) {
20844                 int64_t _res_conv_25 = _res_vals[z];
20845                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
20846                 CHECK_ACCESS(_res_conv_25_ptr);
20847                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
20848                 FREE(untag_ptr(_res_conv_25));
20849                 _res_constr.data[z] = _res_conv_25_conv;
20850         }
20851         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20852         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
20853 }
20854
20855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20856         void* o_ptr = untag_ptr(o);
20857         CHECK_ACCESS(o_ptr);
20858         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20859         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
20860         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20861         *ret_copy = COption_NetAddressZ_some(o_conv);
20862         int64_t ret_ref = tag_ptr(ret_copy, true);
20863         return ret_ref;
20864 }
20865
20866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
20867         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20868         *ret_copy = COption_NetAddressZ_none();
20869         int64_t ret_ref = tag_ptr(ret_copy, true);
20870         return ret_ref;
20871 }
20872
20873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20874         if (!ptr_is_owned(_res)) return;
20875         void* _res_ptr = untag_ptr(_res);
20876         CHECK_ACCESS(_res_ptr);
20877         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
20878         FREE(untag_ptr(_res));
20879         COption_NetAddressZ_free(_res_conv);
20880 }
20881
20882 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
20883         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20884         *ret_copy = COption_NetAddressZ_clone(arg);
20885         int64_t ret_ref = tag_ptr(ret_copy, true);
20886         return ret_ref;
20887 }
20888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20889         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
20890         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
20891         return ret_conv;
20892 }
20893
20894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20895         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
20896         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20897         *ret_copy = COption_NetAddressZ_clone(orig_conv);
20898         int64_t ret_ref = tag_ptr(ret_copy, true);
20899         return ret_ref;
20900 }
20901
20902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20903         LDKCVec_u8Z o_ref;
20904         o_ref.datalen = (*env)->GetArrayLength(env, o);
20905         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20906         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20907         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20908         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
20909         return tag_ptr(ret_conv, true);
20910 }
20911
20912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20913         LDKPeerHandleError e_conv;
20914         e_conv.inner = untag_ptr(e);
20915         e_conv.is_owned = ptr_is_owned(e);
20916         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20917         e_conv = PeerHandleError_clone(&e_conv);
20918         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20919         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
20920         return tag_ptr(ret_conv, true);
20921 }
20922
20923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20924         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
20925         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
20926         return ret_conv;
20927 }
20928
20929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20930         if (!ptr_is_owned(_res)) return;
20931         void* _res_ptr = untag_ptr(_res);
20932         CHECK_ACCESS(_res_ptr);
20933         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
20934         FREE(untag_ptr(_res));
20935         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
20936 }
20937
20938 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
20939         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20940         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
20941         return tag_ptr(ret_conv, true);
20942 }
20943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20944         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
20945         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
20946         return ret_conv;
20947 }
20948
20949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20950         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
20951         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20952         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
20953         return tag_ptr(ret_conv, true);
20954 }
20955
20956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
20957         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20958         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
20959         return tag_ptr(ret_conv, true);
20960 }
20961
20962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20963         LDKPeerHandleError e_conv;
20964         e_conv.inner = untag_ptr(e);
20965         e_conv.is_owned = ptr_is_owned(e);
20966         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20967         e_conv = PeerHandleError_clone(&e_conv);
20968         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20969         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
20970         return tag_ptr(ret_conv, true);
20971 }
20972
20973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20974         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
20975         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
20976         return ret_conv;
20977 }
20978
20979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20980         if (!ptr_is_owned(_res)) return;
20981         void* _res_ptr = untag_ptr(_res);
20982         CHECK_ACCESS(_res_ptr);
20983         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
20984         FREE(untag_ptr(_res));
20985         CResult_NonePeerHandleErrorZ_free(_res_conv);
20986 }
20987
20988 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
20989         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20990         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
20991         return tag_ptr(ret_conv, true);
20992 }
20993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20994         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
20995         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
20996         return ret_conv;
20997 }
20998
20999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21000         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
21001         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21002         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
21003         return tag_ptr(ret_conv, true);
21004 }
21005
21006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
21007         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21008         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
21009         return tag_ptr(ret_conv, true);
21010 }
21011
21012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21013         LDKPeerHandleError e_conv;
21014         e_conv.inner = untag_ptr(e);
21015         e_conv.is_owned = ptr_is_owned(e);
21016         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21017         e_conv = PeerHandleError_clone(&e_conv);
21018         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21019         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
21020         return tag_ptr(ret_conv, true);
21021 }
21022
21023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21024         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
21025         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
21026         return ret_conv;
21027 }
21028
21029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21030         if (!ptr_is_owned(_res)) return;
21031         void* _res_ptr = untag_ptr(_res);
21032         CHECK_ACCESS(_res_ptr);
21033         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
21034         FREE(untag_ptr(_res));
21035         CResult_boolPeerHandleErrorZ_free(_res_conv);
21036 }
21037
21038 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
21039         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21040         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
21041         return tag_ptr(ret_conv, true);
21042 }
21043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21044         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
21045         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
21046         return ret_conv;
21047 }
21048
21049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21050         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
21051         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21052         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
21053         return tag_ptr(ret_conv, true);
21054 }
21055
21056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
21057         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21058         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
21059         return tag_ptr(ret_conv, true);
21060 }
21061
21062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21063         void* e_ptr = untag_ptr(e);
21064         CHECK_ACCESS(e_ptr);
21065         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
21066         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
21067         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
21068         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
21069         return tag_ptr(ret_conv, true);
21070 }
21071
21072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21073         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
21074         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
21075         return ret_conv;
21076 }
21077
21078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21079         if (!ptr_is_owned(_res)) return;
21080         void* _res_ptr = untag_ptr(_res);
21081         CHECK_ACCESS(_res_ptr);
21082         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
21083         FREE(untag_ptr(_res));
21084         CResult_u32GraphSyncErrorZ_free(_res_conv);
21085 }
21086
21087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21088         void* o_ptr = untag_ptr(o);
21089         CHECK_ACCESS(o_ptr);
21090         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21091         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
21092         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21093         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
21094         return tag_ptr(ret_conv, true);
21095 }
21096
21097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21098         LDKDecodeError e_conv;
21099         e_conv.inner = untag_ptr(e);
21100         e_conv.is_owned = ptr_is_owned(e);
21101         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21102         e_conv = DecodeError_clone(&e_conv);
21103         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21104         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
21105         return tag_ptr(ret_conv, true);
21106 }
21107
21108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21109         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
21110         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
21111         return ret_conv;
21112 }
21113
21114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21115         if (!ptr_is_owned(_res)) return;
21116         void* _res_ptr = untag_ptr(_res);
21117         CHECK_ACCESS(_res_ptr);
21118         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
21119         FREE(untag_ptr(_res));
21120         CResult_NetAddressDecodeErrorZ_free(_res_conv);
21121 }
21122
21123 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
21124         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21125         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
21126         return tag_ptr(ret_conv, true);
21127 }
21128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21129         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
21130         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
21131         return ret_conv;
21132 }
21133
21134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21135         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
21136         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21137         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
21138         return tag_ptr(ret_conv, true);
21139 }
21140
21141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21142         LDKCVec_UpdateAddHTLCZ _res_constr;
21143         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21144         if (_res_constr.datalen > 0)
21145                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21146         else
21147                 _res_constr.data = NULL;
21148         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21149         for (size_t p = 0; p < _res_constr.datalen; p++) {
21150                 int64_t _res_conv_15 = _res_vals[p];
21151                 LDKUpdateAddHTLC _res_conv_15_conv;
21152                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
21153                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
21154                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
21155                 _res_constr.data[p] = _res_conv_15_conv;
21156         }
21157         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21158         CVec_UpdateAddHTLCZ_free(_res_constr);
21159 }
21160
21161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21162         LDKCVec_UpdateFulfillHTLCZ _res_constr;
21163         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21164         if (_res_constr.datalen > 0)
21165                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21166         else
21167                 _res_constr.data = NULL;
21168         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21169         for (size_t t = 0; t < _res_constr.datalen; t++) {
21170                 int64_t _res_conv_19 = _res_vals[t];
21171                 LDKUpdateFulfillHTLC _res_conv_19_conv;
21172                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
21173                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
21174                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21175                 _res_constr.data[t] = _res_conv_19_conv;
21176         }
21177         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21178         CVec_UpdateFulfillHTLCZ_free(_res_constr);
21179 }
21180
21181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21182         LDKCVec_UpdateFailHTLCZ _res_constr;
21183         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21184         if (_res_constr.datalen > 0)
21185                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21186         else
21187                 _res_constr.data = NULL;
21188         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21189         for (size_t q = 0; q < _res_constr.datalen; q++) {
21190                 int64_t _res_conv_16 = _res_vals[q];
21191                 LDKUpdateFailHTLC _res_conv_16_conv;
21192                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21193                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21194                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21195                 _res_constr.data[q] = _res_conv_16_conv;
21196         }
21197         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21198         CVec_UpdateFailHTLCZ_free(_res_constr);
21199 }
21200
21201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21202         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
21203         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21204         if (_res_constr.datalen > 0)
21205                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21206         else
21207                 _res_constr.data = NULL;
21208         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21209         for (size_t z = 0; z < _res_constr.datalen; z++) {
21210                 int64_t _res_conv_25 = _res_vals[z];
21211                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
21212                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
21213                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
21214                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
21215                 _res_constr.data[z] = _res_conv_25_conv;
21216         }
21217         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21218         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
21219 }
21220
21221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21222         LDKAcceptChannel o_conv;
21223         o_conv.inner = untag_ptr(o);
21224         o_conv.is_owned = ptr_is_owned(o);
21225         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21226         o_conv = AcceptChannel_clone(&o_conv);
21227         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21228         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
21229         return tag_ptr(ret_conv, true);
21230 }
21231
21232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21233         LDKDecodeError e_conv;
21234         e_conv.inner = untag_ptr(e);
21235         e_conv.is_owned = ptr_is_owned(e);
21236         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21237         e_conv = DecodeError_clone(&e_conv);
21238         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21239         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
21240         return tag_ptr(ret_conv, true);
21241 }
21242
21243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21244         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
21245         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
21246         return ret_conv;
21247 }
21248
21249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21250         if (!ptr_is_owned(_res)) return;
21251         void* _res_ptr = untag_ptr(_res);
21252         CHECK_ACCESS(_res_ptr);
21253         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
21254         FREE(untag_ptr(_res));
21255         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
21256 }
21257
21258 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
21259         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21260         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
21261         return tag_ptr(ret_conv, true);
21262 }
21263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21264         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
21265         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
21266         return ret_conv;
21267 }
21268
21269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21270         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
21271         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21272         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
21273         return tag_ptr(ret_conv, true);
21274 }
21275
21276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21277         LDKAnnouncementSignatures o_conv;
21278         o_conv.inner = untag_ptr(o);
21279         o_conv.is_owned = ptr_is_owned(o);
21280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21281         o_conv = AnnouncementSignatures_clone(&o_conv);
21282         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21283         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
21284         return tag_ptr(ret_conv, true);
21285 }
21286
21287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21288         LDKDecodeError e_conv;
21289         e_conv.inner = untag_ptr(e);
21290         e_conv.is_owned = ptr_is_owned(e);
21291         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21292         e_conv = DecodeError_clone(&e_conv);
21293         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21294         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
21295         return tag_ptr(ret_conv, true);
21296 }
21297
21298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21299         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
21300         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
21301         return ret_conv;
21302 }
21303
21304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21305         if (!ptr_is_owned(_res)) return;
21306         void* _res_ptr = untag_ptr(_res);
21307         CHECK_ACCESS(_res_ptr);
21308         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
21309         FREE(untag_ptr(_res));
21310         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
21311 }
21312
21313 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
21314         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21315         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
21316         return tag_ptr(ret_conv, true);
21317 }
21318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21319         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
21320         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
21321         return ret_conv;
21322 }
21323
21324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21325         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
21326         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21327         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
21328         return tag_ptr(ret_conv, true);
21329 }
21330
21331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21332         LDKChannelReestablish o_conv;
21333         o_conv.inner = untag_ptr(o);
21334         o_conv.is_owned = ptr_is_owned(o);
21335         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21336         o_conv = ChannelReestablish_clone(&o_conv);
21337         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21338         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
21339         return tag_ptr(ret_conv, true);
21340 }
21341
21342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21343         LDKDecodeError e_conv;
21344         e_conv.inner = untag_ptr(e);
21345         e_conv.is_owned = ptr_is_owned(e);
21346         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21347         e_conv = DecodeError_clone(&e_conv);
21348         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21349         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
21350         return tag_ptr(ret_conv, true);
21351 }
21352
21353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21354         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
21355         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
21356         return ret_conv;
21357 }
21358
21359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21360         if (!ptr_is_owned(_res)) return;
21361         void* _res_ptr = untag_ptr(_res);
21362         CHECK_ACCESS(_res_ptr);
21363         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
21364         FREE(untag_ptr(_res));
21365         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
21366 }
21367
21368 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
21369         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21370         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
21371         return tag_ptr(ret_conv, true);
21372 }
21373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21374         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
21375         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
21376         return ret_conv;
21377 }
21378
21379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21380         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
21381         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21382         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
21383         return tag_ptr(ret_conv, true);
21384 }
21385
21386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21387         LDKClosingSigned o_conv;
21388         o_conv.inner = untag_ptr(o);
21389         o_conv.is_owned = ptr_is_owned(o);
21390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21391         o_conv = ClosingSigned_clone(&o_conv);
21392         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21393         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
21394         return tag_ptr(ret_conv, true);
21395 }
21396
21397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21398         LDKDecodeError e_conv;
21399         e_conv.inner = untag_ptr(e);
21400         e_conv.is_owned = ptr_is_owned(e);
21401         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21402         e_conv = DecodeError_clone(&e_conv);
21403         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21404         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
21405         return tag_ptr(ret_conv, true);
21406 }
21407
21408 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21409         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
21410         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
21411         return ret_conv;
21412 }
21413
21414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21415         if (!ptr_is_owned(_res)) return;
21416         void* _res_ptr = untag_ptr(_res);
21417         CHECK_ACCESS(_res_ptr);
21418         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
21419         FREE(untag_ptr(_res));
21420         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
21421 }
21422
21423 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
21424         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21425         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
21426         return tag_ptr(ret_conv, true);
21427 }
21428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21429         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
21430         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
21431         return ret_conv;
21432 }
21433
21434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21435         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
21436         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21437         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
21438         return tag_ptr(ret_conv, true);
21439 }
21440
21441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21442         LDKClosingSignedFeeRange o_conv;
21443         o_conv.inner = untag_ptr(o);
21444         o_conv.is_owned = ptr_is_owned(o);
21445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21446         o_conv = ClosingSignedFeeRange_clone(&o_conv);
21447         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21448         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
21449         return tag_ptr(ret_conv, true);
21450 }
21451
21452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21453         LDKDecodeError e_conv;
21454         e_conv.inner = untag_ptr(e);
21455         e_conv.is_owned = ptr_is_owned(e);
21456         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21457         e_conv = DecodeError_clone(&e_conv);
21458         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21459         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
21460         return tag_ptr(ret_conv, true);
21461 }
21462
21463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21464         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
21465         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
21466         return ret_conv;
21467 }
21468
21469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21470         if (!ptr_is_owned(_res)) return;
21471         void* _res_ptr = untag_ptr(_res);
21472         CHECK_ACCESS(_res_ptr);
21473         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
21474         FREE(untag_ptr(_res));
21475         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
21476 }
21477
21478 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
21479         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21480         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
21481         return tag_ptr(ret_conv, true);
21482 }
21483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21484         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
21485         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
21486         return ret_conv;
21487 }
21488
21489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21490         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
21491         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21492         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
21493         return tag_ptr(ret_conv, true);
21494 }
21495
21496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21497         LDKCommitmentSigned o_conv;
21498         o_conv.inner = untag_ptr(o);
21499         o_conv.is_owned = ptr_is_owned(o);
21500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21501         o_conv = CommitmentSigned_clone(&o_conv);
21502         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21503         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
21504         return tag_ptr(ret_conv, true);
21505 }
21506
21507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21508         LDKDecodeError e_conv;
21509         e_conv.inner = untag_ptr(e);
21510         e_conv.is_owned = ptr_is_owned(e);
21511         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21512         e_conv = DecodeError_clone(&e_conv);
21513         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21514         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
21515         return tag_ptr(ret_conv, true);
21516 }
21517
21518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21519         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
21520         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
21521         return ret_conv;
21522 }
21523
21524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21525         if (!ptr_is_owned(_res)) return;
21526         void* _res_ptr = untag_ptr(_res);
21527         CHECK_ACCESS(_res_ptr);
21528         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
21529         FREE(untag_ptr(_res));
21530         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
21531 }
21532
21533 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
21534         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21535         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
21536         return tag_ptr(ret_conv, true);
21537 }
21538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21539         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
21540         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
21541         return ret_conv;
21542 }
21543
21544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21545         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
21546         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21547         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
21548         return tag_ptr(ret_conv, true);
21549 }
21550
21551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21552         LDKFundingCreated o_conv;
21553         o_conv.inner = untag_ptr(o);
21554         o_conv.is_owned = ptr_is_owned(o);
21555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21556         o_conv = FundingCreated_clone(&o_conv);
21557         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21558         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
21559         return tag_ptr(ret_conv, true);
21560 }
21561
21562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21563         LDKDecodeError e_conv;
21564         e_conv.inner = untag_ptr(e);
21565         e_conv.is_owned = ptr_is_owned(e);
21566         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21567         e_conv = DecodeError_clone(&e_conv);
21568         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21569         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
21570         return tag_ptr(ret_conv, true);
21571 }
21572
21573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21574         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
21575         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
21576         return ret_conv;
21577 }
21578
21579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21580         if (!ptr_is_owned(_res)) return;
21581         void* _res_ptr = untag_ptr(_res);
21582         CHECK_ACCESS(_res_ptr);
21583         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
21584         FREE(untag_ptr(_res));
21585         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
21586 }
21587
21588 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
21589         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21590         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
21591         return tag_ptr(ret_conv, true);
21592 }
21593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21594         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
21595         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
21596         return ret_conv;
21597 }
21598
21599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21600         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
21601         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21602         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
21603         return tag_ptr(ret_conv, true);
21604 }
21605
21606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21607         LDKFundingSigned o_conv;
21608         o_conv.inner = untag_ptr(o);
21609         o_conv.is_owned = ptr_is_owned(o);
21610         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21611         o_conv = FundingSigned_clone(&o_conv);
21612         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21613         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
21614         return tag_ptr(ret_conv, true);
21615 }
21616
21617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21618         LDKDecodeError e_conv;
21619         e_conv.inner = untag_ptr(e);
21620         e_conv.is_owned = ptr_is_owned(e);
21621         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21622         e_conv = DecodeError_clone(&e_conv);
21623         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21624         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
21625         return tag_ptr(ret_conv, true);
21626 }
21627
21628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21629         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
21630         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
21631         return ret_conv;
21632 }
21633
21634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21635         if (!ptr_is_owned(_res)) return;
21636         void* _res_ptr = untag_ptr(_res);
21637         CHECK_ACCESS(_res_ptr);
21638         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
21639         FREE(untag_ptr(_res));
21640         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
21641 }
21642
21643 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
21644         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21645         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
21646         return tag_ptr(ret_conv, true);
21647 }
21648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21649         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
21650         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
21651         return ret_conv;
21652 }
21653
21654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21655         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
21656         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21657         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
21658         return tag_ptr(ret_conv, true);
21659 }
21660
21661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21662         LDKChannelReady o_conv;
21663         o_conv.inner = untag_ptr(o);
21664         o_conv.is_owned = ptr_is_owned(o);
21665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21666         o_conv = ChannelReady_clone(&o_conv);
21667         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21668         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
21669         return tag_ptr(ret_conv, true);
21670 }
21671
21672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21673         LDKDecodeError e_conv;
21674         e_conv.inner = untag_ptr(e);
21675         e_conv.is_owned = ptr_is_owned(e);
21676         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21677         e_conv = DecodeError_clone(&e_conv);
21678         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21679         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
21680         return tag_ptr(ret_conv, true);
21681 }
21682
21683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21684         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
21685         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
21686         return ret_conv;
21687 }
21688
21689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21690         if (!ptr_is_owned(_res)) return;
21691         void* _res_ptr = untag_ptr(_res);
21692         CHECK_ACCESS(_res_ptr);
21693         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
21694         FREE(untag_ptr(_res));
21695         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
21696 }
21697
21698 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
21699         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21700         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
21701         return tag_ptr(ret_conv, true);
21702 }
21703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21704         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
21705         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
21706         return ret_conv;
21707 }
21708
21709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21710         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
21711         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
21712         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
21713         return tag_ptr(ret_conv, true);
21714 }
21715
21716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21717         LDKInit o_conv;
21718         o_conv.inner = untag_ptr(o);
21719         o_conv.is_owned = ptr_is_owned(o);
21720         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21721         o_conv = Init_clone(&o_conv);
21722         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21723         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
21724         return tag_ptr(ret_conv, true);
21725 }
21726
21727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21728         LDKDecodeError e_conv;
21729         e_conv.inner = untag_ptr(e);
21730         e_conv.is_owned = ptr_is_owned(e);
21731         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21732         e_conv = DecodeError_clone(&e_conv);
21733         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21734         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
21735         return tag_ptr(ret_conv, true);
21736 }
21737
21738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21739         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
21740         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
21741         return ret_conv;
21742 }
21743
21744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21745         if (!ptr_is_owned(_res)) return;
21746         void* _res_ptr = untag_ptr(_res);
21747         CHECK_ACCESS(_res_ptr);
21748         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
21749         FREE(untag_ptr(_res));
21750         CResult_InitDecodeErrorZ_free(_res_conv);
21751 }
21752
21753 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
21754         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21755         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
21756         return tag_ptr(ret_conv, true);
21757 }
21758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21759         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
21760         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
21761         return ret_conv;
21762 }
21763
21764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21765         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
21766         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21767         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
21768         return tag_ptr(ret_conv, true);
21769 }
21770
21771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21772         LDKOpenChannel o_conv;
21773         o_conv.inner = untag_ptr(o);
21774         o_conv.is_owned = ptr_is_owned(o);
21775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21776         o_conv = OpenChannel_clone(&o_conv);
21777         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21778         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
21779         return tag_ptr(ret_conv, true);
21780 }
21781
21782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21783         LDKDecodeError e_conv;
21784         e_conv.inner = untag_ptr(e);
21785         e_conv.is_owned = ptr_is_owned(e);
21786         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21787         e_conv = DecodeError_clone(&e_conv);
21788         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21789         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
21790         return tag_ptr(ret_conv, true);
21791 }
21792
21793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21794         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
21795         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
21796         return ret_conv;
21797 }
21798
21799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21800         if (!ptr_is_owned(_res)) return;
21801         void* _res_ptr = untag_ptr(_res);
21802         CHECK_ACCESS(_res_ptr);
21803         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
21804         FREE(untag_ptr(_res));
21805         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
21806 }
21807
21808 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
21809         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21810         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
21811         return tag_ptr(ret_conv, true);
21812 }
21813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21814         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
21815         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
21816         return ret_conv;
21817 }
21818
21819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21820         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
21821         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21822         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
21823         return tag_ptr(ret_conv, true);
21824 }
21825
21826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21827         LDKRevokeAndACK o_conv;
21828         o_conv.inner = untag_ptr(o);
21829         o_conv.is_owned = ptr_is_owned(o);
21830         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21831         o_conv = RevokeAndACK_clone(&o_conv);
21832         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21833         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
21834         return tag_ptr(ret_conv, true);
21835 }
21836
21837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21838         LDKDecodeError e_conv;
21839         e_conv.inner = untag_ptr(e);
21840         e_conv.is_owned = ptr_is_owned(e);
21841         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21842         e_conv = DecodeError_clone(&e_conv);
21843         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21844         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
21845         return tag_ptr(ret_conv, true);
21846 }
21847
21848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21849         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
21850         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
21851         return ret_conv;
21852 }
21853
21854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21855         if (!ptr_is_owned(_res)) return;
21856         void* _res_ptr = untag_ptr(_res);
21857         CHECK_ACCESS(_res_ptr);
21858         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
21859         FREE(untag_ptr(_res));
21860         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
21861 }
21862
21863 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
21864         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21865         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
21866         return tag_ptr(ret_conv, true);
21867 }
21868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21869         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
21870         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
21871         return ret_conv;
21872 }
21873
21874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21875         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
21876         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21877         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
21878         return tag_ptr(ret_conv, true);
21879 }
21880
21881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21882         LDKShutdown o_conv;
21883         o_conv.inner = untag_ptr(o);
21884         o_conv.is_owned = ptr_is_owned(o);
21885         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21886         o_conv = Shutdown_clone(&o_conv);
21887         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21888         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
21889         return tag_ptr(ret_conv, true);
21890 }
21891
21892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21893         LDKDecodeError e_conv;
21894         e_conv.inner = untag_ptr(e);
21895         e_conv.is_owned = ptr_is_owned(e);
21896         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21897         e_conv = DecodeError_clone(&e_conv);
21898         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21899         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
21900         return tag_ptr(ret_conv, true);
21901 }
21902
21903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21904         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
21905         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
21906         return ret_conv;
21907 }
21908
21909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21910         if (!ptr_is_owned(_res)) return;
21911         void* _res_ptr = untag_ptr(_res);
21912         CHECK_ACCESS(_res_ptr);
21913         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
21914         FREE(untag_ptr(_res));
21915         CResult_ShutdownDecodeErrorZ_free(_res_conv);
21916 }
21917
21918 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
21919         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21920         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
21921         return tag_ptr(ret_conv, true);
21922 }
21923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21924         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
21925         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
21926         return ret_conv;
21927 }
21928
21929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21930         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
21931         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21932         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
21933         return tag_ptr(ret_conv, true);
21934 }
21935
21936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21937         LDKUpdateFailHTLC o_conv;
21938         o_conv.inner = untag_ptr(o);
21939         o_conv.is_owned = ptr_is_owned(o);
21940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21941         o_conv = UpdateFailHTLC_clone(&o_conv);
21942         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21943         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
21944         return tag_ptr(ret_conv, true);
21945 }
21946
21947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21948         LDKDecodeError e_conv;
21949         e_conv.inner = untag_ptr(e);
21950         e_conv.is_owned = ptr_is_owned(e);
21951         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21952         e_conv = DecodeError_clone(&e_conv);
21953         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21954         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
21955         return tag_ptr(ret_conv, true);
21956 }
21957
21958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21959         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
21960         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
21961         return ret_conv;
21962 }
21963
21964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21965         if (!ptr_is_owned(_res)) return;
21966         void* _res_ptr = untag_ptr(_res);
21967         CHECK_ACCESS(_res_ptr);
21968         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
21969         FREE(untag_ptr(_res));
21970         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
21971 }
21972
21973 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
21974         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21975         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
21976         return tag_ptr(ret_conv, true);
21977 }
21978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21979         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
21980         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
21981         return ret_conv;
21982 }
21983
21984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21985         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
21986         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21987         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
21988         return tag_ptr(ret_conv, true);
21989 }
21990
21991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21992         LDKUpdateFailMalformedHTLC o_conv;
21993         o_conv.inner = untag_ptr(o);
21994         o_conv.is_owned = ptr_is_owned(o);
21995         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21996         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
21997         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21998         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
21999         return tag_ptr(ret_conv, true);
22000 }
22001
22002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22003         LDKDecodeError e_conv;
22004         e_conv.inner = untag_ptr(e);
22005         e_conv.is_owned = ptr_is_owned(e);
22006         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22007         e_conv = DecodeError_clone(&e_conv);
22008         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22009         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
22010         return tag_ptr(ret_conv, true);
22011 }
22012
22013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22014         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
22015         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
22016         return ret_conv;
22017 }
22018
22019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22020         if (!ptr_is_owned(_res)) return;
22021         void* _res_ptr = untag_ptr(_res);
22022         CHECK_ACCESS(_res_ptr);
22023         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
22024         FREE(untag_ptr(_res));
22025         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
22026 }
22027
22028 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
22029         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22030         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
22031         return tag_ptr(ret_conv, true);
22032 }
22033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22034         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
22035         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
22036         return ret_conv;
22037 }
22038
22039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22040         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
22041         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
22042         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
22043         return tag_ptr(ret_conv, true);
22044 }
22045
22046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22047         LDKUpdateFee o_conv;
22048         o_conv.inner = untag_ptr(o);
22049         o_conv.is_owned = ptr_is_owned(o);
22050         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22051         o_conv = UpdateFee_clone(&o_conv);
22052         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22053         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
22054         return tag_ptr(ret_conv, true);
22055 }
22056
22057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22058         LDKDecodeError e_conv;
22059         e_conv.inner = untag_ptr(e);
22060         e_conv.is_owned = ptr_is_owned(e);
22061         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22062         e_conv = DecodeError_clone(&e_conv);
22063         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22064         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
22065         return tag_ptr(ret_conv, true);
22066 }
22067
22068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22069         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
22070         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
22071         return ret_conv;
22072 }
22073
22074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22075         if (!ptr_is_owned(_res)) return;
22076         void* _res_ptr = untag_ptr(_res);
22077         CHECK_ACCESS(_res_ptr);
22078         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
22079         FREE(untag_ptr(_res));
22080         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
22081 }
22082
22083 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
22084         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22085         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
22086         return tag_ptr(ret_conv, true);
22087 }
22088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22089         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
22090         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
22091         return ret_conv;
22092 }
22093
22094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22095         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
22096         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22097         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
22098         return tag_ptr(ret_conv, true);
22099 }
22100
22101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22102         LDKUpdateFulfillHTLC o_conv;
22103         o_conv.inner = untag_ptr(o);
22104         o_conv.is_owned = ptr_is_owned(o);
22105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22106         o_conv = UpdateFulfillHTLC_clone(&o_conv);
22107         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22108         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
22109         return tag_ptr(ret_conv, true);
22110 }
22111
22112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22113         LDKDecodeError e_conv;
22114         e_conv.inner = untag_ptr(e);
22115         e_conv.is_owned = ptr_is_owned(e);
22116         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22117         e_conv = DecodeError_clone(&e_conv);
22118         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22119         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
22120         return tag_ptr(ret_conv, true);
22121 }
22122
22123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22124         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
22125         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
22126         return ret_conv;
22127 }
22128
22129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22130         if (!ptr_is_owned(_res)) return;
22131         void* _res_ptr = untag_ptr(_res);
22132         CHECK_ACCESS(_res_ptr);
22133         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
22134         FREE(untag_ptr(_res));
22135         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
22136 }
22137
22138 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
22139         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22140         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
22141         return tag_ptr(ret_conv, true);
22142 }
22143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22144         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
22145         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
22146         return ret_conv;
22147 }
22148
22149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22150         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
22151         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22152         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
22153         return tag_ptr(ret_conv, true);
22154 }
22155
22156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22157         LDKUpdateAddHTLC o_conv;
22158         o_conv.inner = untag_ptr(o);
22159         o_conv.is_owned = ptr_is_owned(o);
22160         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22161         o_conv = UpdateAddHTLC_clone(&o_conv);
22162         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22163         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
22164         return tag_ptr(ret_conv, true);
22165 }
22166
22167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22168         LDKDecodeError e_conv;
22169         e_conv.inner = untag_ptr(e);
22170         e_conv.is_owned = ptr_is_owned(e);
22171         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22172         e_conv = DecodeError_clone(&e_conv);
22173         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22174         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
22175         return tag_ptr(ret_conv, true);
22176 }
22177
22178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22179         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
22180         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
22181         return ret_conv;
22182 }
22183
22184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22185         if (!ptr_is_owned(_res)) return;
22186         void* _res_ptr = untag_ptr(_res);
22187         CHECK_ACCESS(_res_ptr);
22188         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
22189         FREE(untag_ptr(_res));
22190         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
22191 }
22192
22193 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
22194         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22195         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
22196         return tag_ptr(ret_conv, true);
22197 }
22198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22199         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
22200         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
22201         return ret_conv;
22202 }
22203
22204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22205         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
22206         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22207         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
22208         return tag_ptr(ret_conv, true);
22209 }
22210
22211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22212         LDKPing o_conv;
22213         o_conv.inner = untag_ptr(o);
22214         o_conv.is_owned = ptr_is_owned(o);
22215         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22216         o_conv = Ping_clone(&o_conv);
22217         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22218         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
22219         return tag_ptr(ret_conv, true);
22220 }
22221
22222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22223         LDKDecodeError e_conv;
22224         e_conv.inner = untag_ptr(e);
22225         e_conv.is_owned = ptr_is_owned(e);
22226         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22227         e_conv = DecodeError_clone(&e_conv);
22228         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22229         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
22230         return tag_ptr(ret_conv, true);
22231 }
22232
22233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22234         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
22235         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
22236         return ret_conv;
22237 }
22238
22239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22240         if (!ptr_is_owned(_res)) return;
22241         void* _res_ptr = untag_ptr(_res);
22242         CHECK_ACCESS(_res_ptr);
22243         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
22244         FREE(untag_ptr(_res));
22245         CResult_PingDecodeErrorZ_free(_res_conv);
22246 }
22247
22248 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
22249         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22250         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
22251         return tag_ptr(ret_conv, true);
22252 }
22253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22254         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
22255         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
22256         return ret_conv;
22257 }
22258
22259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22260         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
22261         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22262         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
22263         return tag_ptr(ret_conv, true);
22264 }
22265
22266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22267         LDKPong o_conv;
22268         o_conv.inner = untag_ptr(o);
22269         o_conv.is_owned = ptr_is_owned(o);
22270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22271         o_conv = Pong_clone(&o_conv);
22272         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22273         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
22274         return tag_ptr(ret_conv, true);
22275 }
22276
22277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22278         LDKDecodeError e_conv;
22279         e_conv.inner = untag_ptr(e);
22280         e_conv.is_owned = ptr_is_owned(e);
22281         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22282         e_conv = DecodeError_clone(&e_conv);
22283         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22284         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
22285         return tag_ptr(ret_conv, true);
22286 }
22287
22288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22289         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
22290         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
22291         return ret_conv;
22292 }
22293
22294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22295         if (!ptr_is_owned(_res)) return;
22296         void* _res_ptr = untag_ptr(_res);
22297         CHECK_ACCESS(_res_ptr);
22298         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
22299         FREE(untag_ptr(_res));
22300         CResult_PongDecodeErrorZ_free(_res_conv);
22301 }
22302
22303 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
22304         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22305         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
22306         return tag_ptr(ret_conv, true);
22307 }
22308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22309         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
22310         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
22311         return ret_conv;
22312 }
22313
22314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22315         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
22316         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22317         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
22318         return tag_ptr(ret_conv, true);
22319 }
22320
22321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22322         LDKUnsignedChannelAnnouncement o_conv;
22323         o_conv.inner = untag_ptr(o);
22324         o_conv.is_owned = ptr_is_owned(o);
22325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22326         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
22327         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22328         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
22329         return tag_ptr(ret_conv, true);
22330 }
22331
22332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22333         LDKDecodeError e_conv;
22334         e_conv.inner = untag_ptr(e);
22335         e_conv.is_owned = ptr_is_owned(e);
22336         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22337         e_conv = DecodeError_clone(&e_conv);
22338         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22339         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
22340         return tag_ptr(ret_conv, true);
22341 }
22342
22343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22344         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
22345         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22346         return ret_conv;
22347 }
22348
22349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22350         if (!ptr_is_owned(_res)) return;
22351         void* _res_ptr = untag_ptr(_res);
22352         CHECK_ACCESS(_res_ptr);
22353         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22354         FREE(untag_ptr(_res));
22355         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
22356 }
22357
22358 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22359         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22360         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
22361         return tag_ptr(ret_conv, true);
22362 }
22363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22364         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
22365         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22366         return ret_conv;
22367 }
22368
22369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22370         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
22371         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22372         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22373         return tag_ptr(ret_conv, true);
22374 }
22375
22376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22377         LDKChannelAnnouncement o_conv;
22378         o_conv.inner = untag_ptr(o);
22379         o_conv.is_owned = ptr_is_owned(o);
22380         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22381         o_conv = ChannelAnnouncement_clone(&o_conv);
22382         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22383         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
22384         return tag_ptr(ret_conv, true);
22385 }
22386
22387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22388         LDKDecodeError e_conv;
22389         e_conv.inner = untag_ptr(e);
22390         e_conv.is_owned = ptr_is_owned(e);
22391         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22392         e_conv = DecodeError_clone(&e_conv);
22393         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22394         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
22395         return tag_ptr(ret_conv, true);
22396 }
22397
22398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22399         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
22400         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22401         return ret_conv;
22402 }
22403
22404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22405         if (!ptr_is_owned(_res)) return;
22406         void* _res_ptr = untag_ptr(_res);
22407         CHECK_ACCESS(_res_ptr);
22408         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22409         FREE(untag_ptr(_res));
22410         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
22411 }
22412
22413 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22414         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22415         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
22416         return tag_ptr(ret_conv, true);
22417 }
22418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22419         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
22420         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22421         return ret_conv;
22422 }
22423
22424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22425         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
22426         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22427         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22428         return tag_ptr(ret_conv, true);
22429 }
22430
22431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22432         LDKUnsignedChannelUpdate o_conv;
22433         o_conv.inner = untag_ptr(o);
22434         o_conv.is_owned = ptr_is_owned(o);
22435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22436         o_conv = UnsignedChannelUpdate_clone(&o_conv);
22437         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22438         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
22439         return tag_ptr(ret_conv, true);
22440 }
22441
22442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22443         LDKDecodeError e_conv;
22444         e_conv.inner = untag_ptr(e);
22445         e_conv.is_owned = ptr_is_owned(e);
22446         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22447         e_conv = DecodeError_clone(&e_conv);
22448         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22449         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
22450         return tag_ptr(ret_conv, true);
22451 }
22452
22453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22454         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
22455         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
22456         return ret_conv;
22457 }
22458
22459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22460         if (!ptr_is_owned(_res)) return;
22461         void* _res_ptr = untag_ptr(_res);
22462         CHECK_ACCESS(_res_ptr);
22463         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
22464         FREE(untag_ptr(_res));
22465         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
22466 }
22467
22468 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22469         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22470         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
22471         return tag_ptr(ret_conv, true);
22472 }
22473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22474         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
22475         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22476         return ret_conv;
22477 }
22478
22479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22480         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
22481         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22482         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
22483         return tag_ptr(ret_conv, true);
22484 }
22485
22486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22487         LDKChannelUpdate o_conv;
22488         o_conv.inner = untag_ptr(o);
22489         o_conv.is_owned = ptr_is_owned(o);
22490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22491         o_conv = ChannelUpdate_clone(&o_conv);
22492         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22493         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
22494         return tag_ptr(ret_conv, true);
22495 }
22496
22497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22498         LDKDecodeError e_conv;
22499         e_conv.inner = untag_ptr(e);
22500         e_conv.is_owned = ptr_is_owned(e);
22501         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22502         e_conv = DecodeError_clone(&e_conv);
22503         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22504         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
22505         return tag_ptr(ret_conv, true);
22506 }
22507
22508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22509         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
22510         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
22511         return ret_conv;
22512 }
22513
22514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22515         if (!ptr_is_owned(_res)) return;
22516         void* _res_ptr = untag_ptr(_res);
22517         CHECK_ACCESS(_res_ptr);
22518         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
22519         FREE(untag_ptr(_res));
22520         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
22521 }
22522
22523 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22524         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22525         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
22526         return tag_ptr(ret_conv, true);
22527 }
22528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22529         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
22530         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22531         return ret_conv;
22532 }
22533
22534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22535         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
22536         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22537         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
22538         return tag_ptr(ret_conv, true);
22539 }
22540
22541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22542         LDKErrorMessage o_conv;
22543         o_conv.inner = untag_ptr(o);
22544         o_conv.is_owned = ptr_is_owned(o);
22545         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22546         o_conv = ErrorMessage_clone(&o_conv);
22547         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22548         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
22549         return tag_ptr(ret_conv, true);
22550 }
22551
22552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22553         LDKDecodeError e_conv;
22554         e_conv.inner = untag_ptr(e);
22555         e_conv.is_owned = ptr_is_owned(e);
22556         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22557         e_conv = DecodeError_clone(&e_conv);
22558         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22559         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
22560         return tag_ptr(ret_conv, true);
22561 }
22562
22563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22564         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
22565         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
22566         return ret_conv;
22567 }
22568
22569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22570         if (!ptr_is_owned(_res)) return;
22571         void* _res_ptr = untag_ptr(_res);
22572         CHECK_ACCESS(_res_ptr);
22573         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
22574         FREE(untag_ptr(_res));
22575         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
22576 }
22577
22578 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
22579         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22580         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
22581         return tag_ptr(ret_conv, true);
22582 }
22583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22584         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
22585         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
22586         return ret_conv;
22587 }
22588
22589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22590         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
22591         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22592         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
22593         return tag_ptr(ret_conv, true);
22594 }
22595
22596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22597         LDKWarningMessage o_conv;
22598         o_conv.inner = untag_ptr(o);
22599         o_conv.is_owned = ptr_is_owned(o);
22600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22601         o_conv = WarningMessage_clone(&o_conv);
22602         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22603         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
22604         return tag_ptr(ret_conv, true);
22605 }
22606
22607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22608         LDKDecodeError e_conv;
22609         e_conv.inner = untag_ptr(e);
22610         e_conv.is_owned = ptr_is_owned(e);
22611         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22612         e_conv = DecodeError_clone(&e_conv);
22613         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22614         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
22615         return tag_ptr(ret_conv, true);
22616 }
22617
22618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22619         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
22620         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
22621         return ret_conv;
22622 }
22623
22624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22625         if (!ptr_is_owned(_res)) return;
22626         void* _res_ptr = untag_ptr(_res);
22627         CHECK_ACCESS(_res_ptr);
22628         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
22629         FREE(untag_ptr(_res));
22630         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
22631 }
22632
22633 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
22634         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22635         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
22636         return tag_ptr(ret_conv, true);
22637 }
22638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22639         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
22640         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
22641         return ret_conv;
22642 }
22643
22644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22645         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
22646         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22647         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
22648         return tag_ptr(ret_conv, true);
22649 }
22650
22651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22652         LDKUnsignedNodeAnnouncement o_conv;
22653         o_conv.inner = untag_ptr(o);
22654         o_conv.is_owned = ptr_is_owned(o);
22655         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22656         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
22657         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22658         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
22659         return tag_ptr(ret_conv, true);
22660 }
22661
22662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22663         LDKDecodeError e_conv;
22664         e_conv.inner = untag_ptr(e);
22665         e_conv.is_owned = ptr_is_owned(e);
22666         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22667         e_conv = DecodeError_clone(&e_conv);
22668         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22669         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
22670         return tag_ptr(ret_conv, true);
22671 }
22672
22673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22674         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
22675         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22676         return ret_conv;
22677 }
22678
22679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22680         if (!ptr_is_owned(_res)) return;
22681         void* _res_ptr = untag_ptr(_res);
22682         CHECK_ACCESS(_res_ptr);
22683         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
22684         FREE(untag_ptr(_res));
22685         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
22686 }
22687
22688 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22689         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22690         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
22691         return tag_ptr(ret_conv, true);
22692 }
22693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22694         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
22695         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22696         return ret_conv;
22697 }
22698
22699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22700         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
22701         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22702         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
22703         return tag_ptr(ret_conv, true);
22704 }
22705
22706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22707         LDKNodeAnnouncement o_conv;
22708         o_conv.inner = untag_ptr(o);
22709         o_conv.is_owned = ptr_is_owned(o);
22710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22711         o_conv = NodeAnnouncement_clone(&o_conv);
22712         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22713         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
22714         return tag_ptr(ret_conv, true);
22715 }
22716
22717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22718         LDKDecodeError e_conv;
22719         e_conv.inner = untag_ptr(e);
22720         e_conv.is_owned = ptr_is_owned(e);
22721         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22722         e_conv = DecodeError_clone(&e_conv);
22723         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22724         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
22725         return tag_ptr(ret_conv, true);
22726 }
22727
22728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22729         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
22730         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22731         return ret_conv;
22732 }
22733
22734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22735         if (!ptr_is_owned(_res)) return;
22736         void* _res_ptr = untag_ptr(_res);
22737         CHECK_ACCESS(_res_ptr);
22738         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
22739         FREE(untag_ptr(_res));
22740         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
22741 }
22742
22743 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22744         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22745         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
22746         return tag_ptr(ret_conv, true);
22747 }
22748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22749         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
22750         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22751         return ret_conv;
22752 }
22753
22754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22755         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
22756         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22757         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
22758         return tag_ptr(ret_conv, true);
22759 }
22760
22761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22762         LDKQueryShortChannelIds o_conv;
22763         o_conv.inner = untag_ptr(o);
22764         o_conv.is_owned = ptr_is_owned(o);
22765         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22766         o_conv = QueryShortChannelIds_clone(&o_conv);
22767         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22768         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
22769         return tag_ptr(ret_conv, true);
22770 }
22771
22772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22773         LDKDecodeError e_conv;
22774         e_conv.inner = untag_ptr(e);
22775         e_conv.is_owned = ptr_is_owned(e);
22776         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22777         e_conv = DecodeError_clone(&e_conv);
22778         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22779         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
22780         return tag_ptr(ret_conv, true);
22781 }
22782
22783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22784         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
22785         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
22786         return ret_conv;
22787 }
22788
22789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22790         if (!ptr_is_owned(_res)) return;
22791         void* _res_ptr = untag_ptr(_res);
22792         CHECK_ACCESS(_res_ptr);
22793         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
22794         FREE(untag_ptr(_res));
22795         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
22796 }
22797
22798 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
22799         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22800         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
22801         return tag_ptr(ret_conv, true);
22802 }
22803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22804         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
22805         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
22806         return ret_conv;
22807 }
22808
22809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22810         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
22811         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22812         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
22813         return tag_ptr(ret_conv, true);
22814 }
22815
22816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22817         LDKReplyShortChannelIdsEnd o_conv;
22818         o_conv.inner = untag_ptr(o);
22819         o_conv.is_owned = ptr_is_owned(o);
22820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22821         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
22822         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22823         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
22824         return tag_ptr(ret_conv, true);
22825 }
22826
22827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22828         LDKDecodeError e_conv;
22829         e_conv.inner = untag_ptr(e);
22830         e_conv.is_owned = ptr_is_owned(e);
22831         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22832         e_conv = DecodeError_clone(&e_conv);
22833         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22834         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
22835         return tag_ptr(ret_conv, true);
22836 }
22837
22838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22839         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
22840         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
22841         return ret_conv;
22842 }
22843
22844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22845         if (!ptr_is_owned(_res)) return;
22846         void* _res_ptr = untag_ptr(_res);
22847         CHECK_ACCESS(_res_ptr);
22848         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
22849         FREE(untag_ptr(_res));
22850         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
22851 }
22852
22853 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
22854         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22855         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
22856         return tag_ptr(ret_conv, true);
22857 }
22858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22859         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
22860         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
22861         return ret_conv;
22862 }
22863
22864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22865         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
22866         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22867         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
22868         return tag_ptr(ret_conv, true);
22869 }
22870
22871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22872         LDKQueryChannelRange o_conv;
22873         o_conv.inner = untag_ptr(o);
22874         o_conv.is_owned = ptr_is_owned(o);
22875         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22876         o_conv = QueryChannelRange_clone(&o_conv);
22877         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22878         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
22879         return tag_ptr(ret_conv, true);
22880 }
22881
22882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22883         LDKDecodeError e_conv;
22884         e_conv.inner = untag_ptr(e);
22885         e_conv.is_owned = ptr_is_owned(e);
22886         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22887         e_conv = DecodeError_clone(&e_conv);
22888         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22889         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
22890         return tag_ptr(ret_conv, true);
22891 }
22892
22893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22894         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
22895         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
22896         return ret_conv;
22897 }
22898
22899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22900         if (!ptr_is_owned(_res)) return;
22901         void* _res_ptr = untag_ptr(_res);
22902         CHECK_ACCESS(_res_ptr);
22903         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
22904         FREE(untag_ptr(_res));
22905         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
22906 }
22907
22908 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22909         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22910         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
22911         return tag_ptr(ret_conv, true);
22912 }
22913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22914         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
22915         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22916         return ret_conv;
22917 }
22918
22919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22920         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
22921         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22922         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
22923         return tag_ptr(ret_conv, true);
22924 }
22925
22926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22927         LDKReplyChannelRange o_conv;
22928         o_conv.inner = untag_ptr(o);
22929         o_conv.is_owned = ptr_is_owned(o);
22930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22931         o_conv = ReplyChannelRange_clone(&o_conv);
22932         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22933         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
22934         return tag_ptr(ret_conv, true);
22935 }
22936
22937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22938         LDKDecodeError e_conv;
22939         e_conv.inner = untag_ptr(e);
22940         e_conv.is_owned = ptr_is_owned(e);
22941         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22942         e_conv = DecodeError_clone(&e_conv);
22943         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22944         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
22945         return tag_ptr(ret_conv, true);
22946 }
22947
22948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22949         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
22950         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
22951         return ret_conv;
22952 }
22953
22954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22955         if (!ptr_is_owned(_res)) return;
22956         void* _res_ptr = untag_ptr(_res);
22957         CHECK_ACCESS(_res_ptr);
22958         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
22959         FREE(untag_ptr(_res));
22960         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
22961 }
22962
22963 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22964         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22965         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
22966         return tag_ptr(ret_conv, true);
22967 }
22968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22969         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
22970         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22971         return ret_conv;
22972 }
22973
22974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22975         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
22976         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22977         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
22978         return tag_ptr(ret_conv, true);
22979 }
22980
22981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22982         LDKGossipTimestampFilter o_conv;
22983         o_conv.inner = untag_ptr(o);
22984         o_conv.is_owned = ptr_is_owned(o);
22985         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22986         o_conv = GossipTimestampFilter_clone(&o_conv);
22987         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22988         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
22989         return tag_ptr(ret_conv, true);
22990 }
22991
22992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22993         LDKDecodeError e_conv;
22994         e_conv.inner = untag_ptr(e);
22995         e_conv.is_owned = ptr_is_owned(e);
22996         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22997         e_conv = DecodeError_clone(&e_conv);
22998         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22999         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
23000         return tag_ptr(ret_conv, true);
23001 }
23002
23003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23004         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
23005         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
23006         return ret_conv;
23007 }
23008
23009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23010         if (!ptr_is_owned(_res)) return;
23011         void* _res_ptr = untag_ptr(_res);
23012         CHECK_ACCESS(_res_ptr);
23013         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
23014         FREE(untag_ptr(_res));
23015         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
23016 }
23017
23018 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
23019         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23020         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
23021         return tag_ptr(ret_conv, true);
23022 }
23023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23024         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
23025         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
23026         return ret_conv;
23027 }
23028
23029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23030         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
23031         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23032         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
23033         return tag_ptr(ret_conv, true);
23034 }
23035
23036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23037         LDKCVec_PhantomRouteHintsZ _res_constr;
23038         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23039         if (_res_constr.datalen > 0)
23040                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
23041         else
23042                 _res_constr.data = NULL;
23043         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23044         for (size_t t = 0; t < _res_constr.datalen; t++) {
23045                 int64_t _res_conv_19 = _res_vals[t];
23046                 LDKPhantomRouteHints _res_conv_19_conv;
23047                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23048                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23049                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23050                 _res_constr.data[t] = _res_conv_19_conv;
23051         }
23052         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23053         CVec_PhantomRouteHintsZ_free(_res_constr);
23054 }
23055
23056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23057         LDKInvoice o_conv;
23058         o_conv.inner = untag_ptr(o);
23059         o_conv.is_owned = ptr_is_owned(o);
23060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23061         o_conv = Invoice_clone(&o_conv);
23062         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23063         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
23064         return tag_ptr(ret_conv, true);
23065 }
23066
23067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23068         void* e_ptr = untag_ptr(e);
23069         CHECK_ACCESS(e_ptr);
23070         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
23071         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
23072         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23073         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
23074         return tag_ptr(ret_conv, true);
23075 }
23076
23077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23078         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
23079         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
23080         return ret_conv;
23081 }
23082
23083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23084         if (!ptr_is_owned(_res)) return;
23085         void* _res_ptr = untag_ptr(_res);
23086         CHECK_ACCESS(_res_ptr);
23087         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
23088         FREE(untag_ptr(_res));
23089         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
23090 }
23091
23092 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
23093         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23094         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
23095         return tag_ptr(ret_conv, true);
23096 }
23097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23098         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
23099         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
23100         return ret_conv;
23101 }
23102
23103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23104         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
23105         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23106         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
23107         return tag_ptr(ret_conv, true);
23108 }
23109
23110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23111         void* o_ptr = untag_ptr(o);
23112         CHECK_ACCESS(o_ptr);
23113         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
23114         if (o_conv.free == LDKFilter_JCalls_free) {
23115                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23116                 LDKFilter_JCalls_cloned(&o_conv);
23117         }
23118         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23119         *ret_copy = COption_FilterZ_some(o_conv);
23120         int64_t ret_ref = tag_ptr(ret_copy, true);
23121         return ret_ref;
23122 }
23123
23124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
23125         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23126         *ret_copy = COption_FilterZ_none();
23127         int64_t ret_ref = tag_ptr(ret_copy, true);
23128         return ret_ref;
23129 }
23130
23131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23132         if (!ptr_is_owned(_res)) return;
23133         void* _res_ptr = untag_ptr(_res);
23134         CHECK_ACCESS(_res_ptr);
23135         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
23136         FREE(untag_ptr(_res));
23137         COption_FilterZ_free(_res_conv);
23138 }
23139
23140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23141         LDKLockedChannelMonitor o_conv;
23142         o_conv.inner = untag_ptr(o);
23143         o_conv.is_owned = ptr_is_owned(o);
23144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23145         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
23146         
23147         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23148         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
23149         return tag_ptr(ret_conv, true);
23150 }
23151
23152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
23153         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23154         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
23155         return tag_ptr(ret_conv, true);
23156 }
23157
23158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23159         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
23160         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
23161         return ret_conv;
23162 }
23163
23164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23165         if (!ptr_is_owned(_res)) return;
23166         void* _res_ptr = untag_ptr(_res);
23167         CHECK_ACCESS(_res_ptr);
23168         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
23169         FREE(untag_ptr(_res));
23170         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
23171 }
23172
23173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23174         LDKCVec_OutPointZ _res_constr;
23175         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23176         if (_res_constr.datalen > 0)
23177                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
23178         else
23179                 _res_constr.data = NULL;
23180         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23181         for (size_t k = 0; k < _res_constr.datalen; k++) {
23182                 int64_t _res_conv_10 = _res_vals[k];
23183                 LDKOutPoint _res_conv_10_conv;
23184                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
23185                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
23186                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23187                 _res_constr.data[k] = _res_conv_10_conv;
23188         }
23189         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23190         CVec_OutPointZ_free(_res_constr);
23191 }
23192
23193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23194         if (!ptr_is_owned(this_ptr)) return;
23195         void* this_ptr_ptr = untag_ptr(this_ptr);
23196         CHECK_ACCESS(this_ptr_ptr);
23197         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
23198         FREE(untag_ptr(this_ptr));
23199         PaymentPurpose_free(this_ptr_conv);
23200 }
23201
23202 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
23203         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23204         *ret_copy = PaymentPurpose_clone(arg);
23205         int64_t ret_ref = tag_ptr(ret_copy, true);
23206         return ret_ref;
23207 }
23208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23209         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
23210         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
23211         return ret_conv;
23212 }
23213
23214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23215         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
23216         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23217         *ret_copy = PaymentPurpose_clone(orig_conv);
23218         int64_t ret_ref = tag_ptr(ret_copy, true);
23219         return ret_ref;
23220 }
23221
23222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
23223         LDKThirtyTwoBytes payment_preimage_ref;
23224         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23225         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23226         LDKThirtyTwoBytes payment_secret_ref;
23227         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
23228         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
23229         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23230         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
23231         int64_t ret_ref = tag_ptr(ret_copy, true);
23232         return ret_ref;
23233 }
23234
23235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
23236         LDKThirtyTwoBytes a_ref;
23237         CHECK((*env)->GetArrayLength(env, a) == 32);
23238         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23239         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23240         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
23241         int64_t ret_ref = tag_ptr(ret_copy, true);
23242         return ret_ref;
23243 }
23244
23245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
23246         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
23247         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
23248         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23249         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23250         CVec_u8Z_free(ret_var);
23251         return ret_arr;
23252 }
23253
23254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23255         LDKu8slice ser_ref;
23256         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23257         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23258         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
23259         *ret_conv = PaymentPurpose_read(ser_ref);
23260         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23261         return tag_ptr(ret_conv, true);
23262 }
23263
23264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23265         if (!ptr_is_owned(this_ptr)) return;
23266         void* this_ptr_ptr = untag_ptr(this_ptr);
23267         CHECK_ACCESS(this_ptr_ptr);
23268         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
23269         FREE(untag_ptr(this_ptr));
23270         ClosureReason_free(this_ptr_conv);
23271 }
23272
23273 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
23274         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23275         *ret_copy = ClosureReason_clone(arg);
23276         int64_t ret_ref = tag_ptr(ret_copy, true);
23277         return ret_ref;
23278 }
23279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23280         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
23281         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
23282         return ret_conv;
23283 }
23284
23285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23286         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
23287         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23288         *ret_copy = ClosureReason_clone(orig_conv);
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_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
23294         LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
23295         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23296         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
23297         int64_t ret_ref = tag_ptr(ret_copy, true);
23298         return ret_ref;
23299 }
23300
23301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
23302         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23303         *ret_copy = ClosureReason_holder_force_closed();
23304         int64_t ret_ref = tag_ptr(ret_copy, true);
23305         return ret_ref;
23306 }
23307
23308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
23309         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23310         *ret_copy = ClosureReason_cooperative_closure();
23311         int64_t ret_ref = tag_ptr(ret_copy, true);
23312         return ret_ref;
23313 }
23314
23315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
23316         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23317         *ret_copy = ClosureReason_commitment_tx_confirmed();
23318         int64_t ret_ref = tag_ptr(ret_copy, true);
23319         return ret_ref;
23320 }
23321
23322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
23323         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23324         *ret_copy = ClosureReason_funding_timed_out();
23325         int64_t ret_ref = tag_ptr(ret_copy, true);
23326         return ret_ref;
23327 }
23328
23329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
23330         LDKStr err_conv = java_to_owned_str(env, err);
23331         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23332         *ret_copy = ClosureReason_processing_error(err_conv);
23333         int64_t ret_ref = tag_ptr(ret_copy, true);
23334         return ret_ref;
23335 }
23336
23337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
23338         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23339         *ret_copy = ClosureReason_disconnected_peer();
23340         int64_t ret_ref = tag_ptr(ret_copy, true);
23341         return ret_ref;
23342 }
23343
23344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
23345         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23346         *ret_copy = ClosureReason_outdated_channel_manager();
23347         int64_t ret_ref = tag_ptr(ret_copy, true);
23348         return ret_ref;
23349 }
23350
23351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
23352         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
23353         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
23354         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23355         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23356         CVec_u8Z_free(ret_var);
23357         return ret_arr;
23358 }
23359
23360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23361         LDKu8slice ser_ref;
23362         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23363         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23364         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
23365         *ret_conv = ClosureReason_read(ser_ref);
23366         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23367         return tag_ptr(ret_conv, true);
23368 }
23369
23370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23371         if (!ptr_is_owned(this_ptr)) return;
23372         void* this_ptr_ptr = untag_ptr(this_ptr);
23373         CHECK_ACCESS(this_ptr_ptr);
23374         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
23375         FREE(untag_ptr(this_ptr));
23376         HTLCDestination_free(this_ptr_conv);
23377 }
23378
23379 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
23380         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23381         *ret_copy = HTLCDestination_clone(arg);
23382         int64_t ret_ref = tag_ptr(ret_copy, true);
23383         return ret_ref;
23384 }
23385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23386         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
23387         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
23388         return ret_conv;
23389 }
23390
23391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23392         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
23393         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23394         *ret_copy = HTLCDestination_clone(orig_conv);
23395         int64_t ret_ref = tag_ptr(ret_copy, true);
23396         return ret_ref;
23397 }
23398
23399 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) {
23400         LDKPublicKey node_id_ref;
23401         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23402         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23403         LDKThirtyTwoBytes channel_id_ref;
23404         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23405         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23406         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23407         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
23408         int64_t ret_ref = tag_ptr(ret_copy, true);
23409         return ret_ref;
23410 }
23411
23412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
23413         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23414         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
23415         int64_t ret_ref = tag_ptr(ret_copy, true);
23416         return ret_ref;
23417 }
23418
23419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
23420         LDKThirtyTwoBytes payment_hash_ref;
23421         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23422         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23423         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
23424         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
23425         int64_t ret_ref = tag_ptr(ret_copy, true);
23426         return ret_ref;
23427 }
23428
23429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
23430         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
23431         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
23432         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23433         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23434         CVec_u8Z_free(ret_var);
23435         return ret_arr;
23436 }
23437
23438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23439         LDKu8slice ser_ref;
23440         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23441         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23442         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
23443         *ret_conv = HTLCDestination_read(ser_ref);
23444         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23445         return tag_ptr(ret_conv, true);
23446 }
23447
23448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23449         if (!ptr_is_owned(this_ptr)) return;
23450         void* this_ptr_ptr = untag_ptr(this_ptr);
23451         CHECK_ACCESS(this_ptr_ptr);
23452         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
23453         FREE(untag_ptr(this_ptr));
23454         Event_free(this_ptr_conv);
23455 }
23456
23457 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
23458         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23459         *ret_copy = Event_clone(arg);
23460         int64_t ret_ref = tag_ptr(ret_copy, true);
23461         return ret_ref;
23462 }
23463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23464         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
23465         int64_t ret_conv = Event_clone_ptr(arg_conv);
23466         return ret_conv;
23467 }
23468
23469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23470         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
23471         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23472         *ret_copy = Event_clone(orig_conv);
23473         int64_t ret_ref = tag_ptr(ret_copy, true);
23474         return ret_ref;
23475 }
23476
23477 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) {
23478         LDKThirtyTwoBytes temporary_channel_id_ref;
23479         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23480         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23481         LDKPublicKey counterparty_node_id_ref;
23482         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23483         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23484         LDKCVec_u8Z output_script_ref;
23485         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
23486         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
23487         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
23488         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23489         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
23490         int64_t ret_ref = tag_ptr(ret_copy, true);
23491         return ret_ref;
23492 }
23493
23494 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) {
23495         LDKThirtyTwoBytes payment_hash_ref;
23496         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23497         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23498         void* purpose_ptr = untag_ptr(purpose);
23499         CHECK_ACCESS(purpose_ptr);
23500         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23501         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
23502         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23503         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
23504         int64_t ret_ref = tag_ptr(ret_copy, true);
23505         return ret_ref;
23506 }
23507
23508 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) {
23509         LDKThirtyTwoBytes payment_hash_ref;
23510         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23511         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23512         void* purpose_ptr = untag_ptr(purpose);
23513         CHECK_ACCESS(purpose_ptr);
23514         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23515         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
23516         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23517         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
23518         int64_t ret_ref = tag_ptr(ret_copy, true);
23519         return ret_ref;
23520 }
23521
23522 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) {
23523         LDKThirtyTwoBytes payment_id_ref;
23524         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23525         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23526         LDKThirtyTwoBytes payment_preimage_ref;
23527         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23528         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23529         LDKThirtyTwoBytes payment_hash_ref;
23530         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23531         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23532         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
23533         CHECK_ACCESS(fee_paid_msat_ptr);
23534         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
23535         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
23536         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23537         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
23538         int64_t ret_ref = tag_ptr(ret_copy, true);
23539         return ret_ref;
23540 }
23541
23542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
23543         LDKThirtyTwoBytes payment_id_ref;
23544         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23545         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23546         LDKThirtyTwoBytes payment_hash_ref;
23547         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23548         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23549         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23550         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
23551         int64_t ret_ref = tag_ptr(ret_copy, true);
23552         return ret_ref;
23553 }
23554
23555 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) {
23556         LDKThirtyTwoBytes payment_id_ref;
23557         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23558         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23559         LDKThirtyTwoBytes payment_hash_ref;
23560         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23561         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23562         LDKCVec_RouteHopZ path_constr;
23563         path_constr.datalen = (*env)->GetArrayLength(env, path);
23564         if (path_constr.datalen > 0)
23565                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23566         else
23567                 path_constr.data = NULL;
23568         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23569         for (size_t k = 0; k < path_constr.datalen; k++) {
23570                 int64_t path_conv_10 = path_vals[k];
23571                 LDKRouteHop path_conv_10_conv;
23572                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23573                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23574                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23575                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23576                 path_constr.data[k] = path_conv_10_conv;
23577         }
23578         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23579         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23580         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
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_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) {
23586         LDKThirtyTwoBytes payment_id_ref;
23587         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23588         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23589         LDKThirtyTwoBytes payment_hash_ref;
23590         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23591         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23592         void* network_update_ptr = untag_ptr(network_update);
23593         CHECK_ACCESS(network_update_ptr);
23594         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
23595         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
23596         LDKCVec_RouteHopZ path_constr;
23597         path_constr.datalen = (*env)->GetArrayLength(env, path);
23598         if (path_constr.datalen > 0)
23599                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23600         else
23601                 path_constr.data = NULL;
23602         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23603         for (size_t k = 0; k < path_constr.datalen; k++) {
23604                 int64_t path_conv_10 = path_vals[k];
23605                 LDKRouteHop path_conv_10_conv;
23606                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23607                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23608                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23609                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23610                 path_constr.data[k] = path_conv_10_conv;
23611         }
23612         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23613         void* short_channel_id_ptr = untag_ptr(short_channel_id);
23614         CHECK_ACCESS(short_channel_id_ptr);
23615         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23616         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
23617         LDKRouteParameters retry_conv;
23618         retry_conv.inner = untag_ptr(retry);
23619         retry_conv.is_owned = ptr_is_owned(retry);
23620         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
23621         retry_conv = RouteParameters_clone(&retry_conv);
23622         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23623         *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);
23624         int64_t ret_ref = tag_ptr(ret_copy, true);
23625         return ret_ref;
23626 }
23627
23628 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) {
23629         LDKThirtyTwoBytes payment_id_ref;
23630         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23631         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23632         LDKThirtyTwoBytes payment_hash_ref;
23633         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23634         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23635         LDKCVec_RouteHopZ path_constr;
23636         path_constr.datalen = (*env)->GetArrayLength(env, path);
23637         if (path_constr.datalen > 0)
23638                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23639         else
23640                 path_constr.data = NULL;
23641         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23642         for (size_t k = 0; k < path_constr.datalen; k++) {
23643                 int64_t path_conv_10 = path_vals[k];
23644                 LDKRouteHop path_conv_10_conv;
23645                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23646                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23647                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23648                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23649                 path_constr.data[k] = path_conv_10_conv;
23650         }
23651         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23652         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23653         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
23654         int64_t ret_ref = tag_ptr(ret_copy, true);
23655         return ret_ref;
23656 }
23657
23658 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) {
23659         LDKThirtyTwoBytes payment_id_ref;
23660         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23661         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23662         LDKThirtyTwoBytes payment_hash_ref;
23663         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23664         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23665         LDKCVec_RouteHopZ path_constr;
23666         path_constr.datalen = (*env)->GetArrayLength(env, path);
23667         if (path_constr.datalen > 0)
23668                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23669         else
23670                 path_constr.data = NULL;
23671         int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23672         for (size_t k = 0; k < path_constr.datalen; k++) {
23673                 int64_t path_conv_10 = path_vals[k];
23674                 LDKRouteHop path_conv_10_conv;
23675                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
23676                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
23677                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23678                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23679                 path_constr.data[k] = path_conv_10_conv;
23680         }
23681         (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23682         void* short_channel_id_ptr = untag_ptr(short_channel_id);
23683         CHECK_ACCESS(short_channel_id_ptr);
23684         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23685         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
23686         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23687         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_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_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
23693         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23694         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
23695         int64_t ret_ref = tag_ptr(ret_copy, true);
23696         return ret_ref;
23697 }
23698
23699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
23700         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
23701         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
23702         if (outputs_constr.datalen > 0)
23703                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23704         else
23705                 outputs_constr.data = NULL;
23706         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
23707         for (size_t b = 0; b < outputs_constr.datalen; b++) {
23708                 int64_t outputs_conv_27 = outputs_vals[b];
23709                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
23710                 CHECK_ACCESS(outputs_conv_27_ptr);
23711                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
23712                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
23713                 outputs_constr.data[b] = outputs_conv_27_conv;
23714         }
23715         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
23716         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23717         *ret_copy = Event_spendable_outputs(outputs_constr);
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_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) {
23723         LDKThirtyTwoBytes prev_channel_id_ref;
23724         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
23725         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
23726         LDKThirtyTwoBytes next_channel_id_ref;
23727         CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
23728         (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
23729         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
23730         CHECK_ACCESS(fee_earned_msat_ptr);
23731         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
23732         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
23733         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23734         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
23735         int64_t ret_ref = tag_ptr(ret_copy, true);
23736         return ret_ref;
23737 }
23738
23739 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) {
23740         LDKThirtyTwoBytes channel_id_ref;
23741         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23742         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23743         void* reason_ptr = untag_ptr(reason);
23744         CHECK_ACCESS(reason_ptr);
23745         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
23746         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
23747         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23748         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
23749         int64_t ret_ref = tag_ptr(ret_copy, true);
23750         return ret_ref;
23751 }
23752
23753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
23754         LDKThirtyTwoBytes channel_id_ref;
23755         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23756         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23757         LDKTransaction transaction_ref;
23758         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
23759         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
23760         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
23761         transaction_ref.data_is_owned = true;
23762         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23763         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
23764         int64_t ret_ref = tag_ptr(ret_copy, true);
23765         return ret_ref;
23766 }
23767
23768 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) {
23769         LDKThirtyTwoBytes temporary_channel_id_ref;
23770         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23771         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23772         LDKPublicKey counterparty_node_id_ref;
23773         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23774         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23775         LDKChannelTypeFeatures channel_type_conv;
23776         channel_type_conv.inner = untag_ptr(channel_type);
23777         channel_type_conv.is_owned = ptr_is_owned(channel_type);
23778         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
23779         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
23780         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23781         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
23782         int64_t ret_ref = tag_ptr(ret_copy, true);
23783         return ret_ref;
23784 }
23785
23786 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) {
23787         LDKThirtyTwoBytes prev_channel_id_ref;
23788         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
23789         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
23790         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
23791         CHECK_ACCESS(failed_next_destination_ptr);
23792         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
23793         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
23794         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23795         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
23796         int64_t ret_ref = tag_ptr(ret_copy, true);
23797         return ret_ref;
23798 }
23799
23800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
23801         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
23802         LDKCVec_u8Z ret_var = Event_write(obj_conv);
23803         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23804         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23805         CVec_u8Z_free(ret_var);
23806         return ret_arr;
23807 }
23808
23809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23810         LDKu8slice ser_ref;
23811         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23812         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23813         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
23814         *ret_conv = Event_read(ser_ref);
23815         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23816         return tag_ptr(ret_conv, true);
23817 }
23818
23819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23820         if (!ptr_is_owned(this_ptr)) return;
23821         void* this_ptr_ptr = untag_ptr(this_ptr);
23822         CHECK_ACCESS(this_ptr_ptr);
23823         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
23824         FREE(untag_ptr(this_ptr));
23825         MessageSendEvent_free(this_ptr_conv);
23826 }
23827
23828 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
23829         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23830         *ret_copy = MessageSendEvent_clone(arg);
23831         int64_t ret_ref = tag_ptr(ret_copy, true);
23832         return ret_ref;
23833 }
23834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23835         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
23836         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
23837         return ret_conv;
23838 }
23839
23840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23841         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
23842         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23843         *ret_copy = MessageSendEvent_clone(orig_conv);
23844         int64_t ret_ref = tag_ptr(ret_copy, true);
23845         return ret_ref;
23846 }
23847
23848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23849         LDKPublicKey node_id_ref;
23850         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23851         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23852         LDKAcceptChannel msg_conv;
23853         msg_conv.inner = untag_ptr(msg);
23854         msg_conv.is_owned = ptr_is_owned(msg);
23855         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23856         msg_conv = AcceptChannel_clone(&msg_conv);
23857         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23858         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
23859         int64_t ret_ref = tag_ptr(ret_copy, true);
23860         return ret_ref;
23861 }
23862
23863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23864         LDKPublicKey node_id_ref;
23865         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23866         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23867         LDKOpenChannel msg_conv;
23868         msg_conv.inner = untag_ptr(msg);
23869         msg_conv.is_owned = ptr_is_owned(msg);
23870         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23871         msg_conv = OpenChannel_clone(&msg_conv);
23872         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23873         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
23874         int64_t ret_ref = tag_ptr(ret_copy, true);
23875         return ret_ref;
23876 }
23877
23878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23879         LDKPublicKey node_id_ref;
23880         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23881         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23882         LDKFundingCreated msg_conv;
23883         msg_conv.inner = untag_ptr(msg);
23884         msg_conv.is_owned = ptr_is_owned(msg);
23885         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23886         msg_conv = FundingCreated_clone(&msg_conv);
23887         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23888         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
23889         int64_t ret_ref = tag_ptr(ret_copy, true);
23890         return ret_ref;
23891 }
23892
23893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23894         LDKPublicKey node_id_ref;
23895         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23896         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23897         LDKFundingSigned msg_conv;
23898         msg_conv.inner = untag_ptr(msg);
23899         msg_conv.is_owned = ptr_is_owned(msg);
23900         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23901         msg_conv = FundingSigned_clone(&msg_conv);
23902         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23903         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
23904         int64_t ret_ref = tag_ptr(ret_copy, true);
23905         return ret_ref;
23906 }
23907
23908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23909         LDKPublicKey node_id_ref;
23910         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23911         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23912         LDKChannelReady msg_conv;
23913         msg_conv.inner = untag_ptr(msg);
23914         msg_conv.is_owned = ptr_is_owned(msg);
23915         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23916         msg_conv = ChannelReady_clone(&msg_conv);
23917         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23918         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
23919         int64_t ret_ref = tag_ptr(ret_copy, true);
23920         return ret_ref;
23921 }
23922
23923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23924         LDKPublicKey node_id_ref;
23925         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23926         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23927         LDKAnnouncementSignatures msg_conv;
23928         msg_conv.inner = untag_ptr(msg);
23929         msg_conv.is_owned = ptr_is_owned(msg);
23930         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23931         msg_conv = AnnouncementSignatures_clone(&msg_conv);
23932         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23933         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
23934         int64_t ret_ref = tag_ptr(ret_copy, true);
23935         return ret_ref;
23936 }
23937
23938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
23939         LDKPublicKey node_id_ref;
23940         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23941         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23942         LDKCommitmentUpdate updates_conv;
23943         updates_conv.inner = untag_ptr(updates);
23944         updates_conv.is_owned = ptr_is_owned(updates);
23945         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23946         updates_conv = CommitmentUpdate_clone(&updates_conv);
23947         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23948         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
23949         int64_t ret_ref = tag_ptr(ret_copy, true);
23950         return ret_ref;
23951 }
23952
23953 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) {
23954         LDKPublicKey node_id_ref;
23955         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23956         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23957         LDKRevokeAndACK msg_conv;
23958         msg_conv.inner = untag_ptr(msg);
23959         msg_conv.is_owned = ptr_is_owned(msg);
23960         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23961         msg_conv = RevokeAndACK_clone(&msg_conv);
23962         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23963         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
23964         int64_t ret_ref = tag_ptr(ret_copy, true);
23965         return ret_ref;
23966 }
23967
23968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23969         LDKPublicKey node_id_ref;
23970         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23971         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23972         LDKClosingSigned msg_conv;
23973         msg_conv.inner = untag_ptr(msg);
23974         msg_conv.is_owned = ptr_is_owned(msg);
23975         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23976         msg_conv = ClosingSigned_clone(&msg_conv);
23977         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23978         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
23979         int64_t ret_ref = tag_ptr(ret_copy, true);
23980         return ret_ref;
23981 }
23982
23983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23984         LDKPublicKey node_id_ref;
23985         CHECK((*env)->GetArrayLength(env, node_id) == 33);
23986         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23987         LDKShutdown msg_conv;
23988         msg_conv.inner = untag_ptr(msg);
23989         msg_conv.is_owned = ptr_is_owned(msg);
23990         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23991         msg_conv = Shutdown_clone(&msg_conv);
23992         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23993         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_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_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23999         LDKPublicKey node_id_ref;
24000         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24001         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24002         LDKChannelReestablish msg_conv;
24003         msg_conv.inner = untag_ptr(msg);
24004         msg_conv.is_owned = ptr_is_owned(msg);
24005         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24006         msg_conv = ChannelReestablish_clone(&msg_conv);
24007         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24008         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
24009         int64_t ret_ref = tag_ptr(ret_copy, true);
24010         return ret_ref;
24011 }
24012
24013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
24014         LDKChannelAnnouncement msg_conv;
24015         msg_conv.inner = untag_ptr(msg);
24016         msg_conv.is_owned = ptr_is_owned(msg);
24017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24018         msg_conv = ChannelAnnouncement_clone(&msg_conv);
24019         LDKChannelUpdate update_msg_conv;
24020         update_msg_conv.inner = untag_ptr(update_msg);
24021         update_msg_conv.is_owned = ptr_is_owned(update_msg);
24022         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
24023         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
24024         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24025         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_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_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
24031         LDKNodeAnnouncement msg_conv;
24032         msg_conv.inner = untag_ptr(msg);
24033         msg_conv.is_owned = ptr_is_owned(msg);
24034         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24035         msg_conv = NodeAnnouncement_clone(&msg_conv);
24036         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24037         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
24038         int64_t ret_ref = tag_ptr(ret_copy, true);
24039         return ret_ref;
24040 }
24041
24042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
24043         LDKChannelUpdate msg_conv;
24044         msg_conv.inner = untag_ptr(msg);
24045         msg_conv.is_owned = ptr_is_owned(msg);
24046         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24047         msg_conv = ChannelUpdate_clone(&msg_conv);
24048         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24049         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
24050         int64_t ret_ref = tag_ptr(ret_copy, true);
24051         return ret_ref;
24052 }
24053
24054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
24055         LDKPublicKey node_id_ref;
24056         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24057         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24058         LDKChannelUpdate msg_conv;
24059         msg_conv.inner = untag_ptr(msg);
24060         msg_conv.is_owned = ptr_is_owned(msg);
24061         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24062         msg_conv = ChannelUpdate_clone(&msg_conv);
24063         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24064         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
24065         int64_t ret_ref = tag_ptr(ret_copy, true);
24066         return ret_ref;
24067 }
24068
24069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
24070         LDKPublicKey node_id_ref;
24071         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24072         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24073         void* action_ptr = untag_ptr(action);
24074         CHECK_ACCESS(action_ptr);
24075         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
24076         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
24077         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24078         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
24079         int64_t ret_ref = tag_ptr(ret_copy, true);
24080         return ret_ref;
24081 }
24082
24083 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) {
24084         LDKPublicKey node_id_ref;
24085         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24086         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24087         LDKQueryChannelRange msg_conv;
24088         msg_conv.inner = untag_ptr(msg);
24089         msg_conv.is_owned = ptr_is_owned(msg);
24090         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24091         msg_conv = QueryChannelRange_clone(&msg_conv);
24092         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24093         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
24094         int64_t ret_ref = tag_ptr(ret_copy, true);
24095         return ret_ref;
24096 }
24097
24098 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) {
24099         LDKPublicKey node_id_ref;
24100         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24101         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24102         LDKQueryShortChannelIds msg_conv;
24103         msg_conv.inner = untag_ptr(msg);
24104         msg_conv.is_owned = ptr_is_owned(msg);
24105         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24106         msg_conv = QueryShortChannelIds_clone(&msg_conv);
24107         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24108         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
24109         int64_t ret_ref = tag_ptr(ret_copy, true);
24110         return ret_ref;
24111 }
24112
24113 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) {
24114         LDKPublicKey node_id_ref;
24115         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24116         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24117         LDKReplyChannelRange msg_conv;
24118         msg_conv.inner = untag_ptr(msg);
24119         msg_conv.is_owned = ptr_is_owned(msg);
24120         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24121         msg_conv = ReplyChannelRange_clone(&msg_conv);
24122         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24123         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
24124         int64_t ret_ref = tag_ptr(ret_copy, true);
24125         return ret_ref;
24126 }
24127
24128 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) {
24129         LDKPublicKey node_id_ref;
24130         CHECK((*env)->GetArrayLength(env, node_id) == 33);
24131         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24132         LDKGossipTimestampFilter msg_conv;
24133         msg_conv.inner = untag_ptr(msg);
24134         msg_conv.is_owned = ptr_is_owned(msg);
24135         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
24136         msg_conv = GossipTimestampFilter_clone(&msg_conv);
24137         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
24138         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
24139         int64_t ret_ref = tag_ptr(ret_copy, true);
24140         return ret_ref;
24141 }
24142
24143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24144         if (!ptr_is_owned(this_ptr)) return;
24145         void* this_ptr_ptr = untag_ptr(this_ptr);
24146         CHECK_ACCESS(this_ptr_ptr);
24147         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
24148         FREE(untag_ptr(this_ptr));
24149         MessageSendEventsProvider_free(this_ptr_conv);
24150 }
24151
24152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24153         if (!ptr_is_owned(this_ptr)) return;
24154         void* this_ptr_ptr = untag_ptr(this_ptr);
24155         CHECK_ACCESS(this_ptr_ptr);
24156         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
24157         FREE(untag_ptr(this_ptr));
24158         EventsProvider_free(this_ptr_conv);
24159 }
24160
24161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24162         if (!ptr_is_owned(this_ptr)) return;
24163         void* this_ptr_ptr = untag_ptr(this_ptr);
24164         CHECK_ACCESS(this_ptr_ptr);
24165         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
24166         FREE(untag_ptr(this_ptr));
24167         EventHandler_free(this_ptr_conv);
24168 }
24169
24170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24171         if (!ptr_is_owned(this_ptr)) return;
24172         void* this_ptr_ptr = untag_ptr(this_ptr);
24173         CHECK_ACCESS(this_ptr_ptr);
24174         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
24175         FREE(untag_ptr(this_ptr));
24176         APIError_free(this_ptr_conv);
24177 }
24178
24179 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
24180         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24181         *ret_copy = APIError_clone(arg);
24182         int64_t ret_ref = tag_ptr(ret_copy, true);
24183         return ret_ref;
24184 }
24185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24186         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
24187         int64_t ret_conv = APIError_clone_ptr(arg_conv);
24188         return ret_conv;
24189 }
24190
24191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24192         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
24193         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24194         *ret_copy = APIError_clone(orig_conv);
24195         int64_t ret_ref = tag_ptr(ret_copy, true);
24196         return ret_ref;
24197 }
24198
24199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
24200         LDKStr err_conv = java_to_owned_str(env, err);
24201         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24202         *ret_copy = APIError_apimisuse_error(err_conv);
24203         int64_t ret_ref = tag_ptr(ret_copy, true);
24204         return ret_ref;
24205 }
24206
24207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
24208         LDKStr err_conv = java_to_owned_str(env, err);
24209         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24210         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
24211         int64_t ret_ref = tag_ptr(ret_copy, true);
24212         return ret_ref;
24213 }
24214
24215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
24216         LDKStr err_conv = java_to_owned_str(env, err);
24217         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24218         *ret_copy = APIError_route_error(err_conv);
24219         int64_t ret_ref = tag_ptr(ret_copy, true);
24220         return ret_ref;
24221 }
24222
24223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
24224         LDKStr err_conv = java_to_owned_str(env, err);
24225         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24226         *ret_copy = APIError_channel_unavailable(err_conv);
24227         int64_t ret_ref = tag_ptr(ret_copy, true);
24228         return ret_ref;
24229 }
24230
24231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
24232         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24233         *ret_copy = APIError_monitor_update_failed();
24234         int64_t ret_ref = tag_ptr(ret_copy, true);
24235         return ret_ref;
24236 }
24237
24238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
24239         LDKShutdownScript script_conv;
24240         script_conv.inner = untag_ptr(script);
24241         script_conv.is_owned = ptr_is_owned(script);
24242         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
24243         script_conv = ShutdownScript_clone(&script_conv);
24244         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
24245         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
24246         int64_t ret_ref = tag_ptr(ret_copy, true);
24247         return ret_ref;
24248 }
24249
24250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24251         LDKBigSize this_obj_conv;
24252         this_obj_conv.inner = untag_ptr(this_obj);
24253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24255         BigSize_free(this_obj_conv);
24256 }
24257
24258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
24259         LDKBigSize this_ptr_conv;
24260         this_ptr_conv.inner = untag_ptr(this_ptr);
24261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24263         this_ptr_conv.is_owned = false;
24264         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
24265         return ret_conv;
24266 }
24267
24268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24269         LDKBigSize this_ptr_conv;
24270         this_ptr_conv.inner = untag_ptr(this_ptr);
24271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24273         this_ptr_conv.is_owned = false;
24274         BigSize_set_a(&this_ptr_conv, val);
24275 }
24276
24277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
24278         LDKBigSize ret_var = BigSize_new(a_arg);
24279         int64_t ret_ref = 0;
24280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24282         return ret_ref;
24283 }
24284
24285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24286         LDKHostname this_obj_conv;
24287         this_obj_conv.inner = untag_ptr(this_obj);
24288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24290         Hostname_free(this_obj_conv);
24291 }
24292
24293 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
24294         LDKHostname ret_var = Hostname_clone(arg);
24295         int64_t ret_ref = 0;
24296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24298         return ret_ref;
24299 }
24300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24301         LDKHostname arg_conv;
24302         arg_conv.inner = untag_ptr(arg);
24303         arg_conv.is_owned = ptr_is_owned(arg);
24304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24305         arg_conv.is_owned = false;
24306         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
24307         return ret_conv;
24308 }
24309
24310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24311         LDKHostname orig_conv;
24312         orig_conv.inner = untag_ptr(orig);
24313         orig_conv.is_owned = ptr_is_owned(orig);
24314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24315         orig_conv.is_owned = false;
24316         LDKHostname ret_var = Hostname_clone(&orig_conv);
24317         int64_t ret_ref = 0;
24318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24320         return ret_ref;
24321 }
24322
24323 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
24324         LDKHostname this_arg_conv;
24325         this_arg_conv.inner = untag_ptr(this_arg);
24326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24328         this_arg_conv.is_owned = false;
24329         int8_t ret_conv = Hostname_len(&this_arg_conv);
24330         return ret_conv;
24331 }
24332
24333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
24334         LDKu8slice msg_ref;
24335         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24336         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24337         unsigned char sk_arr[32];
24338         CHECK((*env)->GetArrayLength(env, sk) == 32);
24339         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
24340         unsigned char (*sk_ref)[32] = &sk_arr;
24341         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
24342         *ret_conv = sign(msg_ref, sk_ref);
24343         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24344         return tag_ptr(ret_conv, true);
24345 }
24346
24347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
24348         LDKu8slice msg_ref;
24349         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24350         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24351         LDKStr sig_conv = java_to_owned_str(env, sig);
24352         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24353         *ret_conv = recover_pk(msg_ref, sig_conv);
24354         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24355         return tag_ptr(ret_conv, true);
24356 }
24357
24358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
24359         LDKu8slice msg_ref;
24360         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
24361         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
24362         LDKStr sig_conv = java_to_owned_str(env, sig);
24363         LDKPublicKey pk_ref;
24364         CHECK((*env)->GetArrayLength(env, pk) == 33);
24365         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
24366         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
24367         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24368         return ret_conv;
24369 }
24370
24371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
24372         LDKu8slice hrp_bytes_ref;
24373         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
24374         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
24375         LDKCVec_u5Z data_without_signature_constr;
24376         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
24377         if (data_without_signature_constr.datalen > 0)
24378                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
24379         else
24380                 data_without_signature_constr.data = NULL;
24381         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
24382         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
24383                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
24384                 
24385                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
24386         }
24387         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
24388         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
24389         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24390         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24391         CVec_u8Z_free(ret_var);
24392         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
24393         return ret_arr;
24394 }
24395
24396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24397         if (!ptr_is_owned(this_ptr)) return;
24398         void* this_ptr_ptr = untag_ptr(this_ptr);
24399         CHECK_ACCESS(this_ptr_ptr);
24400         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
24401         FREE(untag_ptr(this_ptr));
24402         Persister_free(this_ptr_conv);
24403 }
24404
24405 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24406         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
24407         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
24408         return ret_conv;
24409 }
24410
24411 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
24412         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
24413         return ret_conv;
24414 }
24415
24416 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
24417         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
24418         return ret_conv;
24419 }
24420
24421 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
24422         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
24423         return ret_conv;
24424 }
24425
24426 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
24427         jclass ret_conv = LDKLevel_to_java(env, Level_info());
24428         return ret_conv;
24429 }
24430
24431 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
24432         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
24433         return ret_conv;
24434 }
24435
24436 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
24437         jclass ret_conv = LDKLevel_to_java(env, Level_error());
24438         return ret_conv;
24439 }
24440
24441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24442         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
24443         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
24444         jboolean ret_conv = Level_eq(a_conv, b_conv);
24445         return ret_conv;
24446 }
24447
24448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
24449         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
24450         int64_t ret_conv = Level_hash(o_conv);
24451         return ret_conv;
24452 }
24453
24454 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
24455         jclass ret_conv = LDKLevel_to_java(env, Level_max());
24456         return ret_conv;
24457 }
24458
24459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24460         LDKRecord this_obj_conv;
24461         this_obj_conv.inner = untag_ptr(this_obj);
24462         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24464         Record_free(this_obj_conv);
24465 }
24466
24467 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
24468         LDKRecord this_ptr_conv;
24469         this_ptr_conv.inner = untag_ptr(this_ptr);
24470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24472         this_ptr_conv.is_owned = false;
24473         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
24474         return ret_conv;
24475 }
24476
24477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24478         LDKRecord this_ptr_conv;
24479         this_ptr_conv.inner = untag_ptr(this_ptr);
24480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24482         this_ptr_conv.is_owned = false;
24483         LDKLevel val_conv = LDKLevel_from_java(env, val);
24484         Record_set_level(&this_ptr_conv, val_conv);
24485 }
24486
24487 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
24488         LDKRecord this_ptr_conv;
24489         this_ptr_conv.inner = untag_ptr(this_ptr);
24490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24492         this_ptr_conv.is_owned = false;
24493         LDKStr ret_str = Record_get_args(&this_ptr_conv);
24494         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24495         Str_free(ret_str);
24496         return ret_conv;
24497 }
24498
24499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24500         LDKRecord this_ptr_conv;
24501         this_ptr_conv.inner = untag_ptr(this_ptr);
24502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24504         this_ptr_conv.is_owned = false;
24505         LDKStr val_conv = java_to_owned_str(env, val);
24506         Record_set_args(&this_ptr_conv, val_conv);
24507 }
24508
24509 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
24510         LDKRecord this_ptr_conv;
24511         this_ptr_conv.inner = untag_ptr(this_ptr);
24512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24514         this_ptr_conv.is_owned = false;
24515         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
24516         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24517         Str_free(ret_str);
24518         return ret_conv;
24519 }
24520
24521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24522         LDKRecord this_ptr_conv;
24523         this_ptr_conv.inner = untag_ptr(this_ptr);
24524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24526         this_ptr_conv.is_owned = false;
24527         LDKStr val_conv = java_to_owned_str(env, val);
24528         Record_set_module_path(&this_ptr_conv, val_conv);
24529 }
24530
24531 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
24532         LDKRecord this_ptr_conv;
24533         this_ptr_conv.inner = untag_ptr(this_ptr);
24534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24536         this_ptr_conv.is_owned = false;
24537         LDKStr ret_str = Record_get_file(&this_ptr_conv);
24538         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24539         Str_free(ret_str);
24540         return ret_conv;
24541 }
24542
24543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24544         LDKRecord this_ptr_conv;
24545         this_ptr_conv.inner = untag_ptr(this_ptr);
24546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24548         this_ptr_conv.is_owned = false;
24549         LDKStr val_conv = java_to_owned_str(env, val);
24550         Record_set_file(&this_ptr_conv, val_conv);
24551 }
24552
24553 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
24554         LDKRecord this_ptr_conv;
24555         this_ptr_conv.inner = untag_ptr(this_ptr);
24556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24558         this_ptr_conv.is_owned = false;
24559         int32_t ret_conv = Record_get_line(&this_ptr_conv);
24560         return ret_conv;
24561 }
24562
24563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24564         LDKRecord this_ptr_conv;
24565         this_ptr_conv.inner = untag_ptr(this_ptr);
24566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24568         this_ptr_conv.is_owned = false;
24569         Record_set_line(&this_ptr_conv, val);
24570 }
24571
24572 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
24573         LDKRecord ret_var = Record_clone(arg);
24574         int64_t ret_ref = 0;
24575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24577         return ret_ref;
24578 }
24579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24580         LDKRecord arg_conv;
24581         arg_conv.inner = untag_ptr(arg);
24582         arg_conv.is_owned = ptr_is_owned(arg);
24583         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24584         arg_conv.is_owned = false;
24585         int64_t ret_conv = Record_clone_ptr(&arg_conv);
24586         return ret_conv;
24587 }
24588
24589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24590         LDKRecord orig_conv;
24591         orig_conv.inner = untag_ptr(orig);
24592         orig_conv.is_owned = ptr_is_owned(orig);
24593         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24594         orig_conv.is_owned = false;
24595         LDKRecord ret_var = Record_clone(&orig_conv);
24596         int64_t ret_ref = 0;
24597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24599         return ret_ref;
24600 }
24601
24602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24603         if (!ptr_is_owned(this_ptr)) return;
24604         void* this_ptr_ptr = untag_ptr(this_ptr);
24605         CHECK_ACCESS(this_ptr_ptr);
24606         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
24607         FREE(untag_ptr(this_ptr));
24608         Logger_free(this_ptr_conv);
24609 }
24610
24611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24612         LDKChannelHandshakeConfig this_obj_conv;
24613         this_obj_conv.inner = untag_ptr(this_obj);
24614         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24616         ChannelHandshakeConfig_free(this_obj_conv);
24617 }
24618
24619 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24620         LDKChannelHandshakeConfig this_ptr_conv;
24621         this_ptr_conv.inner = untag_ptr(this_ptr);
24622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24624         this_ptr_conv.is_owned = false;
24625         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
24626         return ret_conv;
24627 }
24628
24629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24630         LDKChannelHandshakeConfig this_ptr_conv;
24631         this_ptr_conv.inner = untag_ptr(this_ptr);
24632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24634         this_ptr_conv.is_owned = false;
24635         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
24636 }
24637
24638 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24639         LDKChannelHandshakeConfig this_ptr_conv;
24640         this_ptr_conv.inner = untag_ptr(this_ptr);
24641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24643         this_ptr_conv.is_owned = false;
24644         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
24645         return ret_conv;
24646 }
24647
24648 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) {
24649         LDKChannelHandshakeConfig this_ptr_conv;
24650         this_ptr_conv.inner = untag_ptr(this_ptr);
24651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24653         this_ptr_conv.is_owned = false;
24654         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
24655 }
24656
24657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24658         LDKChannelHandshakeConfig this_ptr_conv;
24659         this_ptr_conv.inner = untag_ptr(this_ptr);
24660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24662         this_ptr_conv.is_owned = false;
24663         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
24664         return ret_conv;
24665 }
24666
24667 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) {
24668         LDKChannelHandshakeConfig this_ptr_conv;
24669         this_ptr_conv.inner = untag_ptr(this_ptr);
24670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24672         this_ptr_conv.is_owned = false;
24673         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
24674 }
24675
24676 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) {
24677         LDKChannelHandshakeConfig this_ptr_conv;
24678         this_ptr_conv.inner = untag_ptr(this_ptr);
24679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24681         this_ptr_conv.is_owned = false;
24682         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
24683         return ret_conv;
24684 }
24685
24686 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) {
24687         LDKChannelHandshakeConfig this_ptr_conv;
24688         this_ptr_conv.inner = untag_ptr(this_ptr);
24689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24691         this_ptr_conv.is_owned = false;
24692         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
24693 }
24694
24695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
24696         LDKChannelHandshakeConfig this_ptr_conv;
24697         this_ptr_conv.inner = untag_ptr(this_ptr);
24698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24700         this_ptr_conv.is_owned = false;
24701         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
24702         return ret_conv;
24703 }
24704
24705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24706         LDKChannelHandshakeConfig this_ptr_conv;
24707         this_ptr_conv.inner = untag_ptr(this_ptr);
24708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24710         this_ptr_conv.is_owned = false;
24711         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
24712 }
24713
24714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
24715         LDKChannelHandshakeConfig this_ptr_conv;
24716         this_ptr_conv.inner = untag_ptr(this_ptr);
24717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24719         this_ptr_conv.is_owned = false;
24720         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
24721         return ret_conv;
24722 }
24723
24724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24725         LDKChannelHandshakeConfig this_ptr_conv;
24726         this_ptr_conv.inner = untag_ptr(this_ptr);
24727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24729         this_ptr_conv.is_owned = false;
24730         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
24731 }
24732
24733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24734         LDKChannelHandshakeConfig this_ptr_conv;
24735         this_ptr_conv.inner = untag_ptr(this_ptr);
24736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24738         this_ptr_conv.is_owned = false;
24739         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
24740         return ret_conv;
24741 }
24742
24743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24744         LDKChannelHandshakeConfig this_ptr_conv;
24745         this_ptr_conv.inner = untag_ptr(this_ptr);
24746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24748         this_ptr_conv.is_owned = false;
24749         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
24750 }
24751
24752 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) {
24753         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);
24754         int64_t ret_ref = 0;
24755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24757         return ret_ref;
24758 }
24759
24760 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
24761         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
24762         int64_t ret_ref = 0;
24763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24765         return ret_ref;
24766 }
24767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24768         LDKChannelHandshakeConfig arg_conv;
24769         arg_conv.inner = untag_ptr(arg);
24770         arg_conv.is_owned = ptr_is_owned(arg);
24771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24772         arg_conv.is_owned = false;
24773         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
24774         return ret_conv;
24775 }
24776
24777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24778         LDKChannelHandshakeConfig orig_conv;
24779         orig_conv.inner = untag_ptr(orig);
24780         orig_conv.is_owned = ptr_is_owned(orig);
24781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24782         orig_conv.is_owned = false;
24783         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
24784         int64_t ret_ref = 0;
24785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24787         return ret_ref;
24788 }
24789
24790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
24791         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
24792         int64_t ret_ref = 0;
24793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24795         return ret_ref;
24796 }
24797
24798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24799         LDKChannelHandshakeLimits this_obj_conv;
24800         this_obj_conv.inner = untag_ptr(this_obj);
24801         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24803         ChannelHandshakeLimits_free(this_obj_conv);
24804 }
24805
24806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24807         LDKChannelHandshakeLimits this_ptr_conv;
24808         this_ptr_conv.inner = untag_ptr(this_ptr);
24809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24811         this_ptr_conv.is_owned = false;
24812         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
24813         return ret_conv;
24814 }
24815
24816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24817         LDKChannelHandshakeLimits this_ptr_conv;
24818         this_ptr_conv.inner = untag_ptr(this_ptr);
24819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24821         this_ptr_conv.is_owned = false;
24822         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
24823 }
24824
24825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24826         LDKChannelHandshakeLimits this_ptr_conv;
24827         this_ptr_conv.inner = untag_ptr(this_ptr);
24828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24830         this_ptr_conv.is_owned = false;
24831         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
24832         return ret_conv;
24833 }
24834
24835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24836         LDKChannelHandshakeLimits this_ptr_conv;
24837         this_ptr_conv.inner = untag_ptr(this_ptr);
24838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24840         this_ptr_conv.is_owned = false;
24841         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
24842 }
24843
24844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24845         LDKChannelHandshakeLimits this_ptr_conv;
24846         this_ptr_conv.inner = untag_ptr(this_ptr);
24847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24849         this_ptr_conv.is_owned = false;
24850         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
24851         return ret_conv;
24852 }
24853
24854 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) {
24855         LDKChannelHandshakeLimits this_ptr_conv;
24856         this_ptr_conv.inner = untag_ptr(this_ptr);
24857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24859         this_ptr_conv.is_owned = false;
24860         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
24861 }
24862
24863 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) {
24864         LDKChannelHandshakeLimits this_ptr_conv;
24865         this_ptr_conv.inner = untag_ptr(this_ptr);
24866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24868         this_ptr_conv.is_owned = false;
24869         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
24870         return ret_conv;
24871 }
24872
24873 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) {
24874         LDKChannelHandshakeLimits this_ptr_conv;
24875         this_ptr_conv.inner = untag_ptr(this_ptr);
24876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24878         this_ptr_conv.is_owned = false;
24879         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
24880 }
24881
24882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24883         LDKChannelHandshakeLimits this_ptr_conv;
24884         this_ptr_conv.inner = untag_ptr(this_ptr);
24885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24887         this_ptr_conv.is_owned = false;
24888         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
24889         return ret_conv;
24890 }
24891
24892 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) {
24893         LDKChannelHandshakeLimits this_ptr_conv;
24894         this_ptr_conv.inner = untag_ptr(this_ptr);
24895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24897         this_ptr_conv.is_owned = false;
24898         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
24899 }
24900
24901 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24902         LDKChannelHandshakeLimits this_ptr_conv;
24903         this_ptr_conv.inner = untag_ptr(this_ptr);
24904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24906         this_ptr_conv.is_owned = false;
24907         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
24908         return ret_conv;
24909 }
24910
24911 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) {
24912         LDKChannelHandshakeLimits this_ptr_conv;
24913         this_ptr_conv.inner = untag_ptr(this_ptr);
24914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24916         this_ptr_conv.is_owned = false;
24917         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
24918 }
24919
24920 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24921         LDKChannelHandshakeLimits this_ptr_conv;
24922         this_ptr_conv.inner = untag_ptr(this_ptr);
24923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24925         this_ptr_conv.is_owned = false;
24926         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
24927         return ret_conv;
24928 }
24929
24930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24931         LDKChannelHandshakeLimits this_ptr_conv;
24932         this_ptr_conv.inner = untag_ptr(this_ptr);
24933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24935         this_ptr_conv.is_owned = false;
24936         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
24937 }
24938
24939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
24940         LDKChannelHandshakeLimits this_ptr_conv;
24941         this_ptr_conv.inner = untag_ptr(this_ptr);
24942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24944         this_ptr_conv.is_owned = false;
24945         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
24946         return ret_conv;
24947 }
24948
24949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24950         LDKChannelHandshakeLimits this_ptr_conv;
24951         this_ptr_conv.inner = untag_ptr(this_ptr);
24952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24954         this_ptr_conv.is_owned = false;
24955         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
24956 }
24957
24958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
24959         LDKChannelHandshakeLimits this_ptr_conv;
24960         this_ptr_conv.inner = untag_ptr(this_ptr);
24961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24963         this_ptr_conv.is_owned = false;
24964         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24965         return ret_conv;
24966 }
24967
24968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24969         LDKChannelHandshakeLimits this_ptr_conv;
24970         this_ptr_conv.inner = untag_ptr(this_ptr);
24971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24973         this_ptr_conv.is_owned = false;
24974         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24975 }
24976
24977 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24978         LDKChannelHandshakeLimits this_ptr_conv;
24979         this_ptr_conv.inner = untag_ptr(this_ptr);
24980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24982         this_ptr_conv.is_owned = false;
24983         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24984         return ret_conv;
24985 }
24986
24987 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) {
24988         LDKChannelHandshakeLimits this_ptr_conv;
24989         this_ptr_conv.inner = untag_ptr(this_ptr);
24990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24992         this_ptr_conv.is_owned = false;
24993         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24994 }
24995
24996 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) {
24997         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);
24998         int64_t ret_ref = 0;
24999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25001         return ret_ref;
25002 }
25003
25004 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
25005         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
25006         int64_t ret_ref = 0;
25007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25009         return ret_ref;
25010 }
25011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25012         LDKChannelHandshakeLimits arg_conv;
25013         arg_conv.inner = untag_ptr(arg);
25014         arg_conv.is_owned = ptr_is_owned(arg);
25015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25016         arg_conv.is_owned = false;
25017         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
25018         return ret_conv;
25019 }
25020
25021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25022         LDKChannelHandshakeLimits orig_conv;
25023         orig_conv.inner = untag_ptr(orig);
25024         orig_conv.is_owned = ptr_is_owned(orig);
25025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25026         orig_conv.is_owned = false;
25027         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
25035         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
25036         int64_t ret_ref = 0;
25037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25039         return ret_ref;
25040 }
25041
25042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25043         LDKChannelConfig this_obj_conv;
25044         this_obj_conv.inner = untag_ptr(this_obj);
25045         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25047         ChannelConfig_free(this_obj_conv);
25048 }
25049
25050 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
25051         LDKChannelConfig this_ptr_conv;
25052         this_ptr_conv.inner = untag_ptr(this_ptr);
25053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25055         this_ptr_conv.is_owned = false;
25056         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
25057         return ret_conv;
25058 }
25059
25060 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) {
25061         LDKChannelConfig this_ptr_conv;
25062         this_ptr_conv.inner = untag_ptr(this_ptr);
25063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25065         this_ptr_conv.is_owned = false;
25066         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
25067 }
25068
25069 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25070         LDKChannelConfig this_ptr_conv;
25071         this_ptr_conv.inner = untag_ptr(this_ptr);
25072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25074         this_ptr_conv.is_owned = false;
25075         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
25076         return ret_conv;
25077 }
25078
25079 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) {
25080         LDKChannelConfig this_ptr_conv;
25081         this_ptr_conv.inner = untag_ptr(this_ptr);
25082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25084         this_ptr_conv.is_owned = false;
25085         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
25086 }
25087
25088 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
25089         LDKChannelConfig 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         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
25095         return ret_conv;
25096 }
25097
25098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25099         LDKChannelConfig this_ptr_conv;
25100         this_ptr_conv.inner = untag_ptr(this_ptr);
25101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25103         this_ptr_conv.is_owned = false;
25104         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
25105 }
25106
25107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25108         LDKChannelConfig this_ptr_conv;
25109         this_ptr_conv.inner = untag_ptr(this_ptr);
25110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25112         this_ptr_conv.is_owned = false;
25113         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
25114         return ret_conv;
25115 }
25116
25117 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) {
25118         LDKChannelConfig this_ptr_conv;
25119         this_ptr_conv.inner = untag_ptr(this_ptr);
25120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25122         this_ptr_conv.is_owned = false;
25123         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
25124 }
25125
25126 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) {
25127         LDKChannelConfig this_ptr_conv;
25128         this_ptr_conv.inner = untag_ptr(this_ptr);
25129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25131         this_ptr_conv.is_owned = false;
25132         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
25133         return ret_conv;
25134 }
25135
25136 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) {
25137         LDKChannelConfig this_ptr_conv;
25138         this_ptr_conv.inner = untag_ptr(this_ptr);
25139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25141         this_ptr_conv.is_owned = false;
25142         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
25143 }
25144
25145 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) {
25146         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);
25147         int64_t ret_ref = 0;
25148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25150         return ret_ref;
25151 }
25152
25153 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
25154         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
25155         int64_t ret_ref = 0;
25156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25158         return ret_ref;
25159 }
25160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25161         LDKChannelConfig arg_conv;
25162         arg_conv.inner = untag_ptr(arg);
25163         arg_conv.is_owned = ptr_is_owned(arg);
25164         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25165         arg_conv.is_owned = false;
25166         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
25167         return ret_conv;
25168 }
25169
25170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25171         LDKChannelConfig orig_conv;
25172         orig_conv.inner = untag_ptr(orig);
25173         orig_conv.is_owned = ptr_is_owned(orig);
25174         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25175         orig_conv.is_owned = false;
25176         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
25177         int64_t ret_ref = 0;
25178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25180         return ret_ref;
25181 }
25182
25183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
25184         LDKChannelConfig ret_var = ChannelConfig_default();
25185         int64_t ret_ref = 0;
25186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25188         return ret_ref;
25189 }
25190
25191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
25192         LDKChannelConfig obj_conv;
25193         obj_conv.inner = untag_ptr(obj);
25194         obj_conv.is_owned = ptr_is_owned(obj);
25195         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25196         obj_conv.is_owned = false;
25197         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
25198         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25199         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25200         CVec_u8Z_free(ret_var);
25201         return ret_arr;
25202 }
25203
25204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25205         LDKu8slice ser_ref;
25206         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25207         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25208         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25209         *ret_conv = ChannelConfig_read(ser_ref);
25210         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25211         return tag_ptr(ret_conv, true);
25212 }
25213
25214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25215         LDKUserConfig this_obj_conv;
25216         this_obj_conv.inner = untag_ptr(this_obj);
25217         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25219         UserConfig_free(this_obj_conv);
25220 }
25221
25222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25223         LDKUserConfig this_ptr_conv;
25224         this_ptr_conv.inner = untag_ptr(this_ptr);
25225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25227         this_ptr_conv.is_owned = false;
25228         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
25229         int64_t ret_ref = 0;
25230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25232         return ret_ref;
25233 }
25234
25235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25236         LDKUserConfig this_ptr_conv;
25237         this_ptr_conv.inner = untag_ptr(this_ptr);
25238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25240         this_ptr_conv.is_owned = false;
25241         LDKChannelHandshakeConfig val_conv;
25242         val_conv.inner = untag_ptr(val);
25243         val_conv.is_owned = ptr_is_owned(val);
25244         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25245         val_conv = ChannelHandshakeConfig_clone(&val_conv);
25246         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
25247 }
25248
25249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
25250         LDKUserConfig this_ptr_conv;
25251         this_ptr_conv.inner = untag_ptr(this_ptr);
25252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25254         this_ptr_conv.is_owned = false;
25255         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
25256         int64_t ret_ref = 0;
25257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25259         return ret_ref;
25260 }
25261
25262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25263         LDKUserConfig this_ptr_conv;
25264         this_ptr_conv.inner = untag_ptr(this_ptr);
25265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25267         this_ptr_conv.is_owned = false;
25268         LDKChannelHandshakeLimits val_conv;
25269         val_conv.inner = untag_ptr(val);
25270         val_conv.is_owned = ptr_is_owned(val);
25271         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25272         val_conv = ChannelHandshakeLimits_clone(&val_conv);
25273         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
25274 }
25275
25276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
25277         LDKUserConfig this_ptr_conv;
25278         this_ptr_conv.inner = untag_ptr(this_ptr);
25279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25281         this_ptr_conv.is_owned = false;
25282         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
25283         int64_t ret_ref = 0;
25284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25286         return ret_ref;
25287 }
25288
25289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25290         LDKUserConfig this_ptr_conv;
25291         this_ptr_conv.inner = untag_ptr(this_ptr);
25292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25294         this_ptr_conv.is_owned = false;
25295         LDKChannelConfig val_conv;
25296         val_conv.inner = untag_ptr(val);
25297         val_conv.is_owned = ptr_is_owned(val);
25298         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25299         val_conv = ChannelConfig_clone(&val_conv);
25300         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
25301 }
25302
25303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25304         LDKUserConfig this_ptr_conv;
25305         this_ptr_conv.inner = untag_ptr(this_ptr);
25306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25308         this_ptr_conv.is_owned = false;
25309         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
25310         return ret_conv;
25311 }
25312
25313 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) {
25314         LDKUserConfig this_ptr_conv;
25315         this_ptr_conv.inner = untag_ptr(this_ptr);
25316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25318         this_ptr_conv.is_owned = false;
25319         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
25320 }
25321
25322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25323         LDKUserConfig this_ptr_conv;
25324         this_ptr_conv.inner = untag_ptr(this_ptr);
25325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25327         this_ptr_conv.is_owned = false;
25328         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
25329         return ret_conv;
25330 }
25331
25332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25333         LDKUserConfig this_ptr_conv;
25334         this_ptr_conv.inner = untag_ptr(this_ptr);
25335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25337         this_ptr_conv.is_owned = false;
25338         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
25339 }
25340
25341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
25342         LDKUserConfig this_ptr_conv;
25343         this_ptr_conv.inner = untag_ptr(this_ptr);
25344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25346         this_ptr_conv.is_owned = false;
25347         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
25348         return ret_conv;
25349 }
25350
25351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25352         LDKUserConfig this_ptr_conv;
25353         this_ptr_conv.inner = untag_ptr(this_ptr);
25354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25356         this_ptr_conv.is_owned = false;
25357         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
25358 }
25359
25360 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) {
25361         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
25362         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
25363         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
25364         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
25365         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
25366         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
25367         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
25368         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
25369         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
25370         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
25371         LDKChannelConfig channel_config_arg_conv;
25372         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
25373         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
25374         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
25375         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
25376         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);
25377         int64_t ret_ref = 0;
25378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25380         return ret_ref;
25381 }
25382
25383 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
25384         LDKUserConfig ret_var = UserConfig_clone(arg);
25385         int64_t ret_ref = 0;
25386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25388         return ret_ref;
25389 }
25390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25391         LDKUserConfig arg_conv;
25392         arg_conv.inner = untag_ptr(arg);
25393         arg_conv.is_owned = ptr_is_owned(arg);
25394         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25395         arg_conv.is_owned = false;
25396         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
25397         return ret_conv;
25398 }
25399
25400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25401         LDKUserConfig orig_conv;
25402         orig_conv.inner = untag_ptr(orig);
25403         orig_conv.is_owned = ptr_is_owned(orig);
25404         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25405         orig_conv.is_owned = false;
25406         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
25407         int64_t ret_ref = 0;
25408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25410         return ret_ref;
25411 }
25412
25413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
25414         LDKUserConfig ret_var = UserConfig_default();
25415         int64_t ret_ref = 0;
25416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25418         return ret_ref;
25419 }
25420
25421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25422         LDKBestBlock this_obj_conv;
25423         this_obj_conv.inner = untag_ptr(this_obj);
25424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25426         BestBlock_free(this_obj_conv);
25427 }
25428
25429 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
25430         LDKBestBlock ret_var = BestBlock_clone(arg);
25431         int64_t ret_ref = 0;
25432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25434         return ret_ref;
25435 }
25436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25437         LDKBestBlock arg_conv;
25438         arg_conv.inner = untag_ptr(arg);
25439         arg_conv.is_owned = ptr_is_owned(arg);
25440         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25441         arg_conv.is_owned = false;
25442         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
25443         return ret_conv;
25444 }
25445
25446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25447         LDKBestBlock orig_conv;
25448         orig_conv.inner = untag_ptr(orig);
25449         orig_conv.is_owned = ptr_is_owned(orig);
25450         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25451         orig_conv.is_owned = false;
25452         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
25453         int64_t ret_ref = 0;
25454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25456         return ret_ref;
25457 }
25458
25459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
25460         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
25461         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
25462         int64_t ret_ref = 0;
25463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25465         return ret_ref;
25466 }
25467
25468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
25469         LDKThirtyTwoBytes block_hash_ref;
25470         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
25471         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
25472         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
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 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25480         LDKBestBlock this_arg_conv;
25481         this_arg_conv.inner = untag_ptr(this_arg);
25482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25484         this_arg_conv.is_owned = false;
25485         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25486         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
25487         return ret_arr;
25488 }
25489
25490 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
25491         LDKBestBlock this_arg_conv;
25492         this_arg_conv.inner = untag_ptr(this_arg);
25493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25495         this_arg_conv.is_owned = false;
25496         int32_t ret_conv = BestBlock_height(&this_arg_conv);
25497         return ret_conv;
25498 }
25499
25500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25501         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
25502         jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
25503         return ret_conv;
25504 }
25505
25506 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
25507         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
25508         return ret_conv;
25509 }
25510
25511 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
25512         jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
25513         return ret_conv;
25514 }
25515
25516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25517         if (!ptr_is_owned(this_ptr)) return;
25518         void* this_ptr_ptr = untag_ptr(this_ptr);
25519         CHECK_ACCESS(this_ptr_ptr);
25520         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
25521         FREE(untag_ptr(this_ptr));
25522         Access_free(this_ptr_conv);
25523 }
25524
25525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25526         if (!ptr_is_owned(this_ptr)) return;
25527         void* this_ptr_ptr = untag_ptr(this_ptr);
25528         CHECK_ACCESS(this_ptr_ptr);
25529         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
25530         FREE(untag_ptr(this_ptr));
25531         Listen_free(this_ptr_conv);
25532 }
25533
25534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25535         if (!ptr_is_owned(this_ptr)) return;
25536         void* this_ptr_ptr = untag_ptr(this_ptr);
25537         CHECK_ACCESS(this_ptr_ptr);
25538         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
25539         FREE(untag_ptr(this_ptr));
25540         Confirm_free(this_ptr_conv);
25541 }
25542
25543 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25544         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
25545         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
25546         return ret_conv;
25547 }
25548
25549 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
25550         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
25551         return ret_conv;
25552 }
25553
25554 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
25555         jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
25556         return ret_conv;
25557 }
25558
25559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25560         if (!ptr_is_owned(this_ptr)) return;
25561         void* this_ptr_ptr = untag_ptr(this_ptr);
25562         CHECK_ACCESS(this_ptr_ptr);
25563         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
25564         FREE(untag_ptr(this_ptr));
25565         Watch_free(this_ptr_conv);
25566 }
25567
25568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25569         if (!ptr_is_owned(this_ptr)) return;
25570         void* this_ptr_ptr = untag_ptr(this_ptr);
25571         CHECK_ACCESS(this_ptr_ptr);
25572         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
25573         FREE(untag_ptr(this_ptr));
25574         Filter_free(this_ptr_conv);
25575 }
25576
25577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25578         LDKWatchedOutput this_obj_conv;
25579         this_obj_conv.inner = untag_ptr(this_obj);
25580         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25582         WatchedOutput_free(this_obj_conv);
25583 }
25584
25585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25586         LDKWatchedOutput this_ptr_conv;
25587         this_ptr_conv.inner = untag_ptr(this_ptr);
25588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25590         this_ptr_conv.is_owned = false;
25591         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25592         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
25593         return ret_arr;
25594 }
25595
25596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25597         LDKWatchedOutput this_ptr_conv;
25598         this_ptr_conv.inner = untag_ptr(this_ptr);
25599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25601         this_ptr_conv.is_owned = false;
25602         LDKThirtyTwoBytes val_ref;
25603         CHECK((*env)->GetArrayLength(env, val) == 32);
25604         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25605         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
25606 }
25607
25608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25609         LDKWatchedOutput this_ptr_conv;
25610         this_ptr_conv.inner = untag_ptr(this_ptr);
25611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25613         this_ptr_conv.is_owned = false;
25614         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
25615         int64_t ret_ref = 0;
25616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25618         return ret_ref;
25619 }
25620
25621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25622         LDKWatchedOutput this_ptr_conv;
25623         this_ptr_conv.inner = untag_ptr(this_ptr);
25624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25626         this_ptr_conv.is_owned = false;
25627         LDKOutPoint val_conv;
25628         val_conv.inner = untag_ptr(val);
25629         val_conv.is_owned = ptr_is_owned(val);
25630         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25631         val_conv = OutPoint_clone(&val_conv);
25632         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
25633 }
25634
25635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25636         LDKWatchedOutput this_ptr_conv;
25637         this_ptr_conv.inner = untag_ptr(this_ptr);
25638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25640         this_ptr_conv.is_owned = false;
25641         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
25642         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25643         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25644         return ret_arr;
25645 }
25646
25647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25648         LDKWatchedOutput this_ptr_conv;
25649         this_ptr_conv.inner = untag_ptr(this_ptr);
25650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25652         this_ptr_conv.is_owned = false;
25653         LDKCVec_u8Z val_ref;
25654         val_ref.datalen = (*env)->GetArrayLength(env, val);
25655         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
25656         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25657         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
25658 }
25659
25660 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) {
25661         LDKThirtyTwoBytes block_hash_arg_ref;
25662         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
25663         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
25664         LDKOutPoint outpoint_arg_conv;
25665         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25666         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25667         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25668         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25669         LDKCVec_u8Z script_pubkey_arg_ref;
25670         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
25671         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
25672         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
25673         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
25674         int64_t ret_ref = 0;
25675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25677         return ret_ref;
25678 }
25679
25680 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
25681         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
25682         int64_t ret_ref = 0;
25683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25685         return ret_ref;
25686 }
25687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25688         LDKWatchedOutput arg_conv;
25689         arg_conv.inner = untag_ptr(arg);
25690         arg_conv.is_owned = ptr_is_owned(arg);
25691         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25692         arg_conv.is_owned = false;
25693         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
25694         return ret_conv;
25695 }
25696
25697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25698         LDKWatchedOutput orig_conv;
25699         orig_conv.inner = untag_ptr(orig);
25700         orig_conv.is_owned = ptr_is_owned(orig);
25701         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25702         orig_conv.is_owned = false;
25703         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
25704         int64_t ret_ref = 0;
25705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25707         return ret_ref;
25708 }
25709
25710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
25711         LDKWatchedOutput o_conv;
25712         o_conv.inner = untag_ptr(o);
25713         o_conv.is_owned = ptr_is_owned(o);
25714         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25715         o_conv.is_owned = false;
25716         int64_t ret_conv = WatchedOutput_hash(&o_conv);
25717         return ret_conv;
25718 }
25719
25720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25721         if (!ptr_is_owned(this_ptr)) return;
25722         void* this_ptr_ptr = untag_ptr(this_ptr);
25723         CHECK_ACCESS(this_ptr_ptr);
25724         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
25725         FREE(untag_ptr(this_ptr));
25726         BroadcasterInterface_free(this_ptr_conv);
25727 }
25728
25729 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25730         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
25731         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
25732         return ret_conv;
25733 }
25734
25735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
25736         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
25737         return ret_conv;
25738 }
25739
25740 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
25741         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
25742         return ret_conv;
25743 }
25744
25745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
25746         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
25747         return ret_conv;
25748 }
25749
25750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25751         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
25752         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
25753         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
25754         return ret_conv;
25755 }
25756
25757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25758         if (!ptr_is_owned(this_ptr)) return;
25759         void* this_ptr_ptr = untag_ptr(this_ptr);
25760         CHECK_ACCESS(this_ptr_ptr);
25761         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
25762         FREE(untag_ptr(this_ptr));
25763         FeeEstimator_free(this_ptr_conv);
25764 }
25765
25766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25767         LDKMonitorUpdateId this_obj_conv;
25768         this_obj_conv.inner = untag_ptr(this_obj);
25769         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25771         MonitorUpdateId_free(this_obj_conv);
25772 }
25773
25774 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
25775         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
25776         int64_t ret_ref = 0;
25777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25779         return ret_ref;
25780 }
25781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25782         LDKMonitorUpdateId arg_conv;
25783         arg_conv.inner = untag_ptr(arg);
25784         arg_conv.is_owned = ptr_is_owned(arg);
25785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25786         arg_conv.is_owned = false;
25787         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
25788         return ret_conv;
25789 }
25790
25791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25792         LDKMonitorUpdateId orig_conv;
25793         orig_conv.inner = untag_ptr(orig);
25794         orig_conv.is_owned = ptr_is_owned(orig);
25795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25796         orig_conv.is_owned = false;
25797         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
25798         int64_t ret_ref = 0;
25799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25801         return ret_ref;
25802 }
25803
25804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
25805         LDKMonitorUpdateId o_conv;
25806         o_conv.inner = untag_ptr(o);
25807         o_conv.is_owned = ptr_is_owned(o);
25808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25809         o_conv.is_owned = false;
25810         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
25811         return ret_conv;
25812 }
25813
25814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25815         LDKMonitorUpdateId a_conv;
25816         a_conv.inner = untag_ptr(a);
25817         a_conv.is_owned = ptr_is_owned(a);
25818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25819         a_conv.is_owned = false;
25820         LDKMonitorUpdateId b_conv;
25821         b_conv.inner = untag_ptr(b);
25822         b_conv.is_owned = ptr_is_owned(b);
25823         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25824         b_conv.is_owned = false;
25825         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
25826         return ret_conv;
25827 }
25828
25829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25830         if (!ptr_is_owned(this_ptr)) return;
25831         void* this_ptr_ptr = untag_ptr(this_ptr);
25832         CHECK_ACCESS(this_ptr_ptr);
25833         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
25834         FREE(untag_ptr(this_ptr));
25835         Persist_free(this_ptr_conv);
25836 }
25837
25838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25839         LDKLockedChannelMonitor this_obj_conv;
25840         this_obj_conv.inner = untag_ptr(this_obj);
25841         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25843         LockedChannelMonitor_free(this_obj_conv);
25844 }
25845
25846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25847         LDKChainMonitor this_obj_conv;
25848         this_obj_conv.inner = untag_ptr(this_obj);
25849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25851         ChainMonitor_free(this_obj_conv);
25852 }
25853
25854 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) {
25855         void* chain_source_ptr = untag_ptr(chain_source);
25856         CHECK_ACCESS(chain_source_ptr);
25857         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
25858         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
25859         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
25860                 // Manually implement clone for Java trait instances
25861                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
25862                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25863                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
25864                 }
25865         }
25866         void* broadcaster_ptr = untag_ptr(broadcaster);
25867         CHECK_ACCESS(broadcaster_ptr);
25868         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25869         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25870                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25871                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25872         }
25873         void* logger_ptr = untag_ptr(logger);
25874         CHECK_ACCESS(logger_ptr);
25875         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25876         if (logger_conv.free == LDKLogger_JCalls_free) {
25877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25878                 LDKLogger_JCalls_cloned(&logger_conv);
25879         }
25880         void* feeest_ptr = untag_ptr(feeest);
25881         CHECK_ACCESS(feeest_ptr);
25882         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
25883         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25884                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25885                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25886         }
25887         void* persister_ptr = untag_ptr(persister);
25888         CHECK_ACCESS(persister_ptr);
25889         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25890         if (persister_conv.free == LDKPersist_JCalls_free) {
25891                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25892                 LDKPersist_JCalls_cloned(&persister_conv);
25893         }
25894         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25895         int64_t ret_ref = 0;
25896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25898         return ret_ref;
25899 }
25900
25901 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) {
25902         LDKChainMonitor this_arg_conv;
25903         this_arg_conv.inner = untag_ptr(this_arg);
25904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25906         this_arg_conv.is_owned = false;
25907         LDKCVec_ChannelDetailsZ ignored_channels_constr;
25908         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
25909         if (ignored_channels_constr.datalen > 0)
25910                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25911         else
25912                 ignored_channels_constr.data = NULL;
25913         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
25914         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25915                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25916                 LDKChannelDetails ignored_channels_conv_16_conv;
25917                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
25918                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
25919                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25920                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25921                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25922         }
25923         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
25924         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25925         int64_tArray ret_arr = NULL;
25926         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25927         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25928         for (size_t j = 0; j < ret_var.datalen; j++) {
25929                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25930                 *ret_conv_9_copy = ret_var.data[j];
25931                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25932                 ret_arr_ptr[j] = ret_conv_9_ref;
25933         }
25934         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25935         FREE(ret_var.data);
25936         return ret_arr;
25937 }
25938
25939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
25940         LDKChainMonitor this_arg_conv;
25941         this_arg_conv.inner = untag_ptr(this_arg);
25942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25944         this_arg_conv.is_owned = false;
25945         LDKOutPoint funding_txo_conv;
25946         funding_txo_conv.inner = untag_ptr(funding_txo);
25947         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25948         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25949         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25950         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25951         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25952         return tag_ptr(ret_conv, true);
25953 }
25954
25955 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
25956         LDKChainMonitor this_arg_conv;
25957         this_arg_conv.inner = untag_ptr(this_arg);
25958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25960         this_arg_conv.is_owned = false;
25961         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25962         int64_tArray ret_arr = NULL;
25963         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25964         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25965         for (size_t k = 0; k < ret_var.datalen; k++) {
25966                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25967                 int64_t ret_conv_10_ref = 0;
25968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25969                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
25970                 ret_arr_ptr[k] = ret_conv_10_ref;
25971         }
25972         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25973         FREE(ret_var.data);
25974         return ret_arr;
25975 }
25976
25977 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) {
25978         LDKChainMonitor this_arg_conv;
25979         this_arg_conv.inner = untag_ptr(this_arg);
25980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25982         this_arg_conv.is_owned = false;
25983         LDKOutPoint funding_txo_conv;
25984         funding_txo_conv.inner = untag_ptr(funding_txo);
25985         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
25986         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25987         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25988         LDKMonitorUpdateId completed_update_id_conv;
25989         completed_update_id_conv.inner = untag_ptr(completed_update_id);
25990         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
25991         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25992         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25993         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25994         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25995         return tag_ptr(ret_conv, true);
25996 }
25997
25998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
25999         LDKChainMonitor this_arg_conv;
26000         this_arg_conv.inner = untag_ptr(this_arg);
26001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26003         this_arg_conv.is_owned = false;
26004         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
26005         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
26006         return tag_ptr(ret_ret, true);
26007 }
26008
26009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
26010         LDKChainMonitor this_arg_conv;
26011         this_arg_conv.inner = untag_ptr(this_arg);
26012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26014         this_arg_conv.is_owned = false;
26015         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
26016         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
26017         return tag_ptr(ret_ret, true);
26018 }
26019
26020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26021         LDKChainMonitor this_arg_conv;
26022         this_arg_conv.inner = untag_ptr(this_arg);
26023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26025         this_arg_conv.is_owned = false;
26026         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
26027         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
26028         return tag_ptr(ret_ret, true);
26029 }
26030
26031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
26032         LDKChainMonitor this_arg_conv;
26033         this_arg_conv.inner = untag_ptr(this_arg);
26034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26036         this_arg_conv.is_owned = false;
26037         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
26038         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
26039         return tag_ptr(ret_ret, true);
26040 }
26041
26042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26043         LDKChannelMonitorUpdate this_obj_conv;
26044         this_obj_conv.inner = untag_ptr(this_obj);
26045         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26047         ChannelMonitorUpdate_free(this_obj_conv);
26048 }
26049
26050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26051         LDKChannelMonitorUpdate this_ptr_conv;
26052         this_ptr_conv.inner = untag_ptr(this_ptr);
26053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26055         this_ptr_conv.is_owned = false;
26056         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
26057         return ret_conv;
26058 }
26059
26060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26061         LDKChannelMonitorUpdate this_ptr_conv;
26062         this_ptr_conv.inner = untag_ptr(this_ptr);
26063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26065         this_ptr_conv.is_owned = false;
26066         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
26067 }
26068
26069 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
26070         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
26071         int64_t ret_ref = 0;
26072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26074         return ret_ref;
26075 }
26076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26077         LDKChannelMonitorUpdate arg_conv;
26078         arg_conv.inner = untag_ptr(arg);
26079         arg_conv.is_owned = ptr_is_owned(arg);
26080         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26081         arg_conv.is_owned = false;
26082         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
26083         return ret_conv;
26084 }
26085
26086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26087         LDKChannelMonitorUpdate orig_conv;
26088         orig_conv.inner = untag_ptr(orig);
26089         orig_conv.is_owned = ptr_is_owned(orig);
26090         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26091         orig_conv.is_owned = false;
26092         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
26093         int64_t ret_ref = 0;
26094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26096         return ret_ref;
26097 }
26098
26099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26100         LDKChannelMonitorUpdate obj_conv;
26101         obj_conv.inner = untag_ptr(obj);
26102         obj_conv.is_owned = ptr_is_owned(obj);
26103         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26104         obj_conv.is_owned = false;
26105         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
26106         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26107         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26108         CVec_u8Z_free(ret_var);
26109         return ret_arr;
26110 }
26111
26112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26113         LDKu8slice ser_ref;
26114         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26115         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26116         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
26117         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
26118         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26119         return tag_ptr(ret_conv, true);
26120 }
26121
26122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26123         if (!ptr_is_owned(this_ptr)) return;
26124         void* this_ptr_ptr = untag_ptr(this_ptr);
26125         CHECK_ACCESS(this_ptr_ptr);
26126         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
26127         FREE(untag_ptr(this_ptr));
26128         MonitorEvent_free(this_ptr_conv);
26129 }
26130
26131 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
26132         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26133         *ret_copy = MonitorEvent_clone(arg);
26134         int64_t ret_ref = tag_ptr(ret_copy, true);
26135         return ret_ref;
26136 }
26137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26138         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
26139         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
26140         return ret_conv;
26141 }
26142
26143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26144         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
26145         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26146         *ret_copy = MonitorEvent_clone(orig_conv);
26147         int64_t ret_ref = tag_ptr(ret_copy, true);
26148         return ret_ref;
26149 }
26150
26151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
26152         LDKHTLCUpdate a_conv;
26153         a_conv.inner = untag_ptr(a);
26154         a_conv.is_owned = ptr_is_owned(a);
26155         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26156         a_conv = HTLCUpdate_clone(&a_conv);
26157         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26158         *ret_copy = MonitorEvent_htlcevent(a_conv);
26159         int64_t ret_ref = tag_ptr(ret_copy, true);
26160         return ret_ref;
26161 }
26162
26163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
26164         LDKOutPoint a_conv;
26165         a_conv.inner = untag_ptr(a);
26166         a_conv.is_owned = ptr_is_owned(a);
26167         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26168         a_conv = OutPoint_clone(&a_conv);
26169         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26170         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
26171         int64_t ret_ref = tag_ptr(ret_copy, true);
26172         return ret_ref;
26173 }
26174
26175 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) {
26176         LDKOutPoint funding_txo_conv;
26177         funding_txo_conv.inner = untag_ptr(funding_txo);
26178         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
26179         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
26180         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
26181         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26182         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
26183         int64_t ret_ref = tag_ptr(ret_copy, true);
26184         return ret_ref;
26185 }
26186
26187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
26188         LDKOutPoint a_conv;
26189         a_conv.inner = untag_ptr(a);
26190         a_conv.is_owned = ptr_is_owned(a);
26191         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26192         a_conv = OutPoint_clone(&a_conv);
26193         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26194         *ret_copy = MonitorEvent_update_failed(a_conv);
26195         int64_t ret_ref = tag_ptr(ret_copy, true);
26196         return ret_ref;
26197 }
26198
26199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
26200         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
26201         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
26202         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26203         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26204         CVec_u8Z_free(ret_var);
26205         return ret_arr;
26206 }
26207
26208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26209         LDKu8slice ser_ref;
26210         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26211         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26212         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
26213         *ret_conv = MonitorEvent_read(ser_ref);
26214         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26215         return tag_ptr(ret_conv, true);
26216 }
26217
26218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26219         LDKHTLCUpdate this_obj_conv;
26220         this_obj_conv.inner = untag_ptr(this_obj);
26221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26223         HTLCUpdate_free(this_obj_conv);
26224 }
26225
26226 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
26227         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
26228         int64_t ret_ref = 0;
26229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26231         return ret_ref;
26232 }
26233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26234         LDKHTLCUpdate arg_conv;
26235         arg_conv.inner = untag_ptr(arg);
26236         arg_conv.is_owned = ptr_is_owned(arg);
26237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26238         arg_conv.is_owned = false;
26239         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
26240         return ret_conv;
26241 }
26242
26243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26244         LDKHTLCUpdate orig_conv;
26245         orig_conv.inner = untag_ptr(orig);
26246         orig_conv.is_owned = ptr_is_owned(orig);
26247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26248         orig_conv.is_owned = false;
26249         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
26250         int64_t ret_ref = 0;
26251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26253         return ret_ref;
26254 }
26255
26256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
26257         LDKHTLCUpdate obj_conv;
26258         obj_conv.inner = untag_ptr(obj);
26259         obj_conv.is_owned = ptr_is_owned(obj);
26260         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26261         obj_conv.is_owned = false;
26262         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
26263         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26264         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26265         CVec_u8Z_free(ret_var);
26266         return ret_arr;
26267 }
26268
26269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26270         LDKu8slice ser_ref;
26271         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26272         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26273         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
26274         *ret_conv = HTLCUpdate_read(ser_ref);
26275         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26276         return tag_ptr(ret_conv, true);
26277 }
26278
26279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26280         if (!ptr_is_owned(this_ptr)) return;
26281         void* this_ptr_ptr = untag_ptr(this_ptr);
26282         CHECK_ACCESS(this_ptr_ptr);
26283         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
26284         FREE(untag_ptr(this_ptr));
26285         Balance_free(this_ptr_conv);
26286 }
26287
26288 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
26289         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26290         *ret_copy = Balance_clone(arg);
26291         int64_t ret_ref = tag_ptr(ret_copy, true);
26292         return ret_ref;
26293 }
26294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26295         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
26296         int64_t ret_conv = Balance_clone_ptr(arg_conv);
26297         return ret_conv;
26298 }
26299
26300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26301         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
26302         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26303         *ret_copy = Balance_clone(orig_conv);
26304         int64_t ret_ref = tag_ptr(ret_copy, true);
26305         return ret_ref;
26306 }
26307
26308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
26309         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26310         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
26311         int64_t ret_ref = tag_ptr(ret_copy, true);
26312         return ret_ref;
26313 }
26314
26315 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) {
26316         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26317         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
26318         int64_t ret_ref = tag_ptr(ret_copy, true);
26319         return ret_ref;
26320 }
26321
26322 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) {
26323         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26324         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
26325         int64_t ret_ref = tag_ptr(ret_copy, true);
26326         return ret_ref;
26327 }
26328
26329 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) {
26330         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26331         *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
26332         int64_t ret_ref = tag_ptr(ret_copy, true);
26333         return ret_ref;
26334 }
26335
26336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26337         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
26338         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
26339         jboolean ret_conv = Balance_eq(a_conv, b_conv);
26340         return ret_conv;
26341 }
26342
26343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26344         LDKChannelMonitor this_obj_conv;
26345         this_obj_conv.inner = untag_ptr(this_obj);
26346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26348         ChannelMonitor_free(this_obj_conv);
26349 }
26350
26351 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
26352         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
26353         int64_t ret_ref = 0;
26354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26356         return ret_ref;
26357 }
26358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26359         LDKChannelMonitor arg_conv;
26360         arg_conv.inner = untag_ptr(arg);
26361         arg_conv.is_owned = ptr_is_owned(arg);
26362         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26363         arg_conv.is_owned = false;
26364         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
26365         return ret_conv;
26366 }
26367
26368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26369         LDKChannelMonitor orig_conv;
26370         orig_conv.inner = untag_ptr(orig);
26371         orig_conv.is_owned = ptr_is_owned(orig);
26372         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26373         orig_conv.is_owned = false;
26374         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
26375         int64_t ret_ref = 0;
26376         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26377         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26378         return ret_ref;
26379 }
26380
26381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26382         LDKChannelMonitor obj_conv;
26383         obj_conv.inner = untag_ptr(obj);
26384         obj_conv.is_owned = ptr_is_owned(obj);
26385         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26386         obj_conv.is_owned = false;
26387         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
26388         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26389         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26390         CVec_u8Z_free(ret_var);
26391         return ret_arr;
26392 }
26393
26394 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) {
26395         LDKChannelMonitor this_arg_conv;
26396         this_arg_conv.inner = untag_ptr(this_arg);
26397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26399         this_arg_conv.is_owned = false;
26400         LDKChannelMonitorUpdate updates_conv;
26401         updates_conv.inner = untag_ptr(updates);
26402         updates_conv.is_owned = ptr_is_owned(updates);
26403         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
26404         updates_conv.is_owned = false;
26405         void* broadcaster_ptr = untag_ptr(broadcaster);
26406         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
26407         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
26408         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26409         CHECK_ACCESS(fee_estimator_ptr);
26410         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26411         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26412                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26413                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26414         }
26415         void* logger_ptr = untag_ptr(logger);
26416         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
26417         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26418         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
26419         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
26420         return tag_ptr(ret_conv, true);
26421 }
26422
26423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26424         LDKChannelMonitor this_arg_conv;
26425         this_arg_conv.inner = untag_ptr(this_arg);
26426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26428         this_arg_conv.is_owned = false;
26429         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
26430         return ret_conv;
26431 }
26432
26433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
26434         LDKChannelMonitor this_arg_conv;
26435         this_arg_conv.inner = untag_ptr(this_arg);
26436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26438         this_arg_conv.is_owned = false;
26439         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
26440         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
26441         return tag_ptr(ret_conv, true);
26442 }
26443
26444 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26445         LDKChannelMonitor this_arg_conv;
26446         this_arg_conv.inner = untag_ptr(this_arg);
26447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26449         this_arg_conv.is_owned = false;
26450         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
26451         int64_tArray ret_arr = NULL;
26452         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26453         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26454         for (size_t o = 0; o < ret_var.datalen; o++) {
26455                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
26456                 *ret_conv_40_conv = ret_var.data[o];
26457                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
26458         }
26459         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26460         FREE(ret_var.data);
26461         return ret_arr;
26462 }
26463
26464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
26465         LDKChannelMonitor this_arg_conv;
26466         this_arg_conv.inner = untag_ptr(this_arg);
26467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26469         this_arg_conv.is_owned = false;
26470         void* filter_ptr = untag_ptr(filter);
26471         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
26472         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
26473         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
26474 }
26475
26476 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26477         LDKChannelMonitor this_arg_conv;
26478         this_arg_conv.inner = untag_ptr(this_arg);
26479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26481         this_arg_conv.is_owned = false;
26482         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
26483         int64_tArray ret_arr = NULL;
26484         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26485         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26486         for (size_t o = 0; o < ret_var.datalen; o++) {
26487                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26488                 *ret_conv_14_copy = ret_var.data[o];
26489                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
26490                 ret_arr_ptr[o] = ret_conv_14_ref;
26491         }
26492         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26493         FREE(ret_var.data);
26494         return ret_arr;
26495 }
26496
26497 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26498         LDKChannelMonitor this_arg_conv;
26499         this_arg_conv.inner = untag_ptr(this_arg);
26500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26502         this_arg_conv.is_owned = false;
26503         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
26504         int64_tArray ret_arr = NULL;
26505         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26506         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26507         for (size_t h = 0; h < ret_var.datalen; h++) {
26508                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26509                 *ret_conv_7_copy = ret_var.data[h];
26510                 int64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
26511                 ret_arr_ptr[h] = ret_conv_7_ref;
26512         }
26513         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26514         FREE(ret_var.data);
26515         return ret_arr;
26516 }
26517
26518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26519         LDKChannelMonitor this_arg_conv;
26520         this_arg_conv.inner = untag_ptr(this_arg);
26521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26523         this_arg_conv.is_owned = false;
26524         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26525         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
26526         return ret_arr;
26527 }
26528
26529 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) {
26530         LDKChannelMonitor this_arg_conv;
26531         this_arg_conv.inner = untag_ptr(this_arg);
26532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26534         this_arg_conv.is_owned = false;
26535         void* logger_ptr = untag_ptr(logger);
26536         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
26537         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26538         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
26539         jobjectArray ret_arr = NULL;
26540         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26541         ;
26542         for (size_t i = 0; i < ret_var.datalen; i++) {
26543                 LDKTransaction ret_conv_8_var = ret_var.data[i];
26544                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
26545                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
26546                 Transaction_free(ret_conv_8_var);
26547                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26548         }
26549         
26550         FREE(ret_var.data);
26551         return ret_arr;
26552 }
26553
26554 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) {
26555         LDKChannelMonitor this_arg_conv;
26556         this_arg_conv.inner = untag_ptr(this_arg);
26557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26559         this_arg_conv.is_owned = false;
26560         unsigned char header_arr[80];
26561         CHECK((*env)->GetArrayLength(env, header) == 80);
26562         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26563         unsigned char (*header_ref)[80] = &header_arr;
26564         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26565         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26566         if (txdata_constr.datalen > 0)
26567                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26568         else
26569                 txdata_constr.data = NULL;
26570         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26571         for (size_t c = 0; c < txdata_constr.datalen; c++) {
26572                 int64_t txdata_conv_28 = txdata_vals[c];
26573                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
26574                 CHECK_ACCESS(txdata_conv_28_ptr);
26575                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26576                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
26577                 txdata_constr.data[c] = txdata_conv_28_conv;
26578         }
26579         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26580         void* broadcaster_ptr = untag_ptr(broadcaster);
26581         CHECK_ACCESS(broadcaster_ptr);
26582         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26583         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26584                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26585                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26586         }
26587         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26588         CHECK_ACCESS(fee_estimator_ptr);
26589         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26590         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26591                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26592                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26593         }
26594         void* logger_ptr = untag_ptr(logger);
26595         CHECK_ACCESS(logger_ptr);
26596         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26597         if (logger_conv.free == LDKLogger_JCalls_free) {
26598                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26599                 LDKLogger_JCalls_cloned(&logger_conv);
26600         }
26601         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);
26602         int64_tArray ret_arr = NULL;
26603         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26604         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26605         for (size_t n = 0; n < ret_var.datalen; n++) {
26606                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26607                 *ret_conv_39_conv = ret_var.data[n];
26608                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26609         }
26610         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26611         FREE(ret_var.data);
26612         return ret_arr;
26613 }
26614
26615 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) {
26616         LDKChannelMonitor this_arg_conv;
26617         this_arg_conv.inner = untag_ptr(this_arg);
26618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26620         this_arg_conv.is_owned = false;
26621         unsigned char header_arr[80];
26622         CHECK((*env)->GetArrayLength(env, header) == 80);
26623         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26624         unsigned char (*header_ref)[80] = &header_arr;
26625         void* broadcaster_ptr = untag_ptr(broadcaster);
26626         CHECK_ACCESS(broadcaster_ptr);
26627         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26628         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26629                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26630                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26631         }
26632         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26633         CHECK_ACCESS(fee_estimator_ptr);
26634         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26635         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26636                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26637                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26638         }
26639         void* logger_ptr = untag_ptr(logger);
26640         CHECK_ACCESS(logger_ptr);
26641         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26642         if (logger_conv.free == LDKLogger_JCalls_free) {
26643                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26644                 LDKLogger_JCalls_cloned(&logger_conv);
26645         }
26646         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26647 }
26648
26649 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) {
26650         LDKChannelMonitor this_arg_conv;
26651         this_arg_conv.inner = untag_ptr(this_arg);
26652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26654         this_arg_conv.is_owned = false;
26655         unsigned char header_arr[80];
26656         CHECK((*env)->GetArrayLength(env, header) == 80);
26657         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26658         unsigned char (*header_ref)[80] = &header_arr;
26659         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26660         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26661         if (txdata_constr.datalen > 0)
26662                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26663         else
26664                 txdata_constr.data = NULL;
26665         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26666         for (size_t c = 0; c < txdata_constr.datalen; c++) {
26667                 int64_t txdata_conv_28 = txdata_vals[c];
26668                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
26669                 CHECK_ACCESS(txdata_conv_28_ptr);
26670                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26671                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
26672                 txdata_constr.data[c] = txdata_conv_28_conv;
26673         }
26674         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26675         void* broadcaster_ptr = untag_ptr(broadcaster);
26676         CHECK_ACCESS(broadcaster_ptr);
26677         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26678         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26679                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26680                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26681         }
26682         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26683         CHECK_ACCESS(fee_estimator_ptr);
26684         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26685         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26686                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26687                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26688         }
26689         void* logger_ptr = untag_ptr(logger);
26690         CHECK_ACCESS(logger_ptr);
26691         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26692         if (logger_conv.free == LDKLogger_JCalls_free) {
26693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26694                 LDKLogger_JCalls_cloned(&logger_conv);
26695         }
26696         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);
26697         int64_tArray ret_arr = NULL;
26698         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26699         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26700         for (size_t n = 0; n < ret_var.datalen; n++) {
26701                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26702                 *ret_conv_39_conv = ret_var.data[n];
26703                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26704         }
26705         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26706         FREE(ret_var.data);
26707         return ret_arr;
26708 }
26709
26710 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) {
26711         LDKChannelMonitor this_arg_conv;
26712         this_arg_conv.inner = untag_ptr(this_arg);
26713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26715         this_arg_conv.is_owned = false;
26716         unsigned char txid_arr[32];
26717         CHECK((*env)->GetArrayLength(env, txid) == 32);
26718         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
26719         unsigned char (*txid_ref)[32] = &txid_arr;
26720         void* broadcaster_ptr = untag_ptr(broadcaster);
26721         CHECK_ACCESS(broadcaster_ptr);
26722         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26723         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26724                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26725                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26726         }
26727         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26728         CHECK_ACCESS(fee_estimator_ptr);
26729         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26730         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26731                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26732                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26733         }
26734         void* logger_ptr = untag_ptr(logger);
26735         CHECK_ACCESS(logger_ptr);
26736         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26737         if (logger_conv.free == LDKLogger_JCalls_free) {
26738                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26739                 LDKLogger_JCalls_cloned(&logger_conv);
26740         }
26741         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
26742 }
26743
26744 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) {
26745         LDKChannelMonitor this_arg_conv;
26746         this_arg_conv.inner = untag_ptr(this_arg);
26747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26749         this_arg_conv.is_owned = false;
26750         unsigned char header_arr[80];
26751         CHECK((*env)->GetArrayLength(env, header) == 80);
26752         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26753         unsigned char (*header_ref)[80] = &header_arr;
26754         void* broadcaster_ptr = untag_ptr(broadcaster);
26755         CHECK_ACCESS(broadcaster_ptr);
26756         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26757         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26758                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26759                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26760         }
26761         void* fee_estimator_ptr = untag_ptr(fee_estimator);
26762         CHECK_ACCESS(fee_estimator_ptr);
26763         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26764         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26766                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26767         }
26768         void* logger_ptr = untag_ptr(logger);
26769         CHECK_ACCESS(logger_ptr);
26770         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26771         if (logger_conv.free == LDKLogger_JCalls_free) {
26772                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26773                 LDKLogger_JCalls_cloned(&logger_conv);
26774         }
26775         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26776         int64_tArray ret_arr = NULL;
26777         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26778         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26779         for (size_t n = 0; n < ret_var.datalen; n++) {
26780                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26781                 *ret_conv_39_conv = ret_var.data[n];
26782                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
26783         }
26784         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26785         FREE(ret_var.data);
26786         return ret_arr;
26787 }
26788
26789 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
26790         LDKChannelMonitor this_arg_conv;
26791         this_arg_conv.inner = untag_ptr(this_arg);
26792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26794         this_arg_conv.is_owned = false;
26795         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
26796         jobjectArray ret_arr = NULL;
26797         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26798         ;
26799         for (size_t i = 0; i < ret_var.datalen; i++) {
26800                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
26801                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
26802                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26803         }
26804         
26805         FREE(ret_var.data);
26806         return ret_arr;
26807 }
26808
26809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
26810         LDKChannelMonitor this_arg_conv;
26811         this_arg_conv.inner = untag_ptr(this_arg);
26812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26814         this_arg_conv.is_owned = false;
26815         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
26816         int64_t ret_ref = 0;
26817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26819         return ret_ref;
26820 }
26821
26822 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
26823         LDKChannelMonitor this_arg_conv;
26824         this_arg_conv.inner = untag_ptr(this_arg);
26825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26827         this_arg_conv.is_owned = false;
26828         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26829         int64_tArray ret_arr = NULL;
26830         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26831         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26832         for (size_t j = 0; j < ret_var.datalen; j++) {
26833                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26834                 *ret_conv_9_copy = ret_var.data[j];
26835                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
26836                 ret_arr_ptr[j] = ret_conv_9_ref;
26837         }
26838         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26839         FREE(ret_var.data);
26840         return ret_arr;
26841 }
26842
26843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
26844         LDKu8slice ser_ref;
26845         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26846         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26847         void* arg_ptr = untag_ptr(arg);
26848         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26849         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
26850         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26851         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
26852         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26853         return tag_ptr(ret_conv, true);
26854 }
26855
26856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26857         LDKOutPoint this_obj_conv;
26858         this_obj_conv.inner = untag_ptr(this_obj);
26859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26861         OutPoint_free(this_obj_conv);
26862 }
26863
26864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26865         LDKOutPoint this_ptr_conv;
26866         this_ptr_conv.inner = untag_ptr(this_ptr);
26867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26869         this_ptr_conv.is_owned = false;
26870         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26871         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
26872         return ret_arr;
26873 }
26874
26875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26876         LDKOutPoint this_ptr_conv;
26877         this_ptr_conv.inner = untag_ptr(this_ptr);
26878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26880         this_ptr_conv.is_owned = false;
26881         LDKThirtyTwoBytes val_ref;
26882         CHECK((*env)->GetArrayLength(env, val) == 32);
26883         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26884         OutPoint_set_txid(&this_ptr_conv, val_ref);
26885 }
26886
26887 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
26888         LDKOutPoint this_ptr_conv;
26889         this_ptr_conv.inner = untag_ptr(this_ptr);
26890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26892         this_ptr_conv.is_owned = false;
26893         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
26894         return ret_conv;
26895 }
26896
26897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26898         LDKOutPoint this_ptr_conv;
26899         this_ptr_conv.inner = untag_ptr(this_ptr);
26900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26902         this_ptr_conv.is_owned = false;
26903         OutPoint_set_index(&this_ptr_conv, val);
26904 }
26905
26906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
26907         LDKThirtyTwoBytes txid_arg_ref;
26908         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26909         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26910         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26911         int64_t ret_ref = 0;
26912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26914         return ret_ref;
26915 }
26916
26917 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26918         LDKOutPoint ret_var = OutPoint_clone(arg);
26919         int64_t ret_ref = 0;
26920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26922         return ret_ref;
26923 }
26924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26925         LDKOutPoint arg_conv;
26926         arg_conv.inner = untag_ptr(arg);
26927         arg_conv.is_owned = ptr_is_owned(arg);
26928         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26929         arg_conv.is_owned = false;
26930         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
26931         return ret_conv;
26932 }
26933
26934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26935         LDKOutPoint orig_conv;
26936         orig_conv.inner = untag_ptr(orig);
26937         orig_conv.is_owned = ptr_is_owned(orig);
26938         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26939         orig_conv.is_owned = false;
26940         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26941         int64_t ret_ref = 0;
26942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26944         return ret_ref;
26945 }
26946
26947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26948         LDKOutPoint a_conv;
26949         a_conv.inner = untag_ptr(a);
26950         a_conv.is_owned = ptr_is_owned(a);
26951         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26952         a_conv.is_owned = false;
26953         LDKOutPoint b_conv;
26954         b_conv.inner = untag_ptr(b);
26955         b_conv.is_owned = ptr_is_owned(b);
26956         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26957         b_conv.is_owned = false;
26958         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
26959         return ret_conv;
26960 }
26961
26962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26963         LDKOutPoint o_conv;
26964         o_conv.inner = untag_ptr(o);
26965         o_conv.is_owned = ptr_is_owned(o);
26966         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26967         o_conv.is_owned = false;
26968         int64_t ret_conv = OutPoint_hash(&o_conv);
26969         return ret_conv;
26970 }
26971
26972 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26973         LDKOutPoint this_arg_conv;
26974         this_arg_conv.inner = untag_ptr(this_arg);
26975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26977         this_arg_conv.is_owned = false;
26978         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26979         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
26980         return ret_arr;
26981 }
26982
26983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
26984         LDKOutPoint obj_conv;
26985         obj_conv.inner = untag_ptr(obj);
26986         obj_conv.is_owned = ptr_is_owned(obj);
26987         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26988         obj_conv.is_owned = false;
26989         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26990         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26991         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26992         CVec_u8Z_free(ret_var);
26993         return ret_arr;
26994 }
26995
26996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26997         LDKu8slice ser_ref;
26998         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26999         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27000         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
27001         *ret_conv = OutPoint_read(ser_ref);
27002         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27003         return tag_ptr(ret_conv, true);
27004 }
27005
27006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27007         LDKDelayedPaymentOutputDescriptor this_obj_conv;
27008         this_obj_conv.inner = untag_ptr(this_obj);
27009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27011         DelayedPaymentOutputDescriptor_free(this_obj_conv);
27012 }
27013
27014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27015         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27016         this_ptr_conv.inner = untag_ptr(this_ptr);
27017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27019         this_ptr_conv.is_owned = false;
27020         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27028         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27029         this_ptr_conv.inner = untag_ptr(this_ptr);
27030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27032         this_ptr_conv.is_owned = false;
27033         LDKOutPoint val_conv;
27034         val_conv.inner = untag_ptr(val);
27035         val_conv.is_owned = ptr_is_owned(val);
27036         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27037         val_conv = OutPoint_clone(&val_conv);
27038         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27039 }
27040
27041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
27042         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27043         this_ptr_conv.inner = untag_ptr(this_ptr);
27044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27046         this_ptr_conv.is_owned = false;
27047         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27048         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
27049         return ret_arr;
27050 }
27051
27052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27053         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27054         this_ptr_conv.inner = untag_ptr(this_ptr);
27055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27057         this_ptr_conv.is_owned = false;
27058         LDKPublicKey val_ref;
27059         CHECK((*env)->GetArrayLength(env, val) == 33);
27060         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27061         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
27062 }
27063
27064 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
27065         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27066         this_ptr_conv.inner = untag_ptr(this_ptr);
27067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27069         this_ptr_conv.is_owned = false;
27070         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
27071         return ret_conv;
27072 }
27073
27074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27075         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27076         this_ptr_conv.inner = untag_ptr(this_ptr);
27077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27079         this_ptr_conv.is_owned = false;
27080         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
27081 }
27082
27083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
27084         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27085         this_ptr_conv.inner = untag_ptr(this_ptr);
27086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27088         this_ptr_conv.is_owned = false;
27089         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
27090         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
27091         return tag_ptr(ret_ref, true);
27092 }
27093
27094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27095         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27096         this_ptr_conv.inner = untag_ptr(this_ptr);
27097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27099         this_ptr_conv.is_owned = false;
27100         void* val_ptr = untag_ptr(val);
27101         CHECK_ACCESS(val_ptr);
27102         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27103         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
27104         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27105 }
27106
27107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
27108         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27109         this_ptr_conv.inner = untag_ptr(this_ptr);
27110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27112         this_ptr_conv.is_owned = false;
27113         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27114         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
27115         return ret_arr;
27116 }
27117
27118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27119         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27120         this_ptr_conv.inner = untag_ptr(this_ptr);
27121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27123         this_ptr_conv.is_owned = false;
27124         LDKPublicKey val_ref;
27125         CHECK((*env)->GetArrayLength(env, val) == 33);
27126         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27127         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
27128 }
27129
27130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27131         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27132         this_ptr_conv.inner = untag_ptr(this_ptr);
27133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27135         this_ptr_conv.is_owned = false;
27136         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27137         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27138         return ret_arr;
27139 }
27140
27141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27142         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27143         this_ptr_conv.inner = untag_ptr(this_ptr);
27144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27146         this_ptr_conv.is_owned = false;
27147         LDKThirtyTwoBytes val_ref;
27148         CHECK((*env)->GetArrayLength(env, val) == 32);
27149         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27150         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27151 }
27152
27153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27154         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27155         this_ptr_conv.inner = untag_ptr(this_ptr);
27156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27158         this_ptr_conv.is_owned = false;
27159         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27160         return ret_conv;
27161 }
27162
27163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27164         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
27165         this_ptr_conv.inner = untag_ptr(this_ptr);
27166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27168         this_ptr_conv.is_owned = false;
27169         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27170 }
27171
27172 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) {
27173         LDKOutPoint outpoint_arg_conv;
27174         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
27175         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
27176         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27177         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27178         LDKPublicKey per_commitment_point_arg_ref;
27179         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
27180         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
27181         void* output_arg_ptr = untag_ptr(output_arg);
27182         CHECK_ACCESS(output_arg_ptr);
27183         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27184         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
27185         LDKPublicKey revocation_pubkey_arg_ref;
27186         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
27187         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
27188         LDKThirtyTwoBytes channel_keys_id_arg_ref;
27189         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27190         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27191         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);
27192         int64_t ret_ref = 0;
27193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27195         return ret_ref;
27196 }
27197
27198 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
27199         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
27200         int64_t ret_ref = 0;
27201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27203         return ret_ref;
27204 }
27205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27206         LDKDelayedPaymentOutputDescriptor arg_conv;
27207         arg_conv.inner = untag_ptr(arg);
27208         arg_conv.is_owned = ptr_is_owned(arg);
27209         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27210         arg_conv.is_owned = false;
27211         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
27212         return ret_conv;
27213 }
27214
27215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27216         LDKDelayedPaymentOutputDescriptor orig_conv;
27217         orig_conv.inner = untag_ptr(orig);
27218         orig_conv.is_owned = ptr_is_owned(orig);
27219         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27220         orig_conv.is_owned = false;
27221         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
27222         int64_t ret_ref = 0;
27223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27225         return ret_ref;
27226 }
27227
27228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27229         LDKDelayedPaymentOutputDescriptor obj_conv;
27230         obj_conv.inner = untag_ptr(obj);
27231         obj_conv.is_owned = ptr_is_owned(obj);
27232         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27233         obj_conv.is_owned = false;
27234         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
27235         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27236         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27237         CVec_u8Z_free(ret_var);
27238         return ret_arr;
27239 }
27240
27241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27242         LDKu8slice ser_ref;
27243         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27244         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27245         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
27246         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
27247         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27248         return tag_ptr(ret_conv, true);
27249 }
27250
27251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27252         LDKStaticPaymentOutputDescriptor this_obj_conv;
27253         this_obj_conv.inner = untag_ptr(this_obj);
27254         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27256         StaticPaymentOutputDescriptor_free(this_obj_conv);
27257 }
27258
27259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
27260         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27261         this_ptr_conv.inner = untag_ptr(this_ptr);
27262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27264         this_ptr_conv.is_owned = false;
27265         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
27266         int64_t ret_ref = 0;
27267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27269         return ret_ref;
27270 }
27271
27272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27273         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27274         this_ptr_conv.inner = untag_ptr(this_ptr);
27275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27277         this_ptr_conv.is_owned = false;
27278         LDKOutPoint val_conv;
27279         val_conv.inner = untag_ptr(val);
27280         val_conv.is_owned = ptr_is_owned(val);
27281         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27282         val_conv = OutPoint_clone(&val_conv);
27283         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
27284 }
27285
27286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
27287         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27288         this_ptr_conv.inner = untag_ptr(this_ptr);
27289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27291         this_ptr_conv.is_owned = false;
27292         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
27293         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
27294         return tag_ptr(ret_ref, true);
27295 }
27296
27297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27298         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27299         this_ptr_conv.inner = untag_ptr(this_ptr);
27300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27302         this_ptr_conv.is_owned = false;
27303         void* val_ptr = untag_ptr(val);
27304         CHECK_ACCESS(val_ptr);
27305         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
27306         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
27307         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
27308 }
27309
27310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27311         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27312         this_ptr_conv.inner = untag_ptr(this_ptr);
27313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27315         this_ptr_conv.is_owned = false;
27316         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27317         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
27318         return ret_arr;
27319 }
27320
27321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27322         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27323         this_ptr_conv.inner = untag_ptr(this_ptr);
27324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27326         this_ptr_conv.is_owned = false;
27327         LDKThirtyTwoBytes val_ref;
27328         CHECK((*env)->GetArrayLength(env, val) == 32);
27329         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27330         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
27331 }
27332
27333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27334         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27335         this_ptr_conv.inner = untag_ptr(this_ptr);
27336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27338         this_ptr_conv.is_owned = false;
27339         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
27340         return ret_conv;
27341 }
27342
27343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27344         LDKStaticPaymentOutputDescriptor this_ptr_conv;
27345         this_ptr_conv.inner = untag_ptr(this_ptr);
27346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27348         this_ptr_conv.is_owned = false;
27349         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
27350 }
27351
27352 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) {
27353         LDKOutPoint outpoint_arg_conv;
27354         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
27355         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
27356         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
27357         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
27358         void* output_arg_ptr = untag_ptr(output_arg);
27359         CHECK_ACCESS(output_arg_ptr);
27360         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
27361         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
27362         LDKThirtyTwoBytes channel_keys_id_arg_ref;
27363         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
27364         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
27365         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
27366         int64_t ret_ref = 0;
27367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27369         return ret_ref;
27370 }
27371
27372 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
27373         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
27374         int64_t ret_ref = 0;
27375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27377         return ret_ref;
27378 }
27379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27380         LDKStaticPaymentOutputDescriptor arg_conv;
27381         arg_conv.inner = untag_ptr(arg);
27382         arg_conv.is_owned = ptr_is_owned(arg);
27383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27384         arg_conv.is_owned = false;
27385         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
27386         return ret_conv;
27387 }
27388
27389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27390         LDKStaticPaymentOutputDescriptor orig_conv;
27391         orig_conv.inner = untag_ptr(orig);
27392         orig_conv.is_owned = ptr_is_owned(orig);
27393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27394         orig_conv.is_owned = false;
27395         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
27396         int64_t ret_ref = 0;
27397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27399         return ret_ref;
27400 }
27401
27402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27403         LDKStaticPaymentOutputDescriptor obj_conv;
27404         obj_conv.inner = untag_ptr(obj);
27405         obj_conv.is_owned = ptr_is_owned(obj);
27406         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27407         obj_conv.is_owned = false;
27408         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
27409         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27410         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27411         CVec_u8Z_free(ret_var);
27412         return ret_arr;
27413 }
27414
27415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27416         LDKu8slice ser_ref;
27417         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27418         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27419         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
27420         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
27421         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27422         return tag_ptr(ret_conv, true);
27423 }
27424
27425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27426         if (!ptr_is_owned(this_ptr)) return;
27427         void* this_ptr_ptr = untag_ptr(this_ptr);
27428         CHECK_ACCESS(this_ptr_ptr);
27429         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
27430         FREE(untag_ptr(this_ptr));
27431         SpendableOutputDescriptor_free(this_ptr_conv);
27432 }
27433
27434 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
27435         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27436         *ret_copy = SpendableOutputDescriptor_clone(arg);
27437         int64_t ret_ref = tag_ptr(ret_copy, true);
27438         return ret_ref;
27439 }
27440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27441         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
27442         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
27443         return ret_conv;
27444 }
27445
27446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27447         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
27448         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27449         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
27450         int64_t ret_ref = tag_ptr(ret_copy, true);
27451         return ret_ref;
27452 }
27453
27454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
27455         LDKOutPoint outpoint_conv;
27456         outpoint_conv.inner = untag_ptr(outpoint);
27457         outpoint_conv.is_owned = ptr_is_owned(outpoint);
27458         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
27459         outpoint_conv = OutPoint_clone(&outpoint_conv);
27460         void* output_ptr = untag_ptr(output);
27461         CHECK_ACCESS(output_ptr);
27462         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
27463         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
27464         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27465         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
27466         int64_t ret_ref = tag_ptr(ret_copy, true);
27467         return ret_ref;
27468 }
27469
27470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27471         LDKDelayedPaymentOutputDescriptor a_conv;
27472         a_conv.inner = untag_ptr(a);
27473         a_conv.is_owned = ptr_is_owned(a);
27474         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27475         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
27476         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27477         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
27478         int64_t ret_ref = tag_ptr(ret_copy, true);
27479         return ret_ref;
27480 }
27481
27482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27483         LDKStaticPaymentOutputDescriptor a_conv;
27484         a_conv.inner = untag_ptr(a);
27485         a_conv.is_owned = ptr_is_owned(a);
27486         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27487         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
27488         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27489         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
27490         int64_t ret_ref = tag_ptr(ret_copy, true);
27491         return ret_ref;
27492 }
27493
27494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27495         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
27496         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
27497         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27498         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27499         CVec_u8Z_free(ret_var);
27500         return ret_arr;
27501 }
27502
27503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27504         LDKu8slice ser_ref;
27505         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27506         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27507         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
27508         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
27509         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27510         return tag_ptr(ret_conv, true);
27511 }
27512
27513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27514         if (!ptr_is_owned(this_ptr)) return;
27515         void* this_ptr_ptr = untag_ptr(this_ptr);
27516         CHECK_ACCESS(this_ptr_ptr);
27517         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
27518         FREE(untag_ptr(this_ptr));
27519         BaseSign_free(this_ptr_conv);
27520 }
27521
27522 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
27523         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27524         *ret_ret = Sign_clone(arg);
27525         return tag_ptr(ret_ret, true);
27526 }
27527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27528         void* arg_ptr = untag_ptr(arg);
27529         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
27530         LDKSign* arg_conv = (LDKSign*)arg_ptr;
27531         int64_t ret_conv = Sign_clone_ptr(arg_conv);
27532         return ret_conv;
27533 }
27534
27535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27536         void* orig_ptr = untag_ptr(orig);
27537         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
27538         LDKSign* orig_conv = (LDKSign*)orig_ptr;
27539         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27540         *ret_ret = Sign_clone(orig_conv);
27541         return tag_ptr(ret_ret, true);
27542 }
27543
27544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27545         if (!ptr_is_owned(this_ptr)) return;
27546         void* this_ptr_ptr = untag_ptr(this_ptr);
27547         CHECK_ACCESS(this_ptr_ptr);
27548         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
27549         FREE(untag_ptr(this_ptr));
27550         Sign_free(this_ptr_conv);
27551 }
27552
27553 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27554         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
27555         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
27556         return ret_conv;
27557 }
27558
27559 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
27560         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
27561         return ret_conv;
27562 }
27563
27564 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
27565         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
27566         return ret_conv;
27567 }
27568
27569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27570         if (!ptr_is_owned(this_ptr)) return;
27571         void* this_ptr_ptr = untag_ptr(this_ptr);
27572         CHECK_ACCESS(this_ptr_ptr);
27573         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
27574         FREE(untag_ptr(this_ptr));
27575         KeysInterface_free(this_ptr_conv);
27576 }
27577
27578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27579         LDKInMemorySigner this_obj_conv;
27580         this_obj_conv.inner = untag_ptr(this_obj);
27581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27583         InMemorySigner_free(this_obj_conv);
27584 }
27585
27586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27587         LDKInMemorySigner this_ptr_conv;
27588         this_ptr_conv.inner = untag_ptr(this_ptr);
27589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27591         this_ptr_conv.is_owned = false;
27592         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27593         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
27594         return ret_arr;
27595 }
27596
27597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27598         LDKInMemorySigner this_ptr_conv;
27599         this_ptr_conv.inner = untag_ptr(this_ptr);
27600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27602         this_ptr_conv.is_owned = false;
27603         LDKSecretKey val_ref;
27604         CHECK((*env)->GetArrayLength(env, val) == 32);
27605         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27606         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
27607 }
27608
27609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27610         LDKInMemorySigner this_ptr_conv;
27611         this_ptr_conv.inner = untag_ptr(this_ptr);
27612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27614         this_ptr_conv.is_owned = false;
27615         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27616         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
27617         return ret_arr;
27618 }
27619
27620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27621         LDKInMemorySigner this_ptr_conv;
27622         this_ptr_conv.inner = untag_ptr(this_ptr);
27623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27625         this_ptr_conv.is_owned = false;
27626         LDKSecretKey val_ref;
27627         CHECK((*env)->GetArrayLength(env, val) == 32);
27628         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27629         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
27630 }
27631
27632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27633         LDKInMemorySigner this_ptr_conv;
27634         this_ptr_conv.inner = untag_ptr(this_ptr);
27635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27637         this_ptr_conv.is_owned = false;
27638         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27639         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
27640         return ret_arr;
27641 }
27642
27643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27644         LDKInMemorySigner this_ptr_conv;
27645         this_ptr_conv.inner = untag_ptr(this_ptr);
27646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27648         this_ptr_conv.is_owned = false;
27649         LDKSecretKey val_ref;
27650         CHECK((*env)->GetArrayLength(env, val) == 32);
27651         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27652         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
27653 }
27654
27655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27656         LDKInMemorySigner this_ptr_conv;
27657         this_ptr_conv.inner = untag_ptr(this_ptr);
27658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27660         this_ptr_conv.is_owned = false;
27661         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27662         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
27663         return ret_arr;
27664 }
27665
27666 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) {
27667         LDKInMemorySigner this_ptr_conv;
27668         this_ptr_conv.inner = untag_ptr(this_ptr);
27669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27671         this_ptr_conv.is_owned = false;
27672         LDKSecretKey val_ref;
27673         CHECK((*env)->GetArrayLength(env, val) == 32);
27674         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27675         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
27676 }
27677
27678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27679         LDKInMemorySigner this_ptr_conv;
27680         this_ptr_conv.inner = untag_ptr(this_ptr);
27681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27683         this_ptr_conv.is_owned = false;
27684         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27685         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
27686         return ret_arr;
27687 }
27688
27689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27690         LDKInMemorySigner this_ptr_conv;
27691         this_ptr_conv.inner = untag_ptr(this_ptr);
27692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27694         this_ptr_conv.is_owned = false;
27695         LDKSecretKey val_ref;
27696         CHECK((*env)->GetArrayLength(env, val) == 32);
27697         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27698         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
27699 }
27700
27701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
27702         LDKInMemorySigner this_ptr_conv;
27703         this_ptr_conv.inner = untag_ptr(this_ptr);
27704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27706         this_ptr_conv.is_owned = false;
27707         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27708         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
27709         return ret_arr;
27710 }
27711
27712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27713         LDKInMemorySigner this_ptr_conv;
27714         this_ptr_conv.inner = untag_ptr(this_ptr);
27715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27717         this_ptr_conv.is_owned = false;
27718         LDKThirtyTwoBytes val_ref;
27719         CHECK((*env)->GetArrayLength(env, val) == 32);
27720         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27721         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
27722 }
27723
27724 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
27725         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
27726         int64_t ret_ref = 0;
27727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27729         return ret_ref;
27730 }
27731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27732         LDKInMemorySigner arg_conv;
27733         arg_conv.inner = untag_ptr(arg);
27734         arg_conv.is_owned = ptr_is_owned(arg);
27735         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27736         arg_conv.is_owned = false;
27737         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
27738         return ret_conv;
27739 }
27740
27741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27742         LDKInMemorySigner orig_conv;
27743         orig_conv.inner = untag_ptr(orig);
27744         orig_conv.is_owned = ptr_is_owned(orig);
27745         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27746         orig_conv.is_owned = false;
27747         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
27748         int64_t ret_ref = 0;
27749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27751         return ret_ref;
27752 }
27753
27754 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) {
27755         LDKSecretKey node_secret_ref;
27756         CHECK((*env)->GetArrayLength(env, node_secret) == 32);
27757         (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
27758         LDKSecretKey funding_key_ref;
27759         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
27760         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
27761         LDKSecretKey revocation_base_key_ref;
27762         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
27763         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
27764         LDKSecretKey payment_key_ref;
27765         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
27766         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
27767         LDKSecretKey delayed_payment_base_key_ref;
27768         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
27769         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
27770         LDKSecretKey htlc_base_key_ref;
27771         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
27772         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
27773         LDKThirtyTwoBytes commitment_seed_ref;
27774         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
27775         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
27776         LDKThirtyTwoBytes channel_keys_id_ref;
27777         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
27778         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
27779         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);
27780         int64_t ret_ref = 0;
27781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27783         return ret_ref;
27784 }
27785
27786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
27787         LDKInMemorySigner this_arg_conv;
27788         this_arg_conv.inner = untag_ptr(this_arg);
27789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27791         this_arg_conv.is_owned = false;
27792         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
27793         int64_t ret_ref = 0;
27794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27796         return ret_ref;
27797 }
27798
27799 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27800         LDKInMemorySigner this_arg_conv;
27801         this_arg_conv.inner = untag_ptr(this_arg);
27802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27804         this_arg_conv.is_owned = false;
27805         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27806         return ret_conv;
27807 }
27808
27809 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27810         LDKInMemorySigner this_arg_conv;
27811         this_arg_conv.inner = untag_ptr(this_arg);
27812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27814         this_arg_conv.is_owned = false;
27815         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27816         return ret_conv;
27817 }
27818
27819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
27820         LDKInMemorySigner this_arg_conv;
27821         this_arg_conv.inner = untag_ptr(this_arg);
27822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27824         this_arg_conv.is_owned = false;
27825         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
27826         return ret_conv;
27827 }
27828
27829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
27830         LDKInMemorySigner this_arg_conv;
27831         this_arg_conv.inner = untag_ptr(this_arg);
27832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27834         this_arg_conv.is_owned = false;
27835         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27836         int64_t ret_ref = 0;
27837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27839         return ret_ref;
27840 }
27841
27842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
27843         LDKInMemorySigner this_arg_conv;
27844         this_arg_conv.inner = untag_ptr(this_arg);
27845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27847         this_arg_conv.is_owned = false;
27848         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27849         int64_t ret_ref = 0;
27850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27852         return ret_ref;
27853 }
27854
27855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
27856         LDKInMemorySigner this_arg_conv;
27857         this_arg_conv.inner = untag_ptr(this_arg);
27858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27860         this_arg_conv.is_owned = false;
27861         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
27862         return ret_conv;
27863 }
27864
27865 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) {
27866         LDKInMemorySigner this_arg_conv;
27867         this_arg_conv.inner = untag_ptr(this_arg);
27868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27870         this_arg_conv.is_owned = false;
27871         LDKTransaction spend_tx_ref;
27872         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27873         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27874         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27875         spend_tx_ref.data_is_owned = true;
27876         LDKStaticPaymentOutputDescriptor descriptor_conv;
27877         descriptor_conv.inner = untag_ptr(descriptor);
27878         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27879         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27880         descriptor_conv.is_owned = false;
27881         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27882         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27883         return tag_ptr(ret_conv, true);
27884 }
27885
27886 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) {
27887         LDKInMemorySigner this_arg_conv;
27888         this_arg_conv.inner = untag_ptr(this_arg);
27889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27891         this_arg_conv.is_owned = false;
27892         LDKTransaction spend_tx_ref;
27893         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27894         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27895         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27896         spend_tx_ref.data_is_owned = true;
27897         LDKDelayedPaymentOutputDescriptor descriptor_conv;
27898         descriptor_conv.inner = untag_ptr(descriptor);
27899         descriptor_conv.is_owned = ptr_is_owned(descriptor);
27900         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27901         descriptor_conv.is_owned = false;
27902         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27903         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27904         return tag_ptr(ret_conv, true);
27905 }
27906
27907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
27908         LDKInMemorySigner this_arg_conv;
27909         this_arg_conv.inner = untag_ptr(this_arg);
27910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27912         this_arg_conv.is_owned = false;
27913         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
27914         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
27915         return tag_ptr(ret_ret, true);
27916 }
27917
27918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
27919         LDKInMemorySigner this_arg_conv;
27920         this_arg_conv.inner = untag_ptr(this_arg);
27921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27923         this_arg_conv.is_owned = false;
27924         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27925         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
27926         return tag_ptr(ret_ret, true);
27927 }
27928
27929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
27930         LDKInMemorySigner obj_conv;
27931         obj_conv.inner = untag_ptr(obj);
27932         obj_conv.is_owned = ptr_is_owned(obj);
27933         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27934         obj_conv.is_owned = false;
27935         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27936         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27937         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27938         CVec_u8Z_free(ret_var);
27939         return ret_arr;
27940 }
27941
27942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
27943         LDKu8slice ser_ref;
27944         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27945         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27946         LDKSecretKey arg_ref;
27947         CHECK((*env)->GetArrayLength(env, arg) == 32);
27948         (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
27949         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27950         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
27951         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27952         return tag_ptr(ret_conv, true);
27953 }
27954
27955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27956         LDKKeysManager this_obj_conv;
27957         this_obj_conv.inner = untag_ptr(this_obj);
27958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27960         KeysManager_free(this_obj_conv);
27961 }
27962
27963 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) {
27964         unsigned char seed_arr[32];
27965         CHECK((*env)->GetArrayLength(env, seed) == 32);
27966         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27967         unsigned char (*seed_ref)[32] = &seed_arr;
27968         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27969         int64_t ret_ref = 0;
27970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27972         return ret_ref;
27973 }
27974
27975 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) {
27976         LDKKeysManager this_arg_conv;
27977         this_arg_conv.inner = untag_ptr(this_arg);
27978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27980         this_arg_conv.is_owned = false;
27981         unsigned char params_arr[32];
27982         CHECK((*env)->GetArrayLength(env, params) == 32);
27983         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27984         unsigned char (*params_ref)[32] = &params_arr;
27985         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27986         int64_t ret_ref = 0;
27987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27989         return ret_ref;
27990 }
27991
27992 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) {
27993         LDKKeysManager this_arg_conv;
27994         this_arg_conv.inner = untag_ptr(this_arg);
27995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27997         this_arg_conv.is_owned = false;
27998         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27999         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28000         if (descriptors_constr.datalen > 0)
28001                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28002         else
28003                 descriptors_constr.data = NULL;
28004         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28005         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28006                 int64_t descriptors_conv_27 = descriptors_vals[b];
28007                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
28008                 CHECK_ACCESS(descriptors_conv_27_ptr);
28009                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28010                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
28011                 descriptors_constr.data[b] = descriptors_conv_27_conv;
28012         }
28013         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28014         LDKCVec_TxOutZ outputs_constr;
28015         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28016         if (outputs_constr.datalen > 0)
28017                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28018         else
28019                 outputs_constr.data = NULL;
28020         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28021         for (size_t h = 0; h < outputs_constr.datalen; h++) {
28022                 int64_t outputs_conv_7 = outputs_vals[h];
28023                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
28024                 CHECK_ACCESS(outputs_conv_7_ptr);
28025                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28026                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
28027                 outputs_constr.data[h] = outputs_conv_7_conv;
28028         }
28029         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28030         LDKCVec_u8Z change_destination_script_ref;
28031         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28032         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28033         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28034         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28035         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28036         return tag_ptr(ret_conv, true);
28037 }
28038
28039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28040         LDKKeysManager this_arg_conv;
28041         this_arg_conv.inner = untag_ptr(this_arg);
28042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28044         this_arg_conv.is_owned = false;
28045         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28046         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
28047         return tag_ptr(ret_ret, true);
28048 }
28049
28050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28051         LDKPhantomKeysManager this_obj_conv;
28052         this_obj_conv.inner = untag_ptr(this_obj);
28053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28055         PhantomKeysManager_free(this_obj_conv);
28056 }
28057
28058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
28059         LDKPhantomKeysManager this_arg_conv;
28060         this_arg_conv.inner = untag_ptr(this_arg);
28061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28063         this_arg_conv.is_owned = false;
28064         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
28065         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
28066         return tag_ptr(ret_ret, true);
28067 }
28068
28069 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) {
28070         unsigned char seed_arr[32];
28071         CHECK((*env)->GetArrayLength(env, seed) == 32);
28072         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
28073         unsigned char (*seed_ref)[32] = &seed_arr;
28074         unsigned char cross_node_seed_arr[32];
28075         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
28076         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
28077         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
28078         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
28079         int64_t ret_ref = 0;
28080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28082         return ret_ref;
28083 }
28084
28085 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) {
28086         LDKPhantomKeysManager this_arg_conv;
28087         this_arg_conv.inner = untag_ptr(this_arg);
28088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28090         this_arg_conv.is_owned = false;
28091         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
28092         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
28093         if (descriptors_constr.datalen > 0)
28094                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
28095         else
28096                 descriptors_constr.data = NULL;
28097         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
28098         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
28099                 int64_t descriptors_conv_27 = descriptors_vals[b];
28100                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
28101                 CHECK_ACCESS(descriptors_conv_27_ptr);
28102                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
28103                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
28104                 descriptors_constr.data[b] = descriptors_conv_27_conv;
28105         }
28106         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
28107         LDKCVec_TxOutZ outputs_constr;
28108         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
28109         if (outputs_constr.datalen > 0)
28110                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
28111         else
28112                 outputs_constr.data = NULL;
28113         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
28114         for (size_t h = 0; h < outputs_constr.datalen; h++) {
28115                 int64_t outputs_conv_7 = outputs_vals[h];
28116                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
28117                 CHECK_ACCESS(outputs_conv_7_ptr);
28118                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
28119                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
28120                 outputs_constr.data[h] = outputs_conv_7_conv;
28121         }
28122         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
28123         LDKCVec_u8Z change_destination_script_ref;
28124         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
28125         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
28126         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
28127         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
28128         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
28129         return tag_ptr(ret_conv, true);
28130 }
28131
28132 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) {
28133         LDKPhantomKeysManager this_arg_conv;
28134         this_arg_conv.inner = untag_ptr(this_arg);
28135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28137         this_arg_conv.is_owned = false;
28138         unsigned char params_arr[32];
28139         CHECK((*env)->GetArrayLength(env, params) == 32);
28140         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
28141         unsigned char (*params_ref)[32] = &params_arr;
28142         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
28143         int64_t ret_ref = 0;
28144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28146         return ret_ref;
28147 }
28148
28149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28150         LDKChannelManager this_obj_conv;
28151         this_obj_conv.inner = untag_ptr(this_obj);
28152         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28154         ChannelManager_free(this_obj_conv);
28155 }
28156
28157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28158         LDKChainParameters this_obj_conv;
28159         this_obj_conv.inner = untag_ptr(this_obj);
28160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28162         ChainParameters_free(this_obj_conv);
28163 }
28164
28165 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
28166         LDKChainParameters this_ptr_conv;
28167         this_ptr_conv.inner = untag_ptr(this_ptr);
28168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28170         this_ptr_conv.is_owned = false;
28171         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
28172         return ret_conv;
28173 }
28174
28175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
28176         LDKChainParameters this_ptr_conv;
28177         this_ptr_conv.inner = untag_ptr(this_ptr);
28178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28180         this_ptr_conv.is_owned = false;
28181         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
28182         ChainParameters_set_network(&this_ptr_conv, val_conv);
28183 }
28184
28185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
28186         LDKChainParameters this_ptr_conv;
28187         this_ptr_conv.inner = untag_ptr(this_ptr);
28188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28190         this_ptr_conv.is_owned = false;
28191         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
28192         int64_t ret_ref = 0;
28193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28195         return ret_ref;
28196 }
28197
28198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28199         LDKChainParameters this_ptr_conv;
28200         this_ptr_conv.inner = untag_ptr(this_ptr);
28201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28203         this_ptr_conv.is_owned = false;
28204         LDKBestBlock val_conv;
28205         val_conv.inner = untag_ptr(val);
28206         val_conv.is_owned = ptr_is_owned(val);
28207         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28208         val_conv = BestBlock_clone(&val_conv);
28209         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
28210 }
28211
28212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
28213         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
28214         LDKBestBlock best_block_arg_conv;
28215         best_block_arg_conv.inner = untag_ptr(best_block_arg);
28216         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
28217         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
28218         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
28219         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
28220         int64_t ret_ref = 0;
28221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28223         return ret_ref;
28224 }
28225
28226 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
28227         LDKChainParameters ret_var = ChainParameters_clone(arg);
28228         int64_t ret_ref = 0;
28229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28231         return ret_ref;
28232 }
28233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28234         LDKChainParameters arg_conv;
28235         arg_conv.inner = untag_ptr(arg);
28236         arg_conv.is_owned = ptr_is_owned(arg);
28237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28238         arg_conv.is_owned = false;
28239         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
28240         return ret_conv;
28241 }
28242
28243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28244         LDKChainParameters orig_conv;
28245         orig_conv.inner = untag_ptr(orig);
28246         orig_conv.is_owned = ptr_is_owned(orig);
28247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28248         orig_conv.is_owned = false;
28249         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
28250         int64_t ret_ref = 0;
28251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28253         return ret_ref;
28254 }
28255
28256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28257         LDKCounterpartyForwardingInfo this_obj_conv;
28258         this_obj_conv.inner = untag_ptr(this_obj);
28259         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28261         CounterpartyForwardingInfo_free(this_obj_conv);
28262 }
28263
28264 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28265         LDKCounterpartyForwardingInfo this_ptr_conv;
28266         this_ptr_conv.inner = untag_ptr(this_ptr);
28267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28269         this_ptr_conv.is_owned = false;
28270         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
28271         return ret_conv;
28272 }
28273
28274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28275         LDKCounterpartyForwardingInfo 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         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
28281 }
28282
28283 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
28284         LDKCounterpartyForwardingInfo this_ptr_conv;
28285         this_ptr_conv.inner = untag_ptr(this_ptr);
28286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28288         this_ptr_conv.is_owned = false;
28289         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
28290         return ret_conv;
28291 }
28292
28293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28294         LDKCounterpartyForwardingInfo this_ptr_conv;
28295         this_ptr_conv.inner = untag_ptr(this_ptr);
28296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28298         this_ptr_conv.is_owned = false;
28299         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
28300 }
28301
28302 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
28303         LDKCounterpartyForwardingInfo this_ptr_conv;
28304         this_ptr_conv.inner = untag_ptr(this_ptr);
28305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28307         this_ptr_conv.is_owned = false;
28308         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
28309         return ret_conv;
28310 }
28311
28312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28313         LDKCounterpartyForwardingInfo this_ptr_conv;
28314         this_ptr_conv.inner = untag_ptr(this_ptr);
28315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28317         this_ptr_conv.is_owned = false;
28318         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
28319 }
28320
28321 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) {
28322         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
28323         int64_t ret_ref = 0;
28324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28326         return ret_ref;
28327 }
28328
28329 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
28330         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
28331         int64_t ret_ref = 0;
28332         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28333         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28334         return ret_ref;
28335 }
28336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28337         LDKCounterpartyForwardingInfo arg_conv;
28338         arg_conv.inner = untag_ptr(arg);
28339         arg_conv.is_owned = ptr_is_owned(arg);
28340         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28341         arg_conv.is_owned = false;
28342         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
28343         return ret_conv;
28344 }
28345
28346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28347         LDKCounterpartyForwardingInfo orig_conv;
28348         orig_conv.inner = untag_ptr(orig);
28349         orig_conv.is_owned = ptr_is_owned(orig);
28350         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28351         orig_conv.is_owned = false;
28352         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
28353         int64_t ret_ref = 0;
28354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28356         return ret_ref;
28357 }
28358
28359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28360         LDKChannelCounterparty this_obj_conv;
28361         this_obj_conv.inner = untag_ptr(this_obj);
28362         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28364         ChannelCounterparty_free(this_obj_conv);
28365 }
28366
28367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28368         LDKChannelCounterparty this_ptr_conv;
28369         this_ptr_conv.inner = untag_ptr(this_ptr);
28370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28372         this_ptr_conv.is_owned = false;
28373         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28374         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
28375         return ret_arr;
28376 }
28377
28378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28379         LDKChannelCounterparty this_ptr_conv;
28380         this_ptr_conv.inner = untag_ptr(this_ptr);
28381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28383         this_ptr_conv.is_owned = false;
28384         LDKPublicKey val_ref;
28385         CHECK((*env)->GetArrayLength(env, val) == 33);
28386         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28387         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
28388 }
28389
28390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28391         LDKChannelCounterparty 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         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
28397         int64_t ret_ref = 0;
28398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28400         return ret_ref;
28401 }
28402
28403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28404         LDKChannelCounterparty this_ptr_conv;
28405         this_ptr_conv.inner = untag_ptr(this_ptr);
28406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28408         this_ptr_conv.is_owned = false;
28409         LDKInitFeatures val_conv;
28410         val_conv.inner = untag_ptr(val);
28411         val_conv.is_owned = ptr_is_owned(val);
28412         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28413         val_conv = InitFeatures_clone(&val_conv);
28414         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
28415 }
28416
28417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28418         LDKChannelCounterparty this_ptr_conv;
28419         this_ptr_conv.inner = untag_ptr(this_ptr);
28420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28422         this_ptr_conv.is_owned = false;
28423         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
28424         return ret_conv;
28425 }
28426
28427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28428         LDKChannelCounterparty this_ptr_conv;
28429         this_ptr_conv.inner = untag_ptr(this_ptr);
28430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28432         this_ptr_conv.is_owned = false;
28433         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
28434 }
28435
28436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28437         LDKChannelCounterparty this_ptr_conv;
28438         this_ptr_conv.inner = untag_ptr(this_ptr);
28439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28441         this_ptr_conv.is_owned = false;
28442         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
28443         int64_t ret_ref = 0;
28444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28446         return ret_ref;
28447 }
28448
28449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28450         LDKChannelCounterparty this_ptr_conv;
28451         this_ptr_conv.inner = untag_ptr(this_ptr);
28452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28454         this_ptr_conv.is_owned = false;
28455         LDKCounterpartyForwardingInfo val_conv;
28456         val_conv.inner = untag_ptr(val);
28457         val_conv.is_owned = ptr_is_owned(val);
28458         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28459         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
28460         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
28461 }
28462
28463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28464         LDKChannelCounterparty this_ptr_conv;
28465         this_ptr_conv.inner = untag_ptr(this_ptr);
28466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28468         this_ptr_conv.is_owned = false;
28469         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28470         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
28471         int64_t ret_ref = tag_ptr(ret_copy, true);
28472         return ret_ref;
28473 }
28474
28475 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) {
28476         LDKChannelCounterparty this_ptr_conv;
28477         this_ptr_conv.inner = untag_ptr(this_ptr);
28478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28480         this_ptr_conv.is_owned = false;
28481         void* val_ptr = untag_ptr(val);
28482         CHECK_ACCESS(val_ptr);
28483         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28484         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28485         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
28486 }
28487
28488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28489         LDKChannelCounterparty this_ptr_conv;
28490         this_ptr_conv.inner = untag_ptr(this_ptr);
28491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28493         this_ptr_conv.is_owned = false;
28494         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28495         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
28496         int64_t ret_ref = tag_ptr(ret_copy, true);
28497         return ret_ref;
28498 }
28499
28500 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) {
28501         LDKChannelCounterparty this_ptr_conv;
28502         this_ptr_conv.inner = untag_ptr(this_ptr);
28503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28505         this_ptr_conv.is_owned = false;
28506         void* val_ptr = untag_ptr(val);
28507         CHECK_ACCESS(val_ptr);
28508         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28509         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28510         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
28511 }
28512
28513 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) {
28514         LDKPublicKey node_id_arg_ref;
28515         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
28516         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
28517         LDKInitFeatures features_arg_conv;
28518         features_arg_conv.inner = untag_ptr(features_arg);
28519         features_arg_conv.is_owned = ptr_is_owned(features_arg);
28520         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28521         features_arg_conv = InitFeatures_clone(&features_arg_conv);
28522         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
28523         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
28524         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
28525         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
28526         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
28527         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
28528         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
28529         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
28530         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
28531         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
28532         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
28533         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
28534         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
28535         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);
28536         int64_t ret_ref = 0;
28537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28539         return ret_ref;
28540 }
28541
28542 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
28543         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
28544         int64_t ret_ref = 0;
28545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28547         return ret_ref;
28548 }
28549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28550         LDKChannelCounterparty arg_conv;
28551         arg_conv.inner = untag_ptr(arg);
28552         arg_conv.is_owned = ptr_is_owned(arg);
28553         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28554         arg_conv.is_owned = false;
28555         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
28556         return ret_conv;
28557 }
28558
28559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28560         LDKChannelCounterparty orig_conv;
28561         orig_conv.inner = untag_ptr(orig);
28562         orig_conv.is_owned = ptr_is_owned(orig);
28563         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28564         orig_conv.is_owned = false;
28565         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
28566         int64_t ret_ref = 0;
28567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28569         return ret_ref;
28570 }
28571
28572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28573         LDKChannelDetails this_obj_conv;
28574         this_obj_conv.inner = untag_ptr(this_obj);
28575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28577         ChannelDetails_free(this_obj_conv);
28578 }
28579
28580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28581         LDKChannelDetails this_ptr_conv;
28582         this_ptr_conv.inner = untag_ptr(this_ptr);
28583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28585         this_ptr_conv.is_owned = false;
28586         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28587         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
28588         return ret_arr;
28589 }
28590
28591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28592         LDKChannelDetails this_ptr_conv;
28593         this_ptr_conv.inner = untag_ptr(this_ptr);
28594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28596         this_ptr_conv.is_owned = false;
28597         LDKThirtyTwoBytes val_ref;
28598         CHECK((*env)->GetArrayLength(env, val) == 32);
28599         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28600         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
28601 }
28602
28603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
28604         LDKChannelDetails this_ptr_conv;
28605         this_ptr_conv.inner = untag_ptr(this_ptr);
28606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28608         this_ptr_conv.is_owned = false;
28609         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
28610         int64_t ret_ref = 0;
28611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28613         return ret_ref;
28614 }
28615
28616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28617         LDKChannelDetails this_ptr_conv;
28618         this_ptr_conv.inner = untag_ptr(this_ptr);
28619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28621         this_ptr_conv.is_owned = false;
28622         LDKChannelCounterparty val_conv;
28623         val_conv.inner = untag_ptr(val);
28624         val_conv.is_owned = ptr_is_owned(val);
28625         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28626         val_conv = ChannelCounterparty_clone(&val_conv);
28627         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
28628 }
28629
28630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
28631         LDKChannelDetails this_ptr_conv;
28632         this_ptr_conv.inner = untag_ptr(this_ptr);
28633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28635         this_ptr_conv.is_owned = false;
28636         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
28637         int64_t ret_ref = 0;
28638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28640         return ret_ref;
28641 }
28642
28643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28644         LDKChannelDetails this_ptr_conv;
28645         this_ptr_conv.inner = untag_ptr(this_ptr);
28646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28648         this_ptr_conv.is_owned = false;
28649         LDKOutPoint val_conv;
28650         val_conv.inner = untag_ptr(val);
28651         val_conv.is_owned = ptr_is_owned(val);
28652         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28653         val_conv = OutPoint_clone(&val_conv);
28654         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
28655 }
28656
28657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
28658         LDKChannelDetails this_ptr_conv;
28659         this_ptr_conv.inner = untag_ptr(this_ptr);
28660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28662         this_ptr_conv.is_owned = false;
28663         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28664         int64_t ret_ref = 0;
28665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28667         return ret_ref;
28668 }
28669
28670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28671         LDKChannelDetails this_ptr_conv;
28672         this_ptr_conv.inner = untag_ptr(this_ptr);
28673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28675         this_ptr_conv.is_owned = false;
28676         LDKChannelTypeFeatures val_conv;
28677         val_conv.inner = untag_ptr(val);
28678         val_conv.is_owned = ptr_is_owned(val);
28679         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28680         val_conv = ChannelTypeFeatures_clone(&val_conv);
28681         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28682 }
28683
28684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28685         LDKChannelDetails this_ptr_conv;
28686         this_ptr_conv.inner = untag_ptr(this_ptr);
28687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28689         this_ptr_conv.is_owned = false;
28690         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28691         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28692         int64_t ret_ref = tag_ptr(ret_copy, true);
28693         return ret_ref;
28694 }
28695
28696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28697         LDKChannelDetails this_ptr_conv;
28698         this_ptr_conv.inner = untag_ptr(this_ptr);
28699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28701         this_ptr_conv.is_owned = false;
28702         void* val_ptr = untag_ptr(val);
28703         CHECK_ACCESS(val_ptr);
28704         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28705         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28706         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28707 }
28708
28709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28716         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
28717         int64_t ret_ref = tag_ptr(ret_copy, true);
28718         return ret_ref;
28719 }
28720
28721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28722         LDKChannelDetails this_ptr_conv;
28723         this_ptr_conv.inner = untag_ptr(this_ptr);
28724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28726         this_ptr_conv.is_owned = false;
28727         void* val_ptr = untag_ptr(val);
28728         CHECK_ACCESS(val_ptr);
28729         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28730         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28731         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
28732 }
28733
28734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28741         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
28742         int64_t ret_ref = tag_ptr(ret_copy, true);
28743         return ret_ref;
28744 }
28745
28746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28747         LDKChannelDetails this_ptr_conv;
28748         this_ptr_conv.inner = untag_ptr(this_ptr);
28749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28751         this_ptr_conv.is_owned = false;
28752         void* val_ptr = untag_ptr(val);
28753         CHECK_ACCESS(val_ptr);
28754         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28755         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28756         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
28757 }
28758
28759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28760         LDKChannelDetails this_ptr_conv;
28761         this_ptr_conv.inner = untag_ptr(this_ptr);
28762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28764         this_ptr_conv.is_owned = false;
28765         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
28766         return ret_conv;
28767 }
28768
28769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28770         LDKChannelDetails this_ptr_conv;
28771         this_ptr_conv.inner = untag_ptr(this_ptr);
28772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28774         this_ptr_conv.is_owned = false;
28775         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
28776 }
28777
28778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28779         LDKChannelDetails this_ptr_conv;
28780         this_ptr_conv.inner = untag_ptr(this_ptr);
28781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28783         this_ptr_conv.is_owned = false;
28784         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28785         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
28786         int64_t ret_ref = tag_ptr(ret_copy, true);
28787         return ret_ref;
28788 }
28789
28790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28791         LDKChannelDetails this_ptr_conv;
28792         this_ptr_conv.inner = untag_ptr(this_ptr);
28793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28795         this_ptr_conv.is_owned = false;
28796         void* val_ptr = untag_ptr(val);
28797         CHECK_ACCESS(val_ptr);
28798         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28799         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
28800         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28801 }
28802
28803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28804         LDKChannelDetails this_ptr_conv;
28805         this_ptr_conv.inner = untag_ptr(this_ptr);
28806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28808         this_ptr_conv.is_owned = false;
28809         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
28810         return ret_conv;
28811 }
28812
28813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28814         LDKChannelDetails this_ptr_conv;
28815         this_ptr_conv.inner = untag_ptr(this_ptr);
28816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28818         this_ptr_conv.is_owned = false;
28819         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
28820 }
28821
28822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28823         LDKChannelDetails this_ptr_conv;
28824         this_ptr_conv.inner = untag_ptr(this_ptr);
28825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28827         this_ptr_conv.is_owned = false;
28828         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28829         return ret_conv;
28830 }
28831
28832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28833         LDKChannelDetails this_ptr_conv;
28834         this_ptr_conv.inner = untag_ptr(this_ptr);
28835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28837         this_ptr_conv.is_owned = false;
28838         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28839 }
28840
28841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28842         LDKChannelDetails this_ptr_conv;
28843         this_ptr_conv.inner = untag_ptr(this_ptr);
28844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28846         this_ptr_conv.is_owned = false;
28847         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28848         return ret_conv;
28849 }
28850
28851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28852         LDKChannelDetails this_ptr_conv;
28853         this_ptr_conv.inner = untag_ptr(this_ptr);
28854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28856         this_ptr_conv.is_owned = false;
28857         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28858 }
28859
28860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
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         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
28867         return ret_conv;
28868 }
28869
28870 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) {
28871         LDKChannelDetails this_ptr_conv;
28872         this_ptr_conv.inner = untag_ptr(this_ptr);
28873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28875         this_ptr_conv.is_owned = false;
28876         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
28877 }
28878
28879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28880         LDKChannelDetails this_ptr_conv;
28881         this_ptr_conv.inner = untag_ptr(this_ptr);
28882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28884         this_ptr_conv.is_owned = false;
28885         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28886         return ret_conv;
28887 }
28888
28889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28890         LDKChannelDetails this_ptr_conv;
28891         this_ptr_conv.inner = untag_ptr(this_ptr);
28892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28894         this_ptr_conv.is_owned = false;
28895         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28896 }
28897
28898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
28899         LDKChannelDetails this_ptr_conv;
28900         this_ptr_conv.inner = untag_ptr(this_ptr);
28901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28903         this_ptr_conv.is_owned = false;
28904         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28905         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28906         int64_t ret_ref = tag_ptr(ret_copy, true);
28907         return ret_ref;
28908 }
28909
28910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28911         LDKChannelDetails this_ptr_conv;
28912         this_ptr_conv.inner = untag_ptr(this_ptr);
28913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28915         this_ptr_conv.is_owned = false;
28916         void* val_ptr = untag_ptr(val);
28917         CHECK_ACCESS(val_ptr);
28918         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28919         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
28920         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28921 }
28922
28923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28924         LDKChannelDetails this_ptr_conv;
28925         this_ptr_conv.inner = untag_ptr(this_ptr);
28926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28928         this_ptr_conv.is_owned = false;
28929         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28930         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28931         int64_t ret_ref = tag_ptr(ret_copy, true);
28932         return ret_ref;
28933 }
28934
28935 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) {
28936         LDKChannelDetails this_ptr_conv;
28937         this_ptr_conv.inner = untag_ptr(this_ptr);
28938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28940         this_ptr_conv.is_owned = false;
28941         void* val_ptr = untag_ptr(val);
28942         CHECK_ACCESS(val_ptr);
28943         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28944         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
28945         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28946 }
28947
28948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
28949         LDKChannelDetails this_ptr_conv;
28950         this_ptr_conv.inner = untag_ptr(this_ptr);
28951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28953         this_ptr_conv.is_owned = false;
28954         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28955         return ret_conv;
28956 }
28957
28958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28959         LDKChannelDetails this_ptr_conv;
28960         this_ptr_conv.inner = untag_ptr(this_ptr);
28961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28963         this_ptr_conv.is_owned = false;
28964         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28965 }
28966
28967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
28968         LDKChannelDetails this_ptr_conv;
28969         this_ptr_conv.inner = untag_ptr(this_ptr);
28970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28972         this_ptr_conv.is_owned = false;
28973         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
28974         return ret_conv;
28975 }
28976
28977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28978         LDKChannelDetails this_ptr_conv;
28979         this_ptr_conv.inner = untag_ptr(this_ptr);
28980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28982         this_ptr_conv.is_owned = false;
28983         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
28984 }
28985
28986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
28987         LDKChannelDetails this_ptr_conv;
28988         this_ptr_conv.inner = untag_ptr(this_ptr);
28989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28991         this_ptr_conv.is_owned = false;
28992         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28993         return ret_conv;
28994 }
28995
28996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28997         LDKChannelDetails this_ptr_conv;
28998         this_ptr_conv.inner = untag_ptr(this_ptr);
28999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29001         this_ptr_conv.is_owned = false;
29002         ChannelDetails_set_is_usable(&this_ptr_conv, val);
29003 }
29004
29005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
29006         LDKChannelDetails this_ptr_conv;
29007         this_ptr_conv.inner = untag_ptr(this_ptr);
29008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29010         this_ptr_conv.is_owned = false;
29011         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
29012         return ret_conv;
29013 }
29014
29015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
29016         LDKChannelDetails this_ptr_conv;
29017         this_ptr_conv.inner = untag_ptr(this_ptr);
29018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29020         this_ptr_conv.is_owned = false;
29021         ChannelDetails_set_is_public(&this_ptr_conv, val);
29022 }
29023
29024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29025         LDKChannelDetails this_ptr_conv;
29026         this_ptr_conv.inner = untag_ptr(this_ptr);
29027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29029         this_ptr_conv.is_owned = false;
29030         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29031         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
29032         int64_t ret_ref = tag_ptr(ret_copy, true);
29033         return ret_ref;
29034 }
29035
29036 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) {
29037         LDKChannelDetails this_ptr_conv;
29038         this_ptr_conv.inner = untag_ptr(this_ptr);
29039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29041         this_ptr_conv.is_owned = false;
29042         void* val_ptr = untag_ptr(val);
29043         CHECK_ACCESS(val_ptr);
29044         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29045         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29046         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
29047 }
29048
29049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29050         LDKChannelDetails this_ptr_conv;
29051         this_ptr_conv.inner = untag_ptr(this_ptr);
29052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29054         this_ptr_conv.is_owned = false;
29055         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29056         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
29057         int64_t ret_ref = tag_ptr(ret_copy, true);
29058         return ret_ref;
29059 }
29060
29061 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) {
29062         LDKChannelDetails this_ptr_conv;
29063         this_ptr_conv.inner = untag_ptr(this_ptr);
29064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29066         this_ptr_conv.is_owned = false;
29067         void* val_ptr = untag_ptr(val);
29068         CHECK_ACCESS(val_ptr);
29069         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29070         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29071         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
29072 }
29073
29074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
29075         LDKChannelDetails this_ptr_conv;
29076         this_ptr_conv.inner = untag_ptr(this_ptr);
29077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29079         this_ptr_conv.is_owned = false;
29080         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
29081         int64_t ret_ref = 0;
29082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29084         return ret_ref;
29085 }
29086
29087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29088         LDKChannelDetails this_ptr_conv;
29089         this_ptr_conv.inner = untag_ptr(this_ptr);
29090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29092         this_ptr_conv.is_owned = false;
29093         LDKChannelConfig val_conv;
29094         val_conv.inner = untag_ptr(val);
29095         val_conv.is_owned = ptr_is_owned(val);
29096         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29097         val_conv = ChannelConfig_clone(&val_conv);
29098         ChannelDetails_set_config(&this_ptr_conv, val_conv);
29099 }
29100
29101 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) {
29102         LDKThirtyTwoBytes channel_id_arg_ref;
29103         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29104         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29105         LDKChannelCounterparty counterparty_arg_conv;
29106         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
29107         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
29108         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
29109         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
29110         LDKOutPoint funding_txo_arg_conv;
29111         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
29112         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
29113         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
29114         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
29115         LDKChannelTypeFeatures channel_type_arg_conv;
29116         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
29117         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
29118         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
29119         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
29120         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
29121         CHECK_ACCESS(short_channel_id_arg_ptr);
29122         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
29123         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
29124         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
29125         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
29126         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
29127         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
29128         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
29129         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
29130         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
29131         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
29132         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
29133         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
29134         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
29135         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
29136         CHECK_ACCESS(confirmations_required_arg_ptr);
29137         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
29138         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
29139         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
29140         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
29141         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
29142         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
29143         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
29144         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
29145         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
29146         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
29147         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
29148         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
29149         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
29150         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
29151         LDKChannelConfig config_arg_conv;
29152         config_arg_conv.inner = untag_ptr(config_arg);
29153         config_arg_conv.is_owned = ptr_is_owned(config_arg);
29154         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
29155         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
29156         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);
29157         int64_t ret_ref = 0;
29158         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29159         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29160         return ret_ref;
29161 }
29162
29163 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
29164         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
29165         int64_t ret_ref = 0;
29166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29168         return ret_ref;
29169 }
29170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29171         LDKChannelDetails arg_conv;
29172         arg_conv.inner = untag_ptr(arg);
29173         arg_conv.is_owned = ptr_is_owned(arg);
29174         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29175         arg_conv.is_owned = false;
29176         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
29177         return ret_conv;
29178 }
29179
29180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29181         LDKChannelDetails orig_conv;
29182         orig_conv.inner = untag_ptr(orig);
29183         orig_conv.is_owned = ptr_is_owned(orig);
29184         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29185         orig_conv.is_owned = false;
29186         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
29187         int64_t ret_ref = 0;
29188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29190         return ret_ref;
29191 }
29192
29193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29194         LDKChannelDetails this_arg_conv;
29195         this_arg_conv.inner = untag_ptr(this_arg);
29196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29198         this_arg_conv.is_owned = false;
29199         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29200         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
29201         int64_t ret_ref = tag_ptr(ret_copy, true);
29202         return ret_ref;
29203 }
29204
29205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29206         LDKChannelDetails this_arg_conv;
29207         this_arg_conv.inner = untag_ptr(this_arg);
29208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29210         this_arg_conv.is_owned = false;
29211         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29212         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
29213         int64_t ret_ref = tag_ptr(ret_copy, true);
29214         return ret_ref;
29215 }
29216
29217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29218         if (!ptr_is_owned(this_ptr)) return;
29219         void* this_ptr_ptr = untag_ptr(this_ptr);
29220         CHECK_ACCESS(this_ptr_ptr);
29221         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
29222         FREE(untag_ptr(this_ptr));
29223         PaymentSendFailure_free(this_ptr_conv);
29224 }
29225
29226 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
29227         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29228         *ret_copy = PaymentSendFailure_clone(arg);
29229         int64_t ret_ref = tag_ptr(ret_copy, true);
29230         return ret_ref;
29231 }
29232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29233         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
29234         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
29235         return ret_conv;
29236 }
29237
29238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29239         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
29240         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29241         *ret_copy = PaymentSendFailure_clone(orig_conv);
29242         int64_t ret_ref = tag_ptr(ret_copy, true);
29243         return ret_ref;
29244 }
29245
29246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
29247         void* a_ptr = untag_ptr(a);
29248         CHECK_ACCESS(a_ptr);
29249         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
29250         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
29251         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29252         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
29253         int64_t ret_ref = tag_ptr(ret_copy, true);
29254         return ret_ref;
29255 }
29256
29257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
29258         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
29259         a_constr.datalen = (*env)->GetArrayLength(env, a);
29260         if (a_constr.datalen > 0)
29261                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29262         else
29263                 a_constr.data = NULL;
29264         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29265         for (size_t w = 0; w < a_constr.datalen; w++) {
29266                 int64_t a_conv_22 = a_vals[w];
29267                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
29268                 CHECK_ACCESS(a_conv_22_ptr);
29269                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
29270                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
29271                 a_constr.data[w] = a_conv_22_conv;
29272         }
29273         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29274         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29275         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
29276         int64_t ret_ref = tag_ptr(ret_copy, true);
29277         return ret_ref;
29278 }
29279
29280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
29281         LDKCVec_APIErrorZ a_constr;
29282         a_constr.datalen = (*env)->GetArrayLength(env, a);
29283         if (a_constr.datalen > 0)
29284                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
29285         else
29286                 a_constr.data = NULL;
29287         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
29288         for (size_t k = 0; k < a_constr.datalen; k++) {
29289                 int64_t a_conv_10 = a_vals[k];
29290                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
29291                 CHECK_ACCESS(a_conv_10_ptr);
29292                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
29293                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
29294                 a_constr.data[k] = a_conv_10_conv;
29295         }
29296         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
29297         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29298         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
29299         int64_t ret_ref = tag_ptr(ret_copy, true);
29300         return ret_ref;
29301 }
29302
29303 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) {
29304         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
29305         results_constr.datalen = (*env)->GetArrayLength(env, results);
29306         if (results_constr.datalen > 0)
29307                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
29308         else
29309                 results_constr.data = NULL;
29310         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
29311         for (size_t w = 0; w < results_constr.datalen; w++) {
29312                 int64_t results_conv_22 = results_vals[w];
29313                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
29314                 CHECK_ACCESS(results_conv_22_ptr);
29315                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
29316                 results_constr.data[w] = results_conv_22_conv;
29317         }
29318         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
29319         LDKRouteParameters failed_paths_retry_conv;
29320         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
29321         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
29322         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
29323         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
29324         LDKThirtyTwoBytes payment_id_ref;
29325         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29326         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29327         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
29328         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
29329         int64_t ret_ref = tag_ptr(ret_copy, true);
29330         return ret_ref;
29331 }
29332
29333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29334         LDKPhantomRouteHints this_obj_conv;
29335         this_obj_conv.inner = untag_ptr(this_obj);
29336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29338         PhantomRouteHints_free(this_obj_conv);
29339 }
29340
29341 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
29342         LDKPhantomRouteHints this_ptr_conv;
29343         this_ptr_conv.inner = untag_ptr(this_ptr);
29344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29346         this_ptr_conv.is_owned = false;
29347         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
29348         int64_tArray ret_arr = NULL;
29349         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29350         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29351         for (size_t q = 0; q < ret_var.datalen; q++) {
29352                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29353                 int64_t ret_conv_16_ref = 0;
29354                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29355                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29356                 ret_arr_ptr[q] = ret_conv_16_ref;
29357         }
29358         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29359         FREE(ret_var.data);
29360         return ret_arr;
29361 }
29362
29363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
29364         LDKPhantomRouteHints this_ptr_conv;
29365         this_ptr_conv.inner = untag_ptr(this_ptr);
29366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29368         this_ptr_conv.is_owned = false;
29369         LDKCVec_ChannelDetailsZ val_constr;
29370         val_constr.datalen = (*env)->GetArrayLength(env, val);
29371         if (val_constr.datalen > 0)
29372                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29373         else
29374                 val_constr.data = NULL;
29375         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
29376         for (size_t q = 0; q < val_constr.datalen; q++) {
29377                 int64_t val_conv_16 = val_vals[q];
29378                 LDKChannelDetails val_conv_16_conv;
29379                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
29380                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
29381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
29382                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
29383                 val_constr.data[q] = val_conv_16_conv;
29384         }
29385         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
29386         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
29387 }
29388
29389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
29390         LDKPhantomRouteHints this_ptr_conv;
29391         this_ptr_conv.inner = untag_ptr(this_ptr);
29392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29394         this_ptr_conv.is_owned = false;
29395         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
29396         return ret_conv;
29397 }
29398
29399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29400         LDKPhantomRouteHints this_ptr_conv;
29401         this_ptr_conv.inner = untag_ptr(this_ptr);
29402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29404         this_ptr_conv.is_owned = false;
29405         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
29406 }
29407
29408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29409         LDKPhantomRouteHints this_ptr_conv;
29410         this_ptr_conv.inner = untag_ptr(this_ptr);
29411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29413         this_ptr_conv.is_owned = false;
29414         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29415         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
29416         return ret_arr;
29417 }
29418
29419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29420         LDKPhantomRouteHints this_ptr_conv;
29421         this_ptr_conv.inner = untag_ptr(this_ptr);
29422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29424         this_ptr_conv.is_owned = false;
29425         LDKPublicKey val_ref;
29426         CHECK((*env)->GetArrayLength(env, val) == 33);
29427         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29428         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
29429 }
29430
29431 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) {
29432         LDKCVec_ChannelDetailsZ channels_arg_constr;
29433         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
29434         if (channels_arg_constr.datalen > 0)
29435                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
29436         else
29437                 channels_arg_constr.data = NULL;
29438         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
29439         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
29440                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
29441                 LDKChannelDetails channels_arg_conv_16_conv;
29442                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
29443                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
29444                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
29445                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
29446                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
29447         }
29448         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
29449         LDKPublicKey real_node_pubkey_arg_ref;
29450         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
29451         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
29452         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
29453         int64_t ret_ref = 0;
29454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29456         return ret_ref;
29457 }
29458
29459 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
29460         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
29461         int64_t ret_ref = 0;
29462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29464         return ret_ref;
29465 }
29466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29467         LDKPhantomRouteHints arg_conv;
29468         arg_conv.inner = untag_ptr(arg);
29469         arg_conv.is_owned = ptr_is_owned(arg);
29470         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29471         arg_conv.is_owned = false;
29472         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
29473         return ret_conv;
29474 }
29475
29476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29477         LDKPhantomRouteHints orig_conv;
29478         orig_conv.inner = untag_ptr(orig);
29479         orig_conv.is_owned = ptr_is_owned(orig);
29480         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29481         orig_conv.is_owned = false;
29482         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
29483         int64_t ret_ref = 0;
29484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29486         return ret_ref;
29487 }
29488
29489 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) {
29490         void* fee_est_ptr = untag_ptr(fee_est);
29491         CHECK_ACCESS(fee_est_ptr);
29492         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
29493         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
29494                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29495                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
29496         }
29497         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29498         CHECK_ACCESS(chain_monitor_ptr);
29499         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29500         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29501                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29502                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29503         }
29504         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
29505         CHECK_ACCESS(tx_broadcaster_ptr);
29506         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29507         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29508                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29509                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29510         }
29511         void* logger_ptr = untag_ptr(logger);
29512         CHECK_ACCESS(logger_ptr);
29513         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29514         if (logger_conv.free == LDKLogger_JCalls_free) {
29515                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29516                 LDKLogger_JCalls_cloned(&logger_conv);
29517         }
29518         void* keys_manager_ptr = untag_ptr(keys_manager);
29519         CHECK_ACCESS(keys_manager_ptr);
29520         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29521         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29522                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29523                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29524         }
29525         LDKUserConfig config_conv;
29526         config_conv.inner = untag_ptr(config);
29527         config_conv.is_owned = ptr_is_owned(config);
29528         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29529         config_conv = UserConfig_clone(&config_conv);
29530         LDKChainParameters params_conv;
29531         params_conv.inner = untag_ptr(params);
29532         params_conv.is_owned = ptr_is_owned(params);
29533         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
29534         params_conv = ChainParameters_clone(&params_conv);
29535         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
29536         int64_t ret_ref = 0;
29537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29539         return ret_ref;
29540 }
29541
29542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
29543         LDKChannelManager this_arg_conv;
29544         this_arg_conv.inner = untag_ptr(this_arg);
29545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29547         this_arg_conv.is_owned = false;
29548         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
29549         int64_t ret_ref = 0;
29550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29552         return ret_ref;
29553 }
29554
29555 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) {
29556         LDKChannelManager this_arg_conv;
29557         this_arg_conv.inner = untag_ptr(this_arg);
29558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29560         this_arg_conv.is_owned = false;
29561         LDKPublicKey their_network_key_ref;
29562         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
29563         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
29564         LDKUserConfig override_config_conv;
29565         override_config_conv.inner = untag_ptr(override_config);
29566         override_config_conv.is_owned = ptr_is_owned(override_config);
29567         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
29568         override_config_conv = UserConfig_clone(&override_config_conv);
29569         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
29570         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
29571         return tag_ptr(ret_conv, true);
29572 }
29573
29574 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29575         LDKChannelManager this_arg_conv;
29576         this_arg_conv.inner = untag_ptr(this_arg);
29577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29579         this_arg_conv.is_owned = false;
29580         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
29581         int64_tArray ret_arr = NULL;
29582         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29583         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29584         for (size_t q = 0; q < ret_var.datalen; q++) {
29585                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29586                 int64_t ret_conv_16_ref = 0;
29587                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29588                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29589                 ret_arr_ptr[q] = ret_conv_16_ref;
29590         }
29591         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29592         FREE(ret_var.data);
29593         return ret_arr;
29594 }
29595
29596 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29597         LDKChannelManager this_arg_conv;
29598         this_arg_conv.inner = untag_ptr(this_arg);
29599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29601         this_arg_conv.is_owned = false;
29602         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
29603         int64_tArray ret_arr = NULL;
29604         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29605         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29606         for (size_t q = 0; q < ret_var.datalen; q++) {
29607                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29608                 int64_t ret_conv_16_ref = 0;
29609                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29610                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
29611                 ret_arr_ptr[q] = ret_conv_16_ref;
29612         }
29613         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29614         FREE(ret_var.data);
29615         return ret_arr;
29616 }
29617
29618 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) {
29619         LDKChannelManager this_arg_conv;
29620         this_arg_conv.inner = untag_ptr(this_arg);
29621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29623         this_arg_conv.is_owned = false;
29624         unsigned char channel_id_arr[32];
29625         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29626         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29627         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29628         LDKPublicKey counterparty_node_id_ref;
29629         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29630         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29631         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29632         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29633         return tag_ptr(ret_conv, true);
29634 }
29635
29636 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) {
29637         LDKChannelManager this_arg_conv;
29638         this_arg_conv.inner = untag_ptr(this_arg);
29639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29641         this_arg_conv.is_owned = false;
29642         unsigned char channel_id_arr[32];
29643         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29644         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29645         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29646         LDKPublicKey counterparty_node_id_ref;
29647         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29648         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29649         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29650         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
29651         return tag_ptr(ret_conv, true);
29652 }
29653
29654 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) {
29655         LDKChannelManager this_arg_conv;
29656         this_arg_conv.inner = untag_ptr(this_arg);
29657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29659         this_arg_conv.is_owned = false;
29660         unsigned char channel_id_arr[32];
29661         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29662         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29663         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29664         LDKPublicKey counterparty_node_id_ref;
29665         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29666         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29667         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29668         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29669         return tag_ptr(ret_conv, true);
29670 }
29671
29672 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) {
29673         LDKChannelManager this_arg_conv;
29674         this_arg_conv.inner = untag_ptr(this_arg);
29675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29677         this_arg_conv.is_owned = false;
29678         unsigned char channel_id_arr[32];
29679         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29680         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29681         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29682         LDKPublicKey counterparty_node_id_ref;
29683         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29684         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29685         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29686         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
29687         return tag_ptr(ret_conv, true);
29688 }
29689
29690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
29691         LDKChannelManager this_arg_conv;
29692         this_arg_conv.inner = untag_ptr(this_arg);
29693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29695         this_arg_conv.is_owned = false;
29696         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
29697 }
29698
29699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
29700         LDKChannelManager this_arg_conv;
29701         this_arg_conv.inner = untag_ptr(this_arg);
29702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29704         this_arg_conv.is_owned = false;
29705         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
29706 }
29707
29708 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) {
29709         LDKChannelManager this_arg_conv;
29710         this_arg_conv.inner = untag_ptr(this_arg);
29711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29713         this_arg_conv.is_owned = false;
29714         LDKRoute route_conv;
29715         route_conv.inner = untag_ptr(route);
29716         route_conv.is_owned = ptr_is_owned(route);
29717         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29718         route_conv.is_owned = false;
29719         LDKThirtyTwoBytes payment_hash_ref;
29720         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29721         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29722         LDKThirtyTwoBytes payment_secret_ref;
29723         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29724         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29725         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
29726         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
29727         return tag_ptr(ret_conv, true);
29728 }
29729
29730 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) {
29731         LDKChannelManager this_arg_conv;
29732         this_arg_conv.inner = untag_ptr(this_arg);
29733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29735         this_arg_conv.is_owned = false;
29736         LDKRoute route_conv;
29737         route_conv.inner = untag_ptr(route);
29738         route_conv.is_owned = ptr_is_owned(route);
29739         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29740         route_conv.is_owned = false;
29741         LDKThirtyTwoBytes payment_id_ref;
29742         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29743         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29744         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29745         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
29746         return tag_ptr(ret_conv, true);
29747 }
29748
29749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
29750         LDKChannelManager this_arg_conv;
29751         this_arg_conv.inner = untag_ptr(this_arg);
29752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29754         this_arg_conv.is_owned = false;
29755         LDKThirtyTwoBytes payment_id_ref;
29756         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29757         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29758         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29759 }
29760
29761 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) {
29762         LDKChannelManager this_arg_conv;
29763         this_arg_conv.inner = untag_ptr(this_arg);
29764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29766         this_arg_conv.is_owned = false;
29767         LDKRoute route_conv;
29768         route_conv.inner = untag_ptr(route);
29769         route_conv.is_owned = ptr_is_owned(route);
29770         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29771         route_conv.is_owned = false;
29772         LDKThirtyTwoBytes payment_preimage_ref;
29773         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29774         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29775         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29776         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
29777         return tag_ptr(ret_conv, true);
29778 }
29779
29780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray hops) {
29781         LDKChannelManager this_arg_conv;
29782         this_arg_conv.inner = untag_ptr(this_arg);
29783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29785         this_arg_conv.is_owned = false;
29786         LDKCVec_RouteHopZ hops_constr;
29787         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
29788         if (hops_constr.datalen > 0)
29789                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
29790         else
29791                 hops_constr.data = NULL;
29792         int64_t* hops_vals = (*env)->GetLongArrayElements (env, hops, NULL);
29793         for (size_t k = 0; k < hops_constr.datalen; k++) {
29794                 int64_t hops_conv_10 = hops_vals[k];
29795                 LDKRouteHop hops_conv_10_conv;
29796                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
29797                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
29798                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
29799                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
29800                 hops_constr.data[k] = hops_conv_10_conv;
29801         }
29802         (*env)->ReleaseLongArrayElements(env, hops, hops_vals, 0);
29803         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29804         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
29805         return tag_ptr(ret_conv, true);
29806 }
29807
29808 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) {
29809         LDKChannelManager this_arg_conv;
29810         this_arg_conv.inner = untag_ptr(this_arg);
29811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29813         this_arg_conv.is_owned = false;
29814         unsigned char temporary_channel_id_arr[32];
29815         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29816         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29817         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29818         LDKPublicKey counterparty_node_id_ref;
29819         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29820         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29821         LDKTransaction funding_transaction_ref;
29822         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
29823         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29824         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
29825         funding_transaction_ref.data_is_owned = true;
29826         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29827         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
29828         return tag_ptr(ret_conv, true);
29829 }
29830
29831 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) {
29832         LDKChannelManager this_arg_conv;
29833         this_arg_conv.inner = untag_ptr(this_arg);
29834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29836         this_arg_conv.is_owned = false;
29837         LDKThreeBytes rgb_ref;
29838         CHECK((*env)->GetArrayLength(env, rgb) == 3);
29839         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
29840         LDKThirtyTwoBytes alias_ref;
29841         CHECK((*env)->GetArrayLength(env, alias) == 32);
29842         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
29843         LDKCVec_NetAddressZ addresses_constr;
29844         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
29845         if (addresses_constr.datalen > 0)
29846                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
29847         else
29848                 addresses_constr.data = NULL;
29849         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
29850         for (size_t m = 0; m < addresses_constr.datalen; m++) {
29851                 int64_t addresses_conv_12 = addresses_vals[m];
29852                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
29853                 CHECK_ACCESS(addresses_conv_12_ptr);
29854                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
29855                 addresses_constr.data[m] = addresses_conv_12_conv;
29856         }
29857         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
29858         ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
29859 }
29860
29861 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) {
29862         LDKChannelManager this_arg_conv;
29863         this_arg_conv.inner = untag_ptr(this_arg);
29864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29866         this_arg_conv.is_owned = false;
29867         LDKPublicKey counterparty_node_id_ref;
29868         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29869         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29870         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
29871         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
29872         if (channel_ids_constr.datalen > 0)
29873                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
29874         else
29875                 channel_ids_constr.data = NULL;
29876         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
29877                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
29878                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
29879                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
29880                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
29881                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
29882         }
29883         LDKChannelConfig config_conv;
29884         config_conv.inner = untag_ptr(config);
29885         config_conv.is_owned = ptr_is_owned(config);
29886         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29887         config_conv.is_owned = false;
29888         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29889         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
29890         return tag_ptr(ret_conv, true);
29891 }
29892
29893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
29894         LDKChannelManager this_arg_conv;
29895         this_arg_conv.inner = untag_ptr(this_arg);
29896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29898         this_arg_conv.is_owned = false;
29899         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29900 }
29901
29902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
29903         LDKChannelManager this_arg_conv;
29904         this_arg_conv.inner = untag_ptr(this_arg);
29905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29907         this_arg_conv.is_owned = false;
29908         ChannelManager_timer_tick_occurred(&this_arg_conv);
29909 }
29910
29911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
29912         LDKChannelManager this_arg_conv;
29913         this_arg_conv.inner = untag_ptr(this_arg);
29914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29916         this_arg_conv.is_owned = false;
29917         unsigned char payment_hash_arr[32];
29918         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29919         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
29920         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
29921         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29922 }
29923
29924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
29925         LDKChannelManager this_arg_conv;
29926         this_arg_conv.inner = untag_ptr(this_arg);
29927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29929         this_arg_conv.is_owned = false;
29930         LDKThirtyTwoBytes payment_preimage_ref;
29931         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29932         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29933         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29934 }
29935
29936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
29937         LDKChannelManager this_arg_conv;
29938         this_arg_conv.inner = untag_ptr(this_arg);
29939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29941         this_arg_conv.is_owned = false;
29942         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29943         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
29944         return ret_arr;
29945 }
29946
29947 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) {
29948         LDKChannelManager this_arg_conv;
29949         this_arg_conv.inner = untag_ptr(this_arg);
29950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29952         this_arg_conv.is_owned = false;
29953         unsigned char temporary_channel_id_arr[32];
29954         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29955         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29956         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29957         LDKPublicKey counterparty_node_id_ref;
29958         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29959         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29960         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29961         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
29962         return tag_ptr(ret_conv, true);
29963 }
29964
29965 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) {
29966         LDKChannelManager this_arg_conv;
29967         this_arg_conv.inner = untag_ptr(this_arg);
29968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29970         this_arg_conv.is_owned = false;
29971         unsigned char temporary_channel_id_arr[32];
29972         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29973         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29974         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29975         LDKPublicKey counterparty_node_id_ref;
29976         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
29977         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
29978         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29979         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
29980         return tag_ptr(ret_conv, true);
29981 }
29982
29983 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) {
29984         LDKChannelManager this_arg_conv;
29985         this_arg_conv.inner = untag_ptr(this_arg);
29986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29988         this_arg_conv.is_owned = false;
29989         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29990         CHECK_ACCESS(min_value_msat_ptr);
29991         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29992         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29993         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29994         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29995         return tag_ptr(ret_conv, true);
29996 }
29997
29998 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) {
29999         LDKChannelManager this_arg_conv;
30000         this_arg_conv.inner = untag_ptr(this_arg);
30001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30003         this_arg_conv.is_owned = false;
30004         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30005         CHECK_ACCESS(min_value_msat_ptr);
30006         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30007         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30008         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
30009         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
30010         return tag_ptr(ret_conv, true);
30011 }
30012
30013 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) {
30014         LDKChannelManager this_arg_conv;
30015         this_arg_conv.inner = untag_ptr(this_arg);
30016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30018         this_arg_conv.is_owned = false;
30019         LDKThirtyTwoBytes payment_hash_ref;
30020         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30021         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30022         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30023         CHECK_ACCESS(min_value_msat_ptr);
30024         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30025         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30026         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30027         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30028         return tag_ptr(ret_conv, true);
30029 }
30030
30031 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) {
30032         LDKChannelManager this_arg_conv;
30033         this_arg_conv.inner = untag_ptr(this_arg);
30034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30036         this_arg_conv.is_owned = false;
30037         LDKThirtyTwoBytes payment_hash_ref;
30038         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30039         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30040         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30041         CHECK_ACCESS(min_value_msat_ptr);
30042         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30043         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30044         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
30045         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
30046         return tag_ptr(ret_conv, true);
30047 }
30048
30049 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) {
30050         LDKChannelManager this_arg_conv;
30051         this_arg_conv.inner = untag_ptr(this_arg);
30052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30054         this_arg_conv.is_owned = false;
30055         LDKThirtyTwoBytes payment_hash_ref;
30056         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30057         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30058         LDKThirtyTwoBytes payment_secret_ref;
30059         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
30060         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
30061         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
30062         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
30063         return tag_ptr(ret_conv, true);
30064 }
30065
30066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
30067         LDKChannelManager this_arg_conv;
30068         this_arg_conv.inner = untag_ptr(this_arg);
30069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30071         this_arg_conv.is_owned = false;
30072         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
30073         return ret_conv;
30074 }
30075
30076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
30077         LDKChannelManager this_arg_conv;
30078         this_arg_conv.inner = untag_ptr(this_arg);
30079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30081         this_arg_conv.is_owned = false;
30082         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
30083         int64_t ret_ref = 0;
30084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30086         return ret_ref;
30087 }
30088
30089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30090         LDKChannelManager this_arg_conv;
30091         this_arg_conv.inner = untag_ptr(this_arg);
30092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30094         this_arg_conv.is_owned = false;
30095         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
30096         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
30097         return tag_ptr(ret_ret, true);
30098 }
30099
30100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
30101         LDKChannelManager this_arg_conv;
30102         this_arg_conv.inner = untag_ptr(this_arg);
30103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30105         this_arg_conv.is_owned = false;
30106         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
30107         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
30108         return tag_ptr(ret_ret, true);
30109 }
30110
30111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
30112         LDKChannelManager this_arg_conv;
30113         this_arg_conv.inner = untag_ptr(this_arg);
30114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30116         this_arg_conv.is_owned = false;
30117         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
30118         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
30119         return tag_ptr(ret_ret, true);
30120 }
30121
30122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
30123         LDKChannelManager this_arg_conv;
30124         this_arg_conv.inner = untag_ptr(this_arg);
30125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30127         this_arg_conv.is_owned = false;
30128         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
30129         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
30130         return tag_ptr(ret_ret, true);
30131 }
30132
30133 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) {
30134         LDKChannelManager this_arg_conv;
30135         this_arg_conv.inner = untag_ptr(this_arg);
30136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30138         this_arg_conv.is_owned = false;
30139         jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
30140         return ret_conv;
30141 }
30142
30143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
30144         LDKChannelManager this_arg_conv;
30145         this_arg_conv.inner = untag_ptr(this_arg);
30146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30148         this_arg_conv.is_owned = false;
30149         ChannelManager_await_persistable_update(&this_arg_conv);
30150 }
30151
30152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
30153         LDKChannelManager this_arg_conv;
30154         this_arg_conv.inner = untag_ptr(this_arg);
30155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30157         this_arg_conv.is_owned = false;
30158         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
30159         int64_t ret_ref = 0;
30160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30162         return ret_ref;
30163 }
30164
30165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
30166         LDKChannelManager this_arg_conv;
30167         this_arg_conv.inner = untag_ptr(this_arg);
30168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30170         this_arg_conv.is_owned = false;
30171         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
30172         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
30173         return tag_ptr(ret_ret, true);
30174 }
30175
30176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
30177         LDKCounterpartyForwardingInfo obj_conv;
30178         obj_conv.inner = untag_ptr(obj);
30179         obj_conv.is_owned = ptr_is_owned(obj);
30180         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30181         obj_conv.is_owned = false;
30182         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
30183         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30184         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30185         CVec_u8Z_free(ret_var);
30186         return ret_arr;
30187 }
30188
30189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30190         LDKu8slice ser_ref;
30191         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30192         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30193         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30194         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
30195         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30196         return tag_ptr(ret_conv, true);
30197 }
30198
30199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
30200         LDKChannelCounterparty obj_conv;
30201         obj_conv.inner = untag_ptr(obj);
30202         obj_conv.is_owned = ptr_is_owned(obj);
30203         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30204         obj_conv.is_owned = false;
30205         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
30206         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30207         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30208         CVec_u8Z_free(ret_var);
30209         return ret_arr;
30210 }
30211
30212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30213         LDKu8slice ser_ref;
30214         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30215         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30216         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30217         *ret_conv = ChannelCounterparty_read(ser_ref);
30218         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30219         return tag_ptr(ret_conv, true);
30220 }
30221
30222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
30223         LDKChannelDetails obj_conv;
30224         obj_conv.inner = untag_ptr(obj);
30225         obj_conv.is_owned = ptr_is_owned(obj);
30226         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30227         obj_conv.is_owned = false;
30228         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
30229         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30230         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30231         CVec_u8Z_free(ret_var);
30232         return ret_arr;
30233 }
30234
30235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30236         LDKu8slice ser_ref;
30237         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30238         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30239         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30240         *ret_conv = ChannelDetails_read(ser_ref);
30241         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30242         return tag_ptr(ret_conv, true);
30243 }
30244
30245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
30246         LDKPhantomRouteHints obj_conv;
30247         obj_conv.inner = untag_ptr(obj);
30248         obj_conv.is_owned = ptr_is_owned(obj);
30249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30250         obj_conv.is_owned = false;
30251         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
30252         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30253         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30254         CVec_u8Z_free(ret_var);
30255         return ret_arr;
30256 }
30257
30258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30259         LDKu8slice ser_ref;
30260         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30261         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30262         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30263         *ret_conv = PhantomRouteHints_read(ser_ref);
30264         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30265         return tag_ptr(ret_conv, true);
30266 }
30267
30268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
30269         LDKChannelManager obj_conv;
30270         obj_conv.inner = untag_ptr(obj);
30271         obj_conv.is_owned = ptr_is_owned(obj);
30272         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30273         obj_conv.is_owned = false;
30274         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
30275         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30276         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30277         CVec_u8Z_free(ret_var);
30278         return ret_arr;
30279 }
30280
30281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30282         LDKChannelManagerReadArgs this_obj_conv;
30283         this_obj_conv.inner = untag_ptr(this_obj);
30284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30286         ChannelManagerReadArgs_free(this_obj_conv);
30287 }
30288
30289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
30290         LDKChannelManagerReadArgs this_ptr_conv;
30291         this_ptr_conv.inner = untag_ptr(this_ptr);
30292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30294         this_ptr_conv.is_owned = false;
30295         // WARNING: This object doesn't live past this scope, needs clone!
30296         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
30297         return ret_ret;
30298 }
30299
30300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30301         LDKChannelManagerReadArgs this_ptr_conv;
30302         this_ptr_conv.inner = untag_ptr(this_ptr);
30303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30305         this_ptr_conv.is_owned = false;
30306         void* val_ptr = untag_ptr(val);
30307         CHECK_ACCESS(val_ptr);
30308         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
30309         if (val_conv.free == LDKKeysInterface_JCalls_free) {
30310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30311                 LDKKeysInterface_JCalls_cloned(&val_conv);
30312         }
30313         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
30314 }
30315
30316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
30317         LDKChannelManagerReadArgs this_ptr_conv;
30318         this_ptr_conv.inner = untag_ptr(this_ptr);
30319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30321         this_ptr_conv.is_owned = false;
30322         // WARNING: This object doesn't live past this scope, needs clone!
30323         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
30324         return ret_ret;
30325 }
30326
30327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30328         LDKChannelManagerReadArgs this_ptr_conv;
30329         this_ptr_conv.inner = untag_ptr(this_ptr);
30330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30332         this_ptr_conv.is_owned = false;
30333         void* val_ptr = untag_ptr(val);
30334         CHECK_ACCESS(val_ptr);
30335         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
30336         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
30337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30338                 LDKFeeEstimator_JCalls_cloned(&val_conv);
30339         }
30340         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
30341 }
30342
30343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
30344         LDKChannelManagerReadArgs this_ptr_conv;
30345         this_ptr_conv.inner = untag_ptr(this_ptr);
30346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30348         this_ptr_conv.is_owned = false;
30349         // WARNING: This object doesn't live past this scope, needs clone!
30350         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
30351         return ret_ret;
30352 }
30353
30354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30355         LDKChannelManagerReadArgs this_ptr_conv;
30356         this_ptr_conv.inner = untag_ptr(this_ptr);
30357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30359         this_ptr_conv.is_owned = false;
30360         void* val_ptr = untag_ptr(val);
30361         CHECK_ACCESS(val_ptr);
30362         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
30363         if (val_conv.free == LDKWatch_JCalls_free) {
30364                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30365                 LDKWatch_JCalls_cloned(&val_conv);
30366         }
30367         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
30368 }
30369
30370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
30371         LDKChannelManagerReadArgs this_ptr_conv;
30372         this_ptr_conv.inner = untag_ptr(this_ptr);
30373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30375         this_ptr_conv.is_owned = false;
30376         // WARNING: This object doesn't live past this scope, needs clone!
30377         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
30378         return ret_ret;
30379 }
30380
30381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30382         LDKChannelManagerReadArgs this_ptr_conv;
30383         this_ptr_conv.inner = untag_ptr(this_ptr);
30384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30386         this_ptr_conv.is_owned = false;
30387         void* val_ptr = untag_ptr(val);
30388         CHECK_ACCESS(val_ptr);
30389         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
30390         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
30391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30392                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
30393         }
30394         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
30395 }
30396
30397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
30398         LDKChannelManagerReadArgs this_ptr_conv;
30399         this_ptr_conv.inner = untag_ptr(this_ptr);
30400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30402         this_ptr_conv.is_owned = false;
30403         // WARNING: This object doesn't live past this scope, needs clone!
30404         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
30405         return ret_ret;
30406 }
30407
30408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30409         LDKChannelManagerReadArgs this_ptr_conv;
30410         this_ptr_conv.inner = untag_ptr(this_ptr);
30411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30413         this_ptr_conv.is_owned = false;
30414         void* val_ptr = untag_ptr(val);
30415         CHECK_ACCESS(val_ptr);
30416         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
30417         if (val_conv.free == LDKLogger_JCalls_free) {
30418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30419                 LDKLogger_JCalls_cloned(&val_conv);
30420         }
30421         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
30422 }
30423
30424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
30425         LDKChannelManagerReadArgs this_ptr_conv;
30426         this_ptr_conv.inner = untag_ptr(this_ptr);
30427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30429         this_ptr_conv.is_owned = false;
30430         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
30431         int64_t ret_ref = 0;
30432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30434         return ret_ref;
30435 }
30436
30437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30438         LDKChannelManagerReadArgs this_ptr_conv;
30439         this_ptr_conv.inner = untag_ptr(this_ptr);
30440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30442         this_ptr_conv.is_owned = false;
30443         LDKUserConfig val_conv;
30444         val_conv.inner = untag_ptr(val);
30445         val_conv.is_owned = ptr_is_owned(val);
30446         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30447         val_conv = UserConfig_clone(&val_conv);
30448         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
30449 }
30450
30451 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) {
30452         void* keys_manager_ptr = untag_ptr(keys_manager);
30453         CHECK_ACCESS(keys_manager_ptr);
30454         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
30455         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
30456                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30457                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
30458         }
30459         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30460         CHECK_ACCESS(fee_estimator_ptr);
30461         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30462         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30463                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30464                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30465         }
30466         void* chain_monitor_ptr = untag_ptr(chain_monitor);
30467         CHECK_ACCESS(chain_monitor_ptr);
30468         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
30469         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
30470                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30471                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
30472         }
30473         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
30474         CHECK_ACCESS(tx_broadcaster_ptr);
30475         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
30476         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30478                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
30479         }
30480         void* logger_ptr = untag_ptr(logger);
30481         CHECK_ACCESS(logger_ptr);
30482         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30483         if (logger_conv.free == LDKLogger_JCalls_free) {
30484                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30485                 LDKLogger_JCalls_cloned(&logger_conv);
30486         }
30487         LDKUserConfig default_config_conv;
30488         default_config_conv.inner = untag_ptr(default_config);
30489         default_config_conv.is_owned = ptr_is_owned(default_config);
30490         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
30491         default_config_conv = UserConfig_clone(&default_config_conv);
30492         LDKCVec_ChannelMonitorZ channel_monitors_constr;
30493         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
30494         if (channel_monitors_constr.datalen > 0)
30495                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
30496         else
30497                 channel_monitors_constr.data = NULL;
30498         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
30499         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
30500                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
30501                 LDKChannelMonitor channel_monitors_conv_16_conv;
30502                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
30503                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
30504                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
30505                 channel_monitors_conv_16_conv.is_owned = false;
30506                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
30507         }
30508         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
30509         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);
30510         int64_t ret_ref = 0;
30511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30513         return ret_ref;
30514 }
30515
30516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
30517         LDKu8slice ser_ref;
30518         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30519         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30520         LDKChannelManagerReadArgs arg_conv;
30521         arg_conv.inner = untag_ptr(arg);
30522         arg_conv.is_owned = ptr_is_owned(arg);
30523         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30524         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
30525         
30526         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
30527         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
30528         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30529         return tag_ptr(ret_conv, true);
30530 }
30531
30532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30533         LDKExpandedKey this_obj_conv;
30534         this_obj_conv.inner = untag_ptr(this_obj);
30535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30537         ExpandedKey_free(this_obj_conv);
30538 }
30539
30540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
30541         unsigned char key_material_arr[32];
30542         CHECK((*env)->GetArrayLength(env, key_material) == 32);
30543         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
30544         unsigned char (*key_material_ref)[32] = &key_material_arr;
30545         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
30546         int64_t ret_ref = 0;
30547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30549         return ret_ref;
30550 }
30551
30552 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) {
30553         LDKExpandedKey keys_conv;
30554         keys_conv.inner = untag_ptr(keys);
30555         keys_conv.is_owned = ptr_is_owned(keys);
30556         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30557         keys_conv.is_owned = false;
30558         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30559         CHECK_ACCESS(min_value_msat_ptr);
30560         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30561         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30562         void* keys_manager_ptr = untag_ptr(keys_manager);
30563         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
30564         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
30565         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
30566         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
30567         return tag_ptr(ret_conv, true);
30568 }
30569
30570 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) {
30571         LDKExpandedKey keys_conv;
30572         keys_conv.inner = untag_ptr(keys);
30573         keys_conv.is_owned = ptr_is_owned(keys);
30574         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
30575         keys_conv.is_owned = false;
30576         void* min_value_msat_ptr = untag_ptr(min_value_msat);
30577         CHECK_ACCESS(min_value_msat_ptr);
30578         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
30579         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
30580         LDKThirtyTwoBytes payment_hash_ref;
30581         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
30582         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
30583         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
30584         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
30585         return tag_ptr(ret_conv, true);
30586 }
30587
30588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30589         LDKDecodeError this_obj_conv;
30590         this_obj_conv.inner = untag_ptr(this_obj);
30591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30593         DecodeError_free(this_obj_conv);
30594 }
30595
30596 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
30597         LDKDecodeError ret_var = DecodeError_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_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30604         LDKDecodeError 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 = DecodeError_clone_ptr(&arg_conv);
30610         return ret_conv;
30611 }
30612
30613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30614         LDKDecodeError 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         LDKDecodeError ret_var = DecodeError_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_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30627         LDKInit 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         Init_free(this_obj_conv);
30632 }
30633
30634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30635         LDKInit 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         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
30641         int64_t ret_ref = 0;
30642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30644         return ret_ref;
30645 }
30646
30647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30648         LDKInit this_ptr_conv;
30649         this_ptr_conv.inner = untag_ptr(this_ptr);
30650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30652         this_ptr_conv.is_owned = false;
30653         LDKInitFeatures val_conv;
30654         val_conv.inner = untag_ptr(val);
30655         val_conv.is_owned = ptr_is_owned(val);
30656         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30657         val_conv = InitFeatures_clone(&val_conv);
30658         Init_set_features(&this_ptr_conv, val_conv);
30659 }
30660
30661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
30662         LDKInit this_ptr_conv;
30663         this_ptr_conv.inner = untag_ptr(this_ptr);
30664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30666         this_ptr_conv.is_owned = false;
30667         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
30668         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
30669         int64_t ret_ref = tag_ptr(ret_copy, true);
30670         return ret_ref;
30671 }
30672
30673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30674         LDKInit this_ptr_conv;
30675         this_ptr_conv.inner = untag_ptr(this_ptr);
30676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30678         this_ptr_conv.is_owned = false;
30679         void* val_ptr = untag_ptr(val);
30680         CHECK_ACCESS(val_ptr);
30681         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
30682         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
30683         Init_set_remote_network_address(&this_ptr_conv, val_conv);
30684 }
30685
30686 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) {
30687         LDKInitFeatures features_arg_conv;
30688         features_arg_conv.inner = untag_ptr(features_arg);
30689         features_arg_conv.is_owned = ptr_is_owned(features_arg);
30690         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
30691         features_arg_conv = InitFeatures_clone(&features_arg_conv);
30692         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
30693         CHECK_ACCESS(remote_network_address_arg_ptr);
30694         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
30695         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
30696         int64_t ret_ref = 0;
30697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30699         return ret_ref;
30700 }
30701
30702 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30703         LDKInit ret_var = Init_clone(arg);
30704         int64_t ret_ref = 0;
30705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30707         return ret_ref;
30708 }
30709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30710         LDKInit arg_conv;
30711         arg_conv.inner = untag_ptr(arg);
30712         arg_conv.is_owned = ptr_is_owned(arg);
30713         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30714         arg_conv.is_owned = false;
30715         int64_t ret_conv = Init_clone_ptr(&arg_conv);
30716         return ret_conv;
30717 }
30718
30719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30720         LDKInit orig_conv;
30721         orig_conv.inner = untag_ptr(orig);
30722         orig_conv.is_owned = ptr_is_owned(orig);
30723         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30724         orig_conv.is_owned = false;
30725         LDKInit ret_var = Init_clone(&orig_conv);
30726         int64_t ret_ref = 0;
30727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30729         return ret_ref;
30730 }
30731
30732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30733         LDKErrorMessage this_obj_conv;
30734         this_obj_conv.inner = untag_ptr(this_obj);
30735         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30737         ErrorMessage_free(this_obj_conv);
30738 }
30739
30740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30741         LDKErrorMessage this_ptr_conv;
30742         this_ptr_conv.inner = untag_ptr(this_ptr);
30743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30745         this_ptr_conv.is_owned = false;
30746         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30747         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
30748         return ret_arr;
30749 }
30750
30751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30752         LDKErrorMessage this_ptr_conv;
30753         this_ptr_conv.inner = untag_ptr(this_ptr);
30754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30756         this_ptr_conv.is_owned = false;
30757         LDKThirtyTwoBytes val_ref;
30758         CHECK((*env)->GetArrayLength(env, val) == 32);
30759         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30760         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30761 }
30762
30763 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30764         LDKErrorMessage this_ptr_conv;
30765         this_ptr_conv.inner = untag_ptr(this_ptr);
30766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30768         this_ptr_conv.is_owned = false;
30769         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30770         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30771         Str_free(ret_str);
30772         return ret_conv;
30773 }
30774
30775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30776         LDKErrorMessage this_ptr_conv;
30777         this_ptr_conv.inner = untag_ptr(this_ptr);
30778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30780         this_ptr_conv.is_owned = false;
30781         LDKStr val_conv = java_to_owned_str(env, val);
30782         ErrorMessage_set_data(&this_ptr_conv, val_conv);
30783 }
30784
30785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30786         LDKThirtyTwoBytes channel_id_arg_ref;
30787         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30788         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30789         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30790         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30791         int64_t ret_ref = 0;
30792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30794         return ret_ref;
30795 }
30796
30797 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30798         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30805         LDKErrorMessage arg_conv;
30806         arg_conv.inner = untag_ptr(arg);
30807         arg_conv.is_owned = ptr_is_owned(arg);
30808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30809         arg_conv.is_owned = false;
30810         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30811         return ret_conv;
30812 }
30813
30814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30815         LDKErrorMessage orig_conv;
30816         orig_conv.inner = untag_ptr(orig);
30817         orig_conv.is_owned = ptr_is_owned(orig);
30818         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30819         orig_conv.is_owned = false;
30820         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30821         int64_t ret_ref = 0;
30822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30824         return ret_ref;
30825 }
30826
30827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30828         LDKWarningMessage this_obj_conv;
30829         this_obj_conv.inner = untag_ptr(this_obj);
30830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30832         WarningMessage_free(this_obj_conv);
30833 }
30834
30835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30836         LDKWarningMessage this_ptr_conv;
30837         this_ptr_conv.inner = untag_ptr(this_ptr);
30838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30840         this_ptr_conv.is_owned = false;
30841         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30842         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
30843         return ret_arr;
30844 }
30845
30846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30847         LDKWarningMessage this_ptr_conv;
30848         this_ptr_conv.inner = untag_ptr(this_ptr);
30849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30851         this_ptr_conv.is_owned = false;
30852         LDKThirtyTwoBytes val_ref;
30853         CHECK((*env)->GetArrayLength(env, val) == 32);
30854         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30855         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30856 }
30857
30858 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30859         LDKWarningMessage this_ptr_conv;
30860         this_ptr_conv.inner = untag_ptr(this_ptr);
30861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30863         this_ptr_conv.is_owned = false;
30864         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30865         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30866         Str_free(ret_str);
30867         return ret_conv;
30868 }
30869
30870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30871         LDKWarningMessage this_ptr_conv;
30872         this_ptr_conv.inner = untag_ptr(this_ptr);
30873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30875         this_ptr_conv.is_owned = false;
30876         LDKStr val_conv = java_to_owned_str(env, val);
30877         WarningMessage_set_data(&this_ptr_conv, val_conv);
30878 }
30879
30880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30881         LDKThirtyTwoBytes channel_id_arg_ref;
30882         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30883         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30884         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30885         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30886         int64_t ret_ref = 0;
30887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30889         return ret_ref;
30890 }
30891
30892 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30893         LDKWarningMessage ret_var = WarningMessage_clone(arg);
30894         int64_t ret_ref = 0;
30895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30897         return ret_ref;
30898 }
30899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30900         LDKWarningMessage arg_conv;
30901         arg_conv.inner = untag_ptr(arg);
30902         arg_conv.is_owned = ptr_is_owned(arg);
30903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30904         arg_conv.is_owned = false;
30905         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30906         return ret_conv;
30907 }
30908
30909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30910         LDKWarningMessage orig_conv;
30911         orig_conv.inner = untag_ptr(orig);
30912         orig_conv.is_owned = ptr_is_owned(orig);
30913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30914         orig_conv.is_owned = false;
30915         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30916         int64_t ret_ref = 0;
30917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30919         return ret_ref;
30920 }
30921
30922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30923         LDKPing this_obj_conv;
30924         this_obj_conv.inner = untag_ptr(this_obj);
30925         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30927         Ping_free(this_obj_conv);
30928 }
30929
30930 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30931         LDKPing this_ptr_conv;
30932         this_ptr_conv.inner = untag_ptr(this_ptr);
30933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30935         this_ptr_conv.is_owned = false;
30936         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30937         return ret_conv;
30938 }
30939
30940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30941         LDKPing this_ptr_conv;
30942         this_ptr_conv.inner = untag_ptr(this_ptr);
30943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30945         this_ptr_conv.is_owned = false;
30946         Ping_set_ponglen(&this_ptr_conv, val);
30947 }
30948
30949 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30950         LDKPing this_ptr_conv;
30951         this_ptr_conv.inner = untag_ptr(this_ptr);
30952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30954         this_ptr_conv.is_owned = false;
30955         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30956         return ret_conv;
30957 }
30958
30959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30960         LDKPing this_ptr_conv;
30961         this_ptr_conv.inner = untag_ptr(this_ptr);
30962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30964         this_ptr_conv.is_owned = false;
30965         Ping_set_byteslen(&this_ptr_conv, val);
30966 }
30967
30968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
30969         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30970         int64_t ret_ref = 0;
30971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30973         return ret_ref;
30974 }
30975
30976 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30977         LDKPing ret_var = Ping_clone(arg);
30978         int64_t ret_ref = 0;
30979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30981         return ret_ref;
30982 }
30983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30984         LDKPing arg_conv;
30985         arg_conv.inner = untag_ptr(arg);
30986         arg_conv.is_owned = ptr_is_owned(arg);
30987         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30988         arg_conv.is_owned = false;
30989         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30990         return ret_conv;
30991 }
30992
30993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30994         LDKPing orig_conv;
30995         orig_conv.inner = untag_ptr(orig);
30996         orig_conv.is_owned = ptr_is_owned(orig);
30997         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30998         orig_conv.is_owned = false;
30999         LDKPing ret_var = Ping_clone(&orig_conv);
31000         int64_t ret_ref = 0;
31001         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31002         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31003         return ret_ref;
31004 }
31005
31006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31007         LDKPong this_obj_conv;
31008         this_obj_conv.inner = untag_ptr(this_obj);
31009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31011         Pong_free(this_obj_conv);
31012 }
31013
31014 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
31015         LDKPong this_ptr_conv;
31016         this_ptr_conv.inner = untag_ptr(this_ptr);
31017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31019         this_ptr_conv.is_owned = false;
31020         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
31021         return ret_conv;
31022 }
31023
31024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31025         LDKPong this_ptr_conv;
31026         this_ptr_conv.inner = untag_ptr(this_ptr);
31027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31029         this_ptr_conv.is_owned = false;
31030         Pong_set_byteslen(&this_ptr_conv, val);
31031 }
31032
31033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
31034         LDKPong ret_var = Pong_new(byteslen_arg);
31035         int64_t ret_ref = 0;
31036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31038         return ret_ref;
31039 }
31040
31041 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
31042         LDKPong ret_var = Pong_clone(arg);
31043         int64_t ret_ref = 0;
31044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31046         return ret_ref;
31047 }
31048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31049         LDKPong arg_conv;
31050         arg_conv.inner = untag_ptr(arg);
31051         arg_conv.is_owned = ptr_is_owned(arg);
31052         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31053         arg_conv.is_owned = false;
31054         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
31055         return ret_conv;
31056 }
31057
31058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31059         LDKPong orig_conv;
31060         orig_conv.inner = untag_ptr(orig);
31061         orig_conv.is_owned = ptr_is_owned(orig);
31062         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31063         orig_conv.is_owned = false;
31064         LDKPong ret_var = Pong_clone(&orig_conv);
31065         int64_t ret_ref = 0;
31066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31068         return ret_ref;
31069 }
31070
31071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31072         LDKOpenChannel this_obj_conv;
31073         this_obj_conv.inner = untag_ptr(this_obj);
31074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31076         OpenChannel_free(this_obj_conv);
31077 }
31078
31079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31080         LDKOpenChannel this_ptr_conv;
31081         this_ptr_conv.inner = untag_ptr(this_ptr);
31082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31084         this_ptr_conv.is_owned = false;
31085         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31086         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
31087         return ret_arr;
31088 }
31089
31090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31091         LDKOpenChannel this_ptr_conv;
31092         this_ptr_conv.inner = untag_ptr(this_ptr);
31093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31095         this_ptr_conv.is_owned = false;
31096         LDKThirtyTwoBytes val_ref;
31097         CHECK((*env)->GetArrayLength(env, val) == 32);
31098         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31099         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
31100 }
31101
31102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31103         LDKOpenChannel this_ptr_conv;
31104         this_ptr_conv.inner = untag_ptr(this_ptr);
31105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31107         this_ptr_conv.is_owned = false;
31108         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31109         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
31110         return ret_arr;
31111 }
31112
31113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31114         LDKOpenChannel this_ptr_conv;
31115         this_ptr_conv.inner = untag_ptr(this_ptr);
31116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31118         this_ptr_conv.is_owned = false;
31119         LDKThirtyTwoBytes val_ref;
31120         CHECK((*env)->GetArrayLength(env, val) == 32);
31121         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31122         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31123 }
31124
31125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31126         LDKOpenChannel this_ptr_conv;
31127         this_ptr_conv.inner = untag_ptr(this_ptr);
31128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31130         this_ptr_conv.is_owned = false;
31131         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
31132         return ret_conv;
31133 }
31134
31135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31136         LDKOpenChannel this_ptr_conv;
31137         this_ptr_conv.inner = untag_ptr(this_ptr);
31138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31140         this_ptr_conv.is_owned = false;
31141         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
31142 }
31143
31144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31145         LDKOpenChannel this_ptr_conv;
31146         this_ptr_conv.inner = untag_ptr(this_ptr);
31147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31149         this_ptr_conv.is_owned = false;
31150         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
31151         return ret_conv;
31152 }
31153
31154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31155         LDKOpenChannel this_ptr_conv;
31156         this_ptr_conv.inner = untag_ptr(this_ptr);
31157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31159         this_ptr_conv.is_owned = false;
31160         OpenChannel_set_push_msat(&this_ptr_conv, val);
31161 }
31162
31163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31164         LDKOpenChannel this_ptr_conv;
31165         this_ptr_conv.inner = untag_ptr(this_ptr);
31166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31168         this_ptr_conv.is_owned = false;
31169         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
31170         return ret_conv;
31171 }
31172
31173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31174         LDKOpenChannel this_ptr_conv;
31175         this_ptr_conv.inner = untag_ptr(this_ptr);
31176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31178         this_ptr_conv.is_owned = false;
31179         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31180 }
31181
31182 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) {
31183         LDKOpenChannel this_ptr_conv;
31184         this_ptr_conv.inner = untag_ptr(this_ptr);
31185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31187         this_ptr_conv.is_owned = false;
31188         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31189         return ret_conv;
31190 }
31191
31192 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) {
31193         LDKOpenChannel this_ptr_conv;
31194         this_ptr_conv.inner = untag_ptr(this_ptr);
31195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31197         this_ptr_conv.is_owned = false;
31198         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31199 }
31200
31201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31202         LDKOpenChannel this_ptr_conv;
31203         this_ptr_conv.inner = untag_ptr(this_ptr);
31204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31206         this_ptr_conv.is_owned = false;
31207         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31208         return ret_conv;
31209 }
31210
31211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31212         LDKOpenChannel this_ptr_conv;
31213         this_ptr_conv.inner = untag_ptr(this_ptr);
31214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31216         this_ptr_conv.is_owned = false;
31217         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31218 }
31219
31220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31221         LDKOpenChannel this_ptr_conv;
31222         this_ptr_conv.inner = untag_ptr(this_ptr);
31223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31225         this_ptr_conv.is_owned = false;
31226         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
31227         return ret_conv;
31228 }
31229
31230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31231         LDKOpenChannel this_ptr_conv;
31232         this_ptr_conv.inner = untag_ptr(this_ptr);
31233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31235         this_ptr_conv.is_owned = false;
31236         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31237 }
31238
31239 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
31240         LDKOpenChannel this_ptr_conv;
31241         this_ptr_conv.inner = untag_ptr(this_ptr);
31242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31244         this_ptr_conv.is_owned = false;
31245         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
31246         return ret_conv;
31247 }
31248
31249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31250         LDKOpenChannel this_ptr_conv;
31251         this_ptr_conv.inner = untag_ptr(this_ptr);
31252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31254         this_ptr_conv.is_owned = false;
31255         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
31256 }
31257
31258 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31259         LDKOpenChannel this_ptr_conv;
31260         this_ptr_conv.inner = untag_ptr(this_ptr);
31261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31263         this_ptr_conv.is_owned = false;
31264         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
31265         return ret_conv;
31266 }
31267
31268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31269         LDKOpenChannel this_ptr_conv;
31270         this_ptr_conv.inner = untag_ptr(this_ptr);
31271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31273         this_ptr_conv.is_owned = false;
31274         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
31275 }
31276
31277 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31278         LDKOpenChannel this_ptr_conv;
31279         this_ptr_conv.inner = untag_ptr(this_ptr);
31280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31282         this_ptr_conv.is_owned = false;
31283         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
31284         return ret_conv;
31285 }
31286
31287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31288         LDKOpenChannel this_ptr_conv;
31289         this_ptr_conv.inner = untag_ptr(this_ptr);
31290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31292         this_ptr_conv.is_owned = false;
31293         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31294 }
31295
31296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31297         LDKOpenChannel this_ptr_conv;
31298         this_ptr_conv.inner = untag_ptr(this_ptr);
31299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31301         this_ptr_conv.is_owned = false;
31302         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31303         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31304         return ret_arr;
31305 }
31306
31307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31308         LDKOpenChannel this_ptr_conv;
31309         this_ptr_conv.inner = untag_ptr(this_ptr);
31310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31312         this_ptr_conv.is_owned = false;
31313         LDKPublicKey val_ref;
31314         CHECK((*env)->GetArrayLength(env, val) == 33);
31315         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31316         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31317 }
31318
31319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31320         LDKOpenChannel this_ptr_conv;
31321         this_ptr_conv.inner = untag_ptr(this_ptr);
31322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31324         this_ptr_conv.is_owned = false;
31325         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31326         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31327         return ret_arr;
31328 }
31329
31330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31331         LDKOpenChannel this_ptr_conv;
31332         this_ptr_conv.inner = untag_ptr(this_ptr);
31333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31335         this_ptr_conv.is_owned = false;
31336         LDKPublicKey val_ref;
31337         CHECK((*env)->GetArrayLength(env, val) == 33);
31338         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31339         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31340 }
31341
31342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31343         LDKOpenChannel this_ptr_conv;
31344         this_ptr_conv.inner = untag_ptr(this_ptr);
31345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31347         this_ptr_conv.is_owned = false;
31348         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31349         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
31350         return ret_arr;
31351 }
31352
31353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31354         LDKOpenChannel this_ptr_conv;
31355         this_ptr_conv.inner = untag_ptr(this_ptr);
31356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31358         this_ptr_conv.is_owned = false;
31359         LDKPublicKey val_ref;
31360         CHECK((*env)->GetArrayLength(env, val) == 33);
31361         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31362         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
31363 }
31364
31365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31366         LDKOpenChannel this_ptr_conv;
31367         this_ptr_conv.inner = untag_ptr(this_ptr);
31368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31370         this_ptr_conv.is_owned = false;
31371         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31372         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31373         return ret_arr;
31374 }
31375
31376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31377         LDKOpenChannel this_ptr_conv;
31378         this_ptr_conv.inner = untag_ptr(this_ptr);
31379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31381         this_ptr_conv.is_owned = false;
31382         LDKPublicKey val_ref;
31383         CHECK((*env)->GetArrayLength(env, val) == 33);
31384         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31385         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31386 }
31387
31388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31389         LDKOpenChannel 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31395         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31396         return ret_arr;
31397 }
31398
31399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31400         LDKOpenChannel this_ptr_conv;
31401         this_ptr_conv.inner = untag_ptr(this_ptr);
31402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31404         this_ptr_conv.is_owned = false;
31405         LDKPublicKey val_ref;
31406         CHECK((*env)->GetArrayLength(env, val) == 33);
31407         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31408         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31409 }
31410
31411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31412         LDKOpenChannel this_ptr_conv;
31413         this_ptr_conv.inner = untag_ptr(this_ptr);
31414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31416         this_ptr_conv.is_owned = false;
31417         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31418         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31419         return ret_arr;
31420 }
31421
31422 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) {
31423         LDKOpenChannel this_ptr_conv;
31424         this_ptr_conv.inner = untag_ptr(this_ptr);
31425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31427         this_ptr_conv.is_owned = false;
31428         LDKPublicKey val_ref;
31429         CHECK((*env)->GetArrayLength(env, val) == 33);
31430         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31431         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31432 }
31433
31434 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
31435         LDKOpenChannel this_ptr_conv;
31436         this_ptr_conv.inner = untag_ptr(this_ptr);
31437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31439         this_ptr_conv.is_owned = false;
31440         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
31441         return ret_conv;
31442 }
31443
31444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
31445         LDKOpenChannel this_ptr_conv;
31446         this_ptr_conv.inner = untag_ptr(this_ptr);
31447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31449         this_ptr_conv.is_owned = false;
31450         OpenChannel_set_channel_flags(&this_ptr_conv, val);
31451 }
31452
31453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31454         LDKOpenChannel this_ptr_conv;
31455         this_ptr_conv.inner = untag_ptr(this_ptr);
31456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31458         this_ptr_conv.is_owned = false;
31459         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
31460         int64_t ret_ref = 0;
31461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31463         return ret_ref;
31464 }
31465
31466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31467         LDKOpenChannel this_ptr_conv;
31468         this_ptr_conv.inner = untag_ptr(this_ptr);
31469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31471         this_ptr_conv.is_owned = false;
31472         LDKChannelTypeFeatures val_conv;
31473         val_conv.inner = untag_ptr(val);
31474         val_conv.is_owned = ptr_is_owned(val);
31475         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31476         val_conv = ChannelTypeFeatures_clone(&val_conv);
31477         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
31478 }
31479
31480 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
31481         LDKOpenChannel ret_var = OpenChannel_clone(arg);
31482         int64_t ret_ref = 0;
31483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31485         return ret_ref;
31486 }
31487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31488         LDKOpenChannel arg_conv;
31489         arg_conv.inner = untag_ptr(arg);
31490         arg_conv.is_owned = ptr_is_owned(arg);
31491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31492         arg_conv.is_owned = false;
31493         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
31494         return ret_conv;
31495 }
31496
31497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31498         LDKOpenChannel orig_conv;
31499         orig_conv.inner = untag_ptr(orig);
31500         orig_conv.is_owned = ptr_is_owned(orig);
31501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31502         orig_conv.is_owned = false;
31503         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
31504         int64_t ret_ref = 0;
31505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31507         return ret_ref;
31508 }
31509
31510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31511         LDKAcceptChannel this_obj_conv;
31512         this_obj_conv.inner = untag_ptr(this_obj);
31513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31515         AcceptChannel_free(this_obj_conv);
31516 }
31517
31518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31519         LDKAcceptChannel this_ptr_conv;
31520         this_ptr_conv.inner = untag_ptr(this_ptr);
31521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31523         this_ptr_conv.is_owned = false;
31524         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31525         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
31526         return ret_arr;
31527 }
31528
31529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31530         LDKAcceptChannel this_ptr_conv;
31531         this_ptr_conv.inner = untag_ptr(this_ptr);
31532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31534         this_ptr_conv.is_owned = false;
31535         LDKThirtyTwoBytes val_ref;
31536         CHECK((*env)->GetArrayLength(env, val) == 32);
31537         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31538         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
31539 }
31540
31541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31542         LDKAcceptChannel this_ptr_conv;
31543         this_ptr_conv.inner = untag_ptr(this_ptr);
31544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31546         this_ptr_conv.is_owned = false;
31547         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
31548         return ret_conv;
31549 }
31550
31551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31552         LDKAcceptChannel this_ptr_conv;
31553         this_ptr_conv.inner = untag_ptr(this_ptr);
31554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31556         this_ptr_conv.is_owned = false;
31557         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
31558 }
31559
31560 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) {
31561         LDKAcceptChannel this_ptr_conv;
31562         this_ptr_conv.inner = untag_ptr(this_ptr);
31563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31565         this_ptr_conv.is_owned = false;
31566         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
31567         return ret_conv;
31568 }
31569
31570 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) {
31571         LDKAcceptChannel this_ptr_conv;
31572         this_ptr_conv.inner = untag_ptr(this_ptr);
31573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31575         this_ptr_conv.is_owned = false;
31576         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
31577 }
31578
31579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31580         LDKAcceptChannel this_ptr_conv;
31581         this_ptr_conv.inner = untag_ptr(this_ptr);
31582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31584         this_ptr_conv.is_owned = false;
31585         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
31586         return ret_conv;
31587 }
31588
31589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31590         LDKAcceptChannel this_ptr_conv;
31591         this_ptr_conv.inner = untag_ptr(this_ptr);
31592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31594         this_ptr_conv.is_owned = false;
31595         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
31596 }
31597
31598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31599         LDKAcceptChannel this_ptr_conv;
31600         this_ptr_conv.inner = untag_ptr(this_ptr);
31601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31603         this_ptr_conv.is_owned = false;
31604         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
31605         return ret_conv;
31606 }
31607
31608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31609         LDKAcceptChannel this_ptr_conv;
31610         this_ptr_conv.inner = untag_ptr(this_ptr);
31611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31613         this_ptr_conv.is_owned = false;
31614         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
31615 }
31616
31617 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
31618         LDKAcceptChannel this_ptr_conv;
31619         this_ptr_conv.inner = untag_ptr(this_ptr);
31620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31622         this_ptr_conv.is_owned = false;
31623         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
31624         return ret_conv;
31625 }
31626
31627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31628         LDKAcceptChannel this_ptr_conv;
31629         this_ptr_conv.inner = untag_ptr(this_ptr);
31630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31632         this_ptr_conv.is_owned = false;
31633         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
31634 }
31635
31636 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
31637         LDKAcceptChannel this_ptr_conv;
31638         this_ptr_conv.inner = untag_ptr(this_ptr);
31639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31641         this_ptr_conv.is_owned = false;
31642         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
31643         return ret_conv;
31644 }
31645
31646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31647         LDKAcceptChannel this_ptr_conv;
31648         this_ptr_conv.inner = untag_ptr(this_ptr);
31649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31651         this_ptr_conv.is_owned = false;
31652         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
31653 }
31654
31655 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
31656         LDKAcceptChannel this_ptr_conv;
31657         this_ptr_conv.inner = untag_ptr(this_ptr);
31658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31660         this_ptr_conv.is_owned = false;
31661         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
31662         return ret_conv;
31663 }
31664
31665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31666         LDKAcceptChannel this_ptr_conv;
31667         this_ptr_conv.inner = untag_ptr(this_ptr);
31668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31670         this_ptr_conv.is_owned = false;
31671         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
31672 }
31673
31674 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31675         LDKAcceptChannel this_ptr_conv;
31676         this_ptr_conv.inner = untag_ptr(this_ptr);
31677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31679         this_ptr_conv.is_owned = false;
31680         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31681         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
31682         return ret_arr;
31683 }
31684
31685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31686         LDKAcceptChannel this_ptr_conv;
31687         this_ptr_conv.inner = untag_ptr(this_ptr);
31688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31690         this_ptr_conv.is_owned = false;
31691         LDKPublicKey val_ref;
31692         CHECK((*env)->GetArrayLength(env, val) == 33);
31693         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31694         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31695 }
31696
31697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31698         LDKAcceptChannel this_ptr_conv;
31699         this_ptr_conv.inner = untag_ptr(this_ptr);
31700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31702         this_ptr_conv.is_owned = false;
31703         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31704         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31705         return ret_arr;
31706 }
31707
31708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31709         LDKAcceptChannel this_ptr_conv;
31710         this_ptr_conv.inner = untag_ptr(this_ptr);
31711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31713         this_ptr_conv.is_owned = false;
31714         LDKPublicKey val_ref;
31715         CHECK((*env)->GetArrayLength(env, val) == 33);
31716         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31717         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31718 }
31719
31720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31721         LDKAcceptChannel this_ptr_conv;
31722         this_ptr_conv.inner = untag_ptr(this_ptr);
31723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31725         this_ptr_conv.is_owned = false;
31726         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31727         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
31728         return ret_arr;
31729 }
31730
31731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31732         LDKAcceptChannel this_ptr_conv;
31733         this_ptr_conv.inner = untag_ptr(this_ptr);
31734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31736         this_ptr_conv.is_owned = false;
31737         LDKPublicKey val_ref;
31738         CHECK((*env)->GetArrayLength(env, val) == 33);
31739         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31740         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31741 }
31742
31743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31744         LDKAcceptChannel this_ptr_conv;
31745         this_ptr_conv.inner = untag_ptr(this_ptr);
31746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31748         this_ptr_conv.is_owned = false;
31749         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31750         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31751         return ret_arr;
31752 }
31753
31754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31755         LDKAcceptChannel this_ptr_conv;
31756         this_ptr_conv.inner = untag_ptr(this_ptr);
31757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31759         this_ptr_conv.is_owned = false;
31760         LDKPublicKey val_ref;
31761         CHECK((*env)->GetArrayLength(env, val) == 33);
31762         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31763         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31764 }
31765
31766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31767         LDKAcceptChannel this_ptr_conv;
31768         this_ptr_conv.inner = untag_ptr(this_ptr);
31769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31771         this_ptr_conv.is_owned = false;
31772         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31773         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31774         return ret_arr;
31775 }
31776
31777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31778         LDKAcceptChannel this_ptr_conv;
31779         this_ptr_conv.inner = untag_ptr(this_ptr);
31780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31782         this_ptr_conv.is_owned = false;
31783         LDKPublicKey val_ref;
31784         CHECK((*env)->GetArrayLength(env, val) == 33);
31785         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31786         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31787 }
31788
31789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31790         LDKAcceptChannel this_ptr_conv;
31791         this_ptr_conv.inner = untag_ptr(this_ptr);
31792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31794         this_ptr_conv.is_owned = false;
31795         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31796         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31797         return ret_arr;
31798 }
31799
31800 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) {
31801         LDKAcceptChannel this_ptr_conv;
31802         this_ptr_conv.inner = untag_ptr(this_ptr);
31803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31805         this_ptr_conv.is_owned = false;
31806         LDKPublicKey val_ref;
31807         CHECK((*env)->GetArrayLength(env, val) == 33);
31808         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31809         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31810 }
31811
31812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31813         LDKAcceptChannel this_ptr_conv;
31814         this_ptr_conv.inner = untag_ptr(this_ptr);
31815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31817         this_ptr_conv.is_owned = false;
31818         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31819         int64_t ret_ref = 0;
31820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31822         return ret_ref;
31823 }
31824
31825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31826         LDKAcceptChannel this_ptr_conv;
31827         this_ptr_conv.inner = untag_ptr(this_ptr);
31828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31830         this_ptr_conv.is_owned = false;
31831         LDKChannelTypeFeatures val_conv;
31832         val_conv.inner = untag_ptr(val);
31833         val_conv.is_owned = ptr_is_owned(val);
31834         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31835         val_conv = ChannelTypeFeatures_clone(&val_conv);
31836         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31837 }
31838
31839 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31840         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31841         int64_t ret_ref = 0;
31842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31844         return ret_ref;
31845 }
31846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31847         LDKAcceptChannel arg_conv;
31848         arg_conv.inner = untag_ptr(arg);
31849         arg_conv.is_owned = ptr_is_owned(arg);
31850         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31851         arg_conv.is_owned = false;
31852         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31853         return ret_conv;
31854 }
31855
31856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31857         LDKAcceptChannel orig_conv;
31858         orig_conv.inner = untag_ptr(orig);
31859         orig_conv.is_owned = ptr_is_owned(orig);
31860         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31861         orig_conv.is_owned = false;
31862         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31863         int64_t ret_ref = 0;
31864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31866         return ret_ref;
31867 }
31868
31869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31870         LDKFundingCreated this_obj_conv;
31871         this_obj_conv.inner = untag_ptr(this_obj);
31872         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31874         FundingCreated_free(this_obj_conv);
31875 }
31876
31877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31878         LDKFundingCreated this_ptr_conv;
31879         this_ptr_conv.inner = untag_ptr(this_ptr);
31880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31882         this_ptr_conv.is_owned = false;
31883         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31884         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
31885         return ret_arr;
31886 }
31887
31888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31889         LDKFundingCreated this_ptr_conv;
31890         this_ptr_conv.inner = untag_ptr(this_ptr);
31891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31893         this_ptr_conv.is_owned = false;
31894         LDKThirtyTwoBytes val_ref;
31895         CHECK((*env)->GetArrayLength(env, val) == 32);
31896         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31897         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31898 }
31899
31900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
31901         LDKFundingCreated this_ptr_conv;
31902         this_ptr_conv.inner = untag_ptr(this_ptr);
31903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31905         this_ptr_conv.is_owned = false;
31906         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31907         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
31908         return ret_arr;
31909 }
31910
31911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31912         LDKFundingCreated this_ptr_conv;
31913         this_ptr_conv.inner = untag_ptr(this_ptr);
31914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31916         this_ptr_conv.is_owned = false;
31917         LDKThirtyTwoBytes val_ref;
31918         CHECK((*env)->GetArrayLength(env, val) == 32);
31919         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31920         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31921 }
31922
31923 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
31924         LDKFundingCreated this_ptr_conv;
31925         this_ptr_conv.inner = untag_ptr(this_ptr);
31926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31928         this_ptr_conv.is_owned = false;
31929         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31930         return ret_conv;
31931 }
31932
31933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31934         LDKFundingCreated this_ptr_conv;
31935         this_ptr_conv.inner = untag_ptr(this_ptr);
31936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31938         this_ptr_conv.is_owned = false;
31939         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31940 }
31941
31942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31943         LDKFundingCreated this_ptr_conv;
31944         this_ptr_conv.inner = untag_ptr(this_ptr);
31945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31947         this_ptr_conv.is_owned = false;
31948         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31949         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
31950         return ret_arr;
31951 }
31952
31953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31954         LDKFundingCreated this_ptr_conv;
31955         this_ptr_conv.inner = untag_ptr(this_ptr);
31956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31958         this_ptr_conv.is_owned = false;
31959         LDKSignature val_ref;
31960         CHECK((*env)->GetArrayLength(env, val) == 64);
31961         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31962         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31963 }
31964
31965 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) {
31966         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31967         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
31968         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
31969         LDKThirtyTwoBytes funding_txid_arg_ref;
31970         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
31971         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
31972         LDKSignature signature_arg_ref;
31973         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31974         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31975         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31976         int64_t ret_ref = 0;
31977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31979         return ret_ref;
31980 }
31981
31982 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31983         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31984         int64_t ret_ref = 0;
31985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31987         return ret_ref;
31988 }
31989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31990         LDKFundingCreated arg_conv;
31991         arg_conv.inner = untag_ptr(arg);
31992         arg_conv.is_owned = ptr_is_owned(arg);
31993         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31994         arg_conv.is_owned = false;
31995         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31996         return ret_conv;
31997 }
31998
31999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32000         LDKFundingCreated orig_conv;
32001         orig_conv.inner = untag_ptr(orig);
32002         orig_conv.is_owned = ptr_is_owned(orig);
32003         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32004         orig_conv.is_owned = false;
32005         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
32006         int64_t ret_ref = 0;
32007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32009         return ret_ref;
32010 }
32011
32012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32013         LDKFundingSigned this_obj_conv;
32014         this_obj_conv.inner = untag_ptr(this_obj);
32015         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32017         FundingSigned_free(this_obj_conv);
32018 }
32019
32020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32021         LDKFundingSigned this_ptr_conv;
32022         this_ptr_conv.inner = untag_ptr(this_ptr);
32023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32025         this_ptr_conv.is_owned = false;
32026         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32027         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
32028         return ret_arr;
32029 }
32030
32031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32032         LDKFundingSigned this_ptr_conv;
32033         this_ptr_conv.inner = untag_ptr(this_ptr);
32034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32036         this_ptr_conv.is_owned = false;
32037         LDKThirtyTwoBytes val_ref;
32038         CHECK((*env)->GetArrayLength(env, val) == 32);
32039         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32040         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
32041 }
32042
32043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32044         LDKFundingSigned this_ptr_conv;
32045         this_ptr_conv.inner = untag_ptr(this_ptr);
32046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32048         this_ptr_conv.is_owned = false;
32049         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32050         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
32051         return ret_arr;
32052 }
32053
32054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32055         LDKFundingSigned this_ptr_conv;
32056         this_ptr_conv.inner = untag_ptr(this_ptr);
32057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32059         this_ptr_conv.is_owned = false;
32060         LDKSignature val_ref;
32061         CHECK((*env)->GetArrayLength(env, val) == 64);
32062         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32063         FundingSigned_set_signature(&this_ptr_conv, val_ref);
32064 }
32065
32066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
32067         LDKThirtyTwoBytes channel_id_arg_ref;
32068         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32069         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32070         LDKSignature signature_arg_ref;
32071         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32072         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32073         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
32074         int64_t ret_ref = 0;
32075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32077         return ret_ref;
32078 }
32079
32080 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
32081         LDKFundingSigned ret_var = FundingSigned_clone(arg);
32082         int64_t ret_ref = 0;
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32085         return ret_ref;
32086 }
32087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32088         LDKFundingSigned arg_conv;
32089         arg_conv.inner = untag_ptr(arg);
32090         arg_conv.is_owned = ptr_is_owned(arg);
32091         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32092         arg_conv.is_owned = false;
32093         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
32094         return ret_conv;
32095 }
32096
32097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32098         LDKFundingSigned orig_conv;
32099         orig_conv.inner = untag_ptr(orig);
32100         orig_conv.is_owned = ptr_is_owned(orig);
32101         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32102         orig_conv.is_owned = false;
32103         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
32104         int64_t ret_ref = 0;
32105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32107         return ret_ref;
32108 }
32109
32110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32111         LDKChannelReady this_obj_conv;
32112         this_obj_conv.inner = untag_ptr(this_obj);
32113         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32115         ChannelReady_free(this_obj_conv);
32116 }
32117
32118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32119         LDKChannelReady this_ptr_conv;
32120         this_ptr_conv.inner = untag_ptr(this_ptr);
32121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32123         this_ptr_conv.is_owned = false;
32124         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32125         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
32126         return ret_arr;
32127 }
32128
32129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32130         LDKChannelReady this_ptr_conv;
32131         this_ptr_conv.inner = untag_ptr(this_ptr);
32132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32134         this_ptr_conv.is_owned = false;
32135         LDKThirtyTwoBytes val_ref;
32136         CHECK((*env)->GetArrayLength(env, val) == 32);
32137         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32138         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
32139 }
32140
32141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32142         LDKChannelReady this_ptr_conv;
32143         this_ptr_conv.inner = untag_ptr(this_ptr);
32144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32146         this_ptr_conv.is_owned = false;
32147         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32148         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
32149         return ret_arr;
32150 }
32151
32152 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) {
32153         LDKChannelReady this_ptr_conv;
32154         this_ptr_conv.inner = untag_ptr(this_ptr);
32155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32157         this_ptr_conv.is_owned = false;
32158         LDKPublicKey val_ref;
32159         CHECK((*env)->GetArrayLength(env, val) == 33);
32160         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32161         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32162 }
32163
32164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32165         LDKChannelReady 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32171         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
32172         int64_t ret_ref = tag_ptr(ret_copy, true);
32173         return ret_ref;
32174 }
32175
32176 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) {
32177         LDKChannelReady this_ptr_conv;
32178         this_ptr_conv.inner = untag_ptr(this_ptr);
32179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32181         this_ptr_conv.is_owned = false;
32182         void* val_ptr = untag_ptr(val);
32183         CHECK_ACCESS(val_ptr);
32184         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32185         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32186         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
32187 }
32188
32189 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) {
32190         LDKThirtyTwoBytes channel_id_arg_ref;
32191         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32192         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32193         LDKPublicKey next_per_commitment_point_arg_ref;
32194         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
32195         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
32196         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
32197         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
32198         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
32199         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
32200         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
32201         int64_t ret_ref = 0;
32202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32204         return ret_ref;
32205 }
32206
32207 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
32208         LDKChannelReady ret_var = ChannelReady_clone(arg);
32209         int64_t ret_ref = 0;
32210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32212         return ret_ref;
32213 }
32214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32215         LDKChannelReady arg_conv;
32216         arg_conv.inner = untag_ptr(arg);
32217         arg_conv.is_owned = ptr_is_owned(arg);
32218         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32219         arg_conv.is_owned = false;
32220         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
32221         return ret_conv;
32222 }
32223
32224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32225         LDKChannelReady orig_conv;
32226         orig_conv.inner = untag_ptr(orig);
32227         orig_conv.is_owned = ptr_is_owned(orig);
32228         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32229         orig_conv.is_owned = false;
32230         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
32231         int64_t ret_ref = 0;
32232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32234         return ret_ref;
32235 }
32236
32237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32238         LDKShutdown this_obj_conv;
32239         this_obj_conv.inner = untag_ptr(this_obj);
32240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32242         Shutdown_free(this_obj_conv);
32243 }
32244
32245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32246         LDKShutdown this_ptr_conv;
32247         this_ptr_conv.inner = untag_ptr(this_ptr);
32248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32250         this_ptr_conv.is_owned = false;
32251         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32252         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
32253         return ret_arr;
32254 }
32255
32256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32257         LDKShutdown this_ptr_conv;
32258         this_ptr_conv.inner = untag_ptr(this_ptr);
32259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32261         this_ptr_conv.is_owned = false;
32262         LDKThirtyTwoBytes val_ref;
32263         CHECK((*env)->GetArrayLength(env, val) == 32);
32264         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32265         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
32266 }
32267
32268 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
32269         LDKShutdown this_ptr_conv;
32270         this_ptr_conv.inner = untag_ptr(this_ptr);
32271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32273         this_ptr_conv.is_owned = false;
32274         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
32275         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32276         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32277         return ret_arr;
32278 }
32279
32280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32281         LDKShutdown this_ptr_conv;
32282         this_ptr_conv.inner = untag_ptr(this_ptr);
32283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32285         this_ptr_conv.is_owned = false;
32286         LDKCVec_u8Z val_ref;
32287         val_ref.datalen = (*env)->GetArrayLength(env, val);
32288         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32289         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
32290         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
32291 }
32292
32293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
32294         LDKThirtyTwoBytes channel_id_arg_ref;
32295         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32296         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32297         LDKCVec_u8Z scriptpubkey_arg_ref;
32298         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
32299         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32300         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
32301         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
32302         int64_t ret_ref = 0;
32303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32305         return ret_ref;
32306 }
32307
32308 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
32309         LDKShutdown ret_var = Shutdown_clone(arg);
32310         int64_t ret_ref = 0;
32311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32313         return ret_ref;
32314 }
32315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32316         LDKShutdown arg_conv;
32317         arg_conv.inner = untag_ptr(arg);
32318         arg_conv.is_owned = ptr_is_owned(arg);
32319         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32320         arg_conv.is_owned = false;
32321         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
32322         return ret_conv;
32323 }
32324
32325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32326         LDKShutdown orig_conv;
32327         orig_conv.inner = untag_ptr(orig);
32328         orig_conv.is_owned = ptr_is_owned(orig);
32329         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32330         orig_conv.is_owned = false;
32331         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
32332         int64_t ret_ref = 0;
32333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32335         return ret_ref;
32336 }
32337
32338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32339         LDKClosingSignedFeeRange this_obj_conv;
32340         this_obj_conv.inner = untag_ptr(this_obj);
32341         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32343         ClosingSignedFeeRange_free(this_obj_conv);
32344 }
32345
32346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32347         LDKClosingSignedFeeRange this_ptr_conv;
32348         this_ptr_conv.inner = untag_ptr(this_ptr);
32349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32351         this_ptr_conv.is_owned = false;
32352         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
32353         return ret_conv;
32354 }
32355
32356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32357         LDKClosingSignedFeeRange this_ptr_conv;
32358         this_ptr_conv.inner = untag_ptr(this_ptr);
32359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32361         this_ptr_conv.is_owned = false;
32362         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
32363 }
32364
32365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32366         LDKClosingSignedFeeRange this_ptr_conv;
32367         this_ptr_conv.inner = untag_ptr(this_ptr);
32368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32370         this_ptr_conv.is_owned = false;
32371         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
32372         return ret_conv;
32373 }
32374
32375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32376         LDKClosingSignedFeeRange this_ptr_conv;
32377         this_ptr_conv.inner = untag_ptr(this_ptr);
32378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32380         this_ptr_conv.is_owned = false;
32381         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
32382 }
32383
32384 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) {
32385         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
32386         int64_t ret_ref = 0;
32387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32389         return ret_ref;
32390 }
32391
32392 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
32393         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
32394         int64_t ret_ref = 0;
32395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32397         return ret_ref;
32398 }
32399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32400         LDKClosingSignedFeeRange arg_conv;
32401         arg_conv.inner = untag_ptr(arg);
32402         arg_conv.is_owned = ptr_is_owned(arg);
32403         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32404         arg_conv.is_owned = false;
32405         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
32406         return ret_conv;
32407 }
32408
32409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32410         LDKClosingSignedFeeRange orig_conv;
32411         orig_conv.inner = untag_ptr(orig);
32412         orig_conv.is_owned = ptr_is_owned(orig);
32413         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32414         orig_conv.is_owned = false;
32415         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
32416         int64_t ret_ref = 0;
32417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32419         return ret_ref;
32420 }
32421
32422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32423         LDKClosingSigned this_obj_conv;
32424         this_obj_conv.inner = untag_ptr(this_obj);
32425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32427         ClosingSigned_free(this_obj_conv);
32428 }
32429
32430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32431         LDKClosingSigned 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32437         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
32438         return ret_arr;
32439 }
32440
32441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32442         LDKClosingSigned this_ptr_conv;
32443         this_ptr_conv.inner = untag_ptr(this_ptr);
32444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32446         this_ptr_conv.is_owned = false;
32447         LDKThirtyTwoBytes val_ref;
32448         CHECK((*env)->GetArrayLength(env, val) == 32);
32449         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32450         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
32451 }
32452
32453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
32454         LDKClosingSigned this_ptr_conv;
32455         this_ptr_conv.inner = untag_ptr(this_ptr);
32456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32458         this_ptr_conv.is_owned = false;
32459         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
32460         return ret_conv;
32461 }
32462
32463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32464         LDKClosingSigned this_ptr_conv;
32465         this_ptr_conv.inner = untag_ptr(this_ptr);
32466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32468         this_ptr_conv.is_owned = false;
32469         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
32470 }
32471
32472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32473         LDKClosingSigned 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
32480         return ret_arr;
32481 }
32482
32483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32484         LDKClosingSigned this_ptr_conv;
32485         this_ptr_conv.inner = untag_ptr(this_ptr);
32486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32488         this_ptr_conv.is_owned = false;
32489         LDKSignature val_ref;
32490         CHECK((*env)->GetArrayLength(env, val) == 64);
32491         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32492         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
32493 }
32494
32495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
32496         LDKClosingSigned this_ptr_conv;
32497         this_ptr_conv.inner = untag_ptr(this_ptr);
32498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32500         this_ptr_conv.is_owned = false;
32501         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
32502         int64_t ret_ref = 0;
32503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32505         return ret_ref;
32506 }
32507
32508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32509         LDKClosingSigned this_ptr_conv;
32510         this_ptr_conv.inner = untag_ptr(this_ptr);
32511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32513         this_ptr_conv.is_owned = false;
32514         LDKClosingSignedFeeRange val_conv;
32515         val_conv.inner = untag_ptr(val);
32516         val_conv.is_owned = ptr_is_owned(val);
32517         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32518         val_conv = ClosingSignedFeeRange_clone(&val_conv);
32519         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
32520 }
32521
32522 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) {
32523         LDKThirtyTwoBytes channel_id_arg_ref;
32524         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32525         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32526         LDKSignature signature_arg_ref;
32527         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32528         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32529         LDKClosingSignedFeeRange fee_range_arg_conv;
32530         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
32531         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
32532         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
32533         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
32534         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
32535         int64_t ret_ref = 0;
32536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32538         return ret_ref;
32539 }
32540
32541 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
32542         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
32543         int64_t ret_ref = 0;
32544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32546         return ret_ref;
32547 }
32548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32549         LDKClosingSigned arg_conv;
32550         arg_conv.inner = untag_ptr(arg);
32551         arg_conv.is_owned = ptr_is_owned(arg);
32552         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32553         arg_conv.is_owned = false;
32554         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
32555         return ret_conv;
32556 }
32557
32558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32559         LDKClosingSigned orig_conv;
32560         orig_conv.inner = untag_ptr(orig);
32561         orig_conv.is_owned = ptr_is_owned(orig);
32562         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32563         orig_conv.is_owned = false;
32564         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
32565         int64_t ret_ref = 0;
32566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32568         return ret_ref;
32569 }
32570
32571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32572         LDKUpdateAddHTLC this_obj_conv;
32573         this_obj_conv.inner = untag_ptr(this_obj);
32574         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32576         UpdateAddHTLC_free(this_obj_conv);
32577 }
32578
32579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32580         LDKUpdateAddHTLC this_ptr_conv;
32581         this_ptr_conv.inner = untag_ptr(this_ptr);
32582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32584         this_ptr_conv.is_owned = false;
32585         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32586         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
32587         return ret_arr;
32588 }
32589
32590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32591         LDKUpdateAddHTLC this_ptr_conv;
32592         this_ptr_conv.inner = untag_ptr(this_ptr);
32593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32595         this_ptr_conv.is_owned = false;
32596         LDKThirtyTwoBytes val_ref;
32597         CHECK((*env)->GetArrayLength(env, val) == 32);
32598         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32599         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
32600 }
32601
32602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32603         LDKUpdateAddHTLC this_ptr_conv;
32604         this_ptr_conv.inner = untag_ptr(this_ptr);
32605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32607         this_ptr_conv.is_owned = false;
32608         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
32609         return ret_conv;
32610 }
32611
32612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32613         LDKUpdateAddHTLC this_ptr_conv;
32614         this_ptr_conv.inner = untag_ptr(this_ptr);
32615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32617         this_ptr_conv.is_owned = false;
32618         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
32619 }
32620
32621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
32622         LDKUpdateAddHTLC this_ptr_conv;
32623         this_ptr_conv.inner = untag_ptr(this_ptr);
32624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32626         this_ptr_conv.is_owned = false;
32627         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
32628         return ret_conv;
32629 }
32630
32631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32632         LDKUpdateAddHTLC this_ptr_conv;
32633         this_ptr_conv.inner = untag_ptr(this_ptr);
32634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32636         this_ptr_conv.is_owned = false;
32637         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
32638 }
32639
32640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32641         LDKUpdateAddHTLC this_ptr_conv;
32642         this_ptr_conv.inner = untag_ptr(this_ptr);
32643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32645         this_ptr_conv.is_owned = false;
32646         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32647         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
32648         return ret_arr;
32649 }
32650
32651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32652         LDKUpdateAddHTLC this_ptr_conv;
32653         this_ptr_conv.inner = untag_ptr(this_ptr);
32654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32656         this_ptr_conv.is_owned = false;
32657         LDKThirtyTwoBytes val_ref;
32658         CHECK((*env)->GetArrayLength(env, val) == 32);
32659         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32660         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32661 }
32662
32663 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
32664         LDKUpdateAddHTLC this_ptr_conv;
32665         this_ptr_conv.inner = untag_ptr(this_ptr);
32666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32668         this_ptr_conv.is_owned = false;
32669         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32670         return ret_conv;
32671 }
32672
32673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32674         LDKUpdateAddHTLC this_ptr_conv;
32675         this_ptr_conv.inner = untag_ptr(this_ptr);
32676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32678         this_ptr_conv.is_owned = false;
32679         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32680 }
32681
32682 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32683         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32684         int64_t ret_ref = 0;
32685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32687         return ret_ref;
32688 }
32689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32690         LDKUpdateAddHTLC arg_conv;
32691         arg_conv.inner = untag_ptr(arg);
32692         arg_conv.is_owned = ptr_is_owned(arg);
32693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32694         arg_conv.is_owned = false;
32695         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32696         return ret_conv;
32697 }
32698
32699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32700         LDKUpdateAddHTLC orig_conv;
32701         orig_conv.inner = untag_ptr(orig);
32702         orig_conv.is_owned = ptr_is_owned(orig);
32703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32704         orig_conv.is_owned = false;
32705         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32706         int64_t ret_ref = 0;
32707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32709         return ret_ref;
32710 }
32711
32712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32713         LDKUpdateFulfillHTLC this_obj_conv;
32714         this_obj_conv.inner = untag_ptr(this_obj);
32715         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32717         UpdateFulfillHTLC_free(this_obj_conv);
32718 }
32719
32720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32721         LDKUpdateFulfillHTLC this_ptr_conv;
32722         this_ptr_conv.inner = untag_ptr(this_ptr);
32723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32725         this_ptr_conv.is_owned = false;
32726         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32727         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
32728         return ret_arr;
32729 }
32730
32731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32732         LDKUpdateFulfillHTLC this_ptr_conv;
32733         this_ptr_conv.inner = untag_ptr(this_ptr);
32734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32736         this_ptr_conv.is_owned = false;
32737         LDKThirtyTwoBytes val_ref;
32738         CHECK((*env)->GetArrayLength(env, val) == 32);
32739         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32740         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32741 }
32742
32743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32744         LDKUpdateFulfillHTLC this_ptr_conv;
32745         this_ptr_conv.inner = untag_ptr(this_ptr);
32746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32748         this_ptr_conv.is_owned = false;
32749         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32750         return ret_conv;
32751 }
32752
32753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32754         LDKUpdateFulfillHTLC this_ptr_conv;
32755         this_ptr_conv.inner = untag_ptr(this_ptr);
32756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32758         this_ptr_conv.is_owned = false;
32759         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32760 }
32761
32762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
32763         LDKUpdateFulfillHTLC this_ptr_conv;
32764         this_ptr_conv.inner = untag_ptr(this_ptr);
32765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32767         this_ptr_conv.is_owned = false;
32768         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32769         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
32770         return ret_arr;
32771 }
32772
32773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32774         LDKUpdateFulfillHTLC this_ptr_conv;
32775         this_ptr_conv.inner = untag_ptr(this_ptr);
32776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32778         this_ptr_conv.is_owned = false;
32779         LDKThirtyTwoBytes val_ref;
32780         CHECK((*env)->GetArrayLength(env, val) == 32);
32781         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32782         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32783 }
32784
32785 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) {
32786         LDKThirtyTwoBytes channel_id_arg_ref;
32787         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32788         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32789         LDKThirtyTwoBytes payment_preimage_arg_ref;
32790         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
32791         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
32792         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32793         int64_t ret_ref = 0;
32794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32796         return ret_ref;
32797 }
32798
32799 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32800         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32807         LDKUpdateFulfillHTLC arg_conv;
32808         arg_conv.inner = untag_ptr(arg);
32809         arg_conv.is_owned = ptr_is_owned(arg);
32810         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32811         arg_conv.is_owned = false;
32812         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32813         return ret_conv;
32814 }
32815
32816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32817         LDKUpdateFulfillHTLC orig_conv;
32818         orig_conv.inner = untag_ptr(orig);
32819         orig_conv.is_owned = ptr_is_owned(orig);
32820         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32821         orig_conv.is_owned = false;
32822         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32823         int64_t ret_ref = 0;
32824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32826         return ret_ref;
32827 }
32828
32829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32830         LDKUpdateFailHTLC this_obj_conv;
32831         this_obj_conv.inner = untag_ptr(this_obj);
32832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32834         UpdateFailHTLC_free(this_obj_conv);
32835 }
32836
32837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32838         LDKUpdateFailHTLC this_ptr_conv;
32839         this_ptr_conv.inner = untag_ptr(this_ptr);
32840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32842         this_ptr_conv.is_owned = false;
32843         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32844         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
32845         return ret_arr;
32846 }
32847
32848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32849         LDKUpdateFailHTLC this_ptr_conv;
32850         this_ptr_conv.inner = untag_ptr(this_ptr);
32851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32853         this_ptr_conv.is_owned = false;
32854         LDKThirtyTwoBytes val_ref;
32855         CHECK((*env)->GetArrayLength(env, val) == 32);
32856         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32857         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32858 }
32859
32860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32861         LDKUpdateFailHTLC this_ptr_conv;
32862         this_ptr_conv.inner = untag_ptr(this_ptr);
32863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32865         this_ptr_conv.is_owned = false;
32866         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32867         return ret_conv;
32868 }
32869
32870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32871         LDKUpdateFailHTLC this_ptr_conv;
32872         this_ptr_conv.inner = untag_ptr(this_ptr);
32873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32875         this_ptr_conv.is_owned = false;
32876         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32877 }
32878
32879 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32880         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32881         int64_t ret_ref = 0;
32882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32884         return ret_ref;
32885 }
32886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32887         LDKUpdateFailHTLC arg_conv;
32888         arg_conv.inner = untag_ptr(arg);
32889         arg_conv.is_owned = ptr_is_owned(arg);
32890         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32891         arg_conv.is_owned = false;
32892         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32893         return ret_conv;
32894 }
32895
32896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32897         LDKUpdateFailHTLC orig_conv;
32898         orig_conv.inner = untag_ptr(orig);
32899         orig_conv.is_owned = ptr_is_owned(orig);
32900         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32901         orig_conv.is_owned = false;
32902         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32903         int64_t ret_ref = 0;
32904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32906         return ret_ref;
32907 }
32908
32909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32910         LDKUpdateFailMalformedHTLC this_obj_conv;
32911         this_obj_conv.inner = untag_ptr(this_obj);
32912         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32914         UpdateFailMalformedHTLC_free(this_obj_conv);
32915 }
32916
32917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32918         LDKUpdateFailMalformedHTLC this_ptr_conv;
32919         this_ptr_conv.inner = untag_ptr(this_ptr);
32920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32922         this_ptr_conv.is_owned = false;
32923         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32924         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
32925         return ret_arr;
32926 }
32927
32928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32929         LDKUpdateFailMalformedHTLC this_ptr_conv;
32930         this_ptr_conv.inner = untag_ptr(this_ptr);
32931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32933         this_ptr_conv.is_owned = false;
32934         LDKThirtyTwoBytes val_ref;
32935         CHECK((*env)->GetArrayLength(env, val) == 32);
32936         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32937         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32938 }
32939
32940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32941         LDKUpdateFailMalformedHTLC this_ptr_conv;
32942         this_ptr_conv.inner = untag_ptr(this_ptr);
32943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32945         this_ptr_conv.is_owned = false;
32946         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32947         return ret_conv;
32948 }
32949
32950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32951         LDKUpdateFailMalformedHTLC this_ptr_conv;
32952         this_ptr_conv.inner = untag_ptr(this_ptr);
32953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32955         this_ptr_conv.is_owned = false;
32956         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32957 }
32958
32959 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
32960         LDKUpdateFailMalformedHTLC this_ptr_conv;
32961         this_ptr_conv.inner = untag_ptr(this_ptr);
32962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32964         this_ptr_conv.is_owned = false;
32965         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32966         return ret_conv;
32967 }
32968
32969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32970         LDKUpdateFailMalformedHTLC this_ptr_conv;
32971         this_ptr_conv.inner = untag_ptr(this_ptr);
32972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32974         this_ptr_conv.is_owned = false;
32975         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32976 }
32977
32978 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32979         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32980         int64_t ret_ref = 0;
32981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32983         return ret_ref;
32984 }
32985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32986         LDKUpdateFailMalformedHTLC arg_conv;
32987         arg_conv.inner = untag_ptr(arg);
32988         arg_conv.is_owned = ptr_is_owned(arg);
32989         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32990         arg_conv.is_owned = false;
32991         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32992         return ret_conv;
32993 }
32994
32995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32996         LDKUpdateFailMalformedHTLC orig_conv;
32997         orig_conv.inner = untag_ptr(orig);
32998         orig_conv.is_owned = ptr_is_owned(orig);
32999         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33000         orig_conv.is_owned = false;
33001         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
33002         int64_t ret_ref = 0;
33003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33005         return ret_ref;
33006 }
33007
33008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33009         LDKCommitmentSigned this_obj_conv;
33010         this_obj_conv.inner = untag_ptr(this_obj);
33011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33013         CommitmentSigned_free(this_obj_conv);
33014 }
33015
33016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33017         LDKCommitmentSigned this_ptr_conv;
33018         this_ptr_conv.inner = untag_ptr(this_ptr);
33019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33021         this_ptr_conv.is_owned = false;
33022         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33023         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
33024         return ret_arr;
33025 }
33026
33027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33028         LDKCommitmentSigned this_ptr_conv;
33029         this_ptr_conv.inner = untag_ptr(this_ptr);
33030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33032         this_ptr_conv.is_owned = false;
33033         LDKThirtyTwoBytes val_ref;
33034         CHECK((*env)->GetArrayLength(env, val) == 32);
33035         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33036         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
33037 }
33038
33039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33040         LDKCommitmentSigned this_ptr_conv;
33041         this_ptr_conv.inner = untag_ptr(this_ptr);
33042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33044         this_ptr_conv.is_owned = false;
33045         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33046         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
33047         return ret_arr;
33048 }
33049
33050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33051         LDKCommitmentSigned this_ptr_conv;
33052         this_ptr_conv.inner = untag_ptr(this_ptr);
33053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33055         this_ptr_conv.is_owned = false;
33056         LDKSignature val_ref;
33057         CHECK((*env)->GetArrayLength(env, val) == 64);
33058         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33059         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
33060 }
33061
33062 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
33063         LDKCommitmentSigned this_ptr_conv;
33064         this_ptr_conv.inner = untag_ptr(this_ptr);
33065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33067         this_ptr_conv.is_owned = false;
33068         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
33069         jobjectArray ret_arr = NULL;
33070         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
33071         ;
33072         for (size_t i = 0; i < ret_var.datalen; i++) {
33073                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
33074                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
33075                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
33076         }
33077         
33078         FREE(ret_var.data);
33079         return ret_arr;
33080 }
33081
33082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
33083         LDKCommitmentSigned this_ptr_conv;
33084         this_ptr_conv.inner = untag_ptr(this_ptr);
33085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33087         this_ptr_conv.is_owned = false;
33088         LDKCVec_SignatureZ val_constr;
33089         val_constr.datalen = (*env)->GetArrayLength(env, val);
33090         if (val_constr.datalen > 0)
33091                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33092         else
33093                 val_constr.data = NULL;
33094         for (size_t i = 0; i < val_constr.datalen; i++) {
33095                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
33096                 LDKSignature val_conv_8_ref;
33097                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
33098                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
33099                 val_constr.data[i] = val_conv_8_ref;
33100         }
33101         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
33102 }
33103
33104 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) {
33105         LDKThirtyTwoBytes channel_id_arg_ref;
33106         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33107         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33108         LDKSignature signature_arg_ref;
33109         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33110         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33111         LDKCVec_SignatureZ htlc_signatures_arg_constr;
33112         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
33113         if (htlc_signatures_arg_constr.datalen > 0)
33114                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
33115         else
33116                 htlc_signatures_arg_constr.data = NULL;
33117         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
33118                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
33119                 LDKSignature htlc_signatures_arg_conv_8_ref;
33120                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
33121                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
33122                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
33123         }
33124         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
33125         int64_t ret_ref = 0;
33126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33128         return ret_ref;
33129 }
33130
33131 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
33132         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
33133         int64_t ret_ref = 0;
33134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33136         return ret_ref;
33137 }
33138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33139         LDKCommitmentSigned arg_conv;
33140         arg_conv.inner = untag_ptr(arg);
33141         arg_conv.is_owned = ptr_is_owned(arg);
33142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33143         arg_conv.is_owned = false;
33144         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
33145         return ret_conv;
33146 }
33147
33148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33149         LDKCommitmentSigned orig_conv;
33150         orig_conv.inner = untag_ptr(orig);
33151         orig_conv.is_owned = ptr_is_owned(orig);
33152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33153         orig_conv.is_owned = false;
33154         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
33155         int64_t ret_ref = 0;
33156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33158         return ret_ref;
33159 }
33160
33161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33162         LDKRevokeAndACK this_obj_conv;
33163         this_obj_conv.inner = untag_ptr(this_obj);
33164         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33166         RevokeAndACK_free(this_obj_conv);
33167 }
33168
33169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33170         LDKRevokeAndACK this_ptr_conv;
33171         this_ptr_conv.inner = untag_ptr(this_ptr);
33172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33174         this_ptr_conv.is_owned = false;
33175         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33176         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
33177         return ret_arr;
33178 }
33179
33180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33181         LDKRevokeAndACK this_ptr_conv;
33182         this_ptr_conv.inner = untag_ptr(this_ptr);
33183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33185         this_ptr_conv.is_owned = false;
33186         LDKThirtyTwoBytes val_ref;
33187         CHECK((*env)->GetArrayLength(env, val) == 32);
33188         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33189         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
33190 }
33191
33192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33193         LDKRevokeAndACK this_ptr_conv;
33194         this_ptr_conv.inner = untag_ptr(this_ptr);
33195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33197         this_ptr_conv.is_owned = false;
33198         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33199         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
33200         return ret_arr;
33201 }
33202
33203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33204         LDKRevokeAndACK this_ptr_conv;
33205         this_ptr_conv.inner = untag_ptr(this_ptr);
33206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33208         this_ptr_conv.is_owned = false;
33209         LDKThirtyTwoBytes val_ref;
33210         CHECK((*env)->GetArrayLength(env, val) == 32);
33211         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33212         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
33213 }
33214
33215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33216         LDKRevokeAndACK this_ptr_conv;
33217         this_ptr_conv.inner = untag_ptr(this_ptr);
33218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33220         this_ptr_conv.is_owned = false;
33221         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33222         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
33223         return ret_arr;
33224 }
33225
33226 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) {
33227         LDKRevokeAndACK this_ptr_conv;
33228         this_ptr_conv.inner = untag_ptr(this_ptr);
33229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33231         this_ptr_conv.is_owned = false;
33232         LDKPublicKey val_ref;
33233         CHECK((*env)->GetArrayLength(env, val) == 33);
33234         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33235         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
33236 }
33237
33238 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) {
33239         LDKThirtyTwoBytes channel_id_arg_ref;
33240         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33241         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33242         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
33243         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
33244         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
33245         LDKPublicKey next_per_commitment_point_arg_ref;
33246         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
33247         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
33248         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
33249         int64_t ret_ref = 0;
33250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33252         return ret_ref;
33253 }
33254
33255 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
33256         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
33257         int64_t ret_ref = 0;
33258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33260         return ret_ref;
33261 }
33262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33263         LDKRevokeAndACK arg_conv;
33264         arg_conv.inner = untag_ptr(arg);
33265         arg_conv.is_owned = ptr_is_owned(arg);
33266         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33267         arg_conv.is_owned = false;
33268         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
33269         return ret_conv;
33270 }
33271
33272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33273         LDKRevokeAndACK orig_conv;
33274         orig_conv.inner = untag_ptr(orig);
33275         orig_conv.is_owned = ptr_is_owned(orig);
33276         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33277         orig_conv.is_owned = false;
33278         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
33279         int64_t ret_ref = 0;
33280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33282         return ret_ref;
33283 }
33284
33285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33286         LDKUpdateFee this_obj_conv;
33287         this_obj_conv.inner = untag_ptr(this_obj);
33288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33290         UpdateFee_free(this_obj_conv);
33291 }
33292
33293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33294         LDKUpdateFee this_ptr_conv;
33295         this_ptr_conv.inner = untag_ptr(this_ptr);
33296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33298         this_ptr_conv.is_owned = false;
33299         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33300         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
33301         return ret_arr;
33302 }
33303
33304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33305         LDKUpdateFee 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         LDKThirtyTwoBytes val_ref;
33311         CHECK((*env)->GetArrayLength(env, val) == 32);
33312         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33313         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
33314 }
33315
33316 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
33317         LDKUpdateFee this_ptr_conv;
33318         this_ptr_conv.inner = untag_ptr(this_ptr);
33319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33321         this_ptr_conv.is_owned = false;
33322         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
33323         return ret_conv;
33324 }
33325
33326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33327         LDKUpdateFee this_ptr_conv;
33328         this_ptr_conv.inner = untag_ptr(this_ptr);
33329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33331         this_ptr_conv.is_owned = false;
33332         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
33333 }
33334
33335 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) {
33336         LDKThirtyTwoBytes channel_id_arg_ref;
33337         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33338         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33339         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
33340         int64_t ret_ref = 0;
33341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33343         return ret_ref;
33344 }
33345
33346 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
33347         LDKUpdateFee ret_var = UpdateFee_clone(arg);
33348         int64_t ret_ref = 0;
33349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33351         return ret_ref;
33352 }
33353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33354         LDKUpdateFee arg_conv;
33355         arg_conv.inner = untag_ptr(arg);
33356         arg_conv.is_owned = ptr_is_owned(arg);
33357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33358         arg_conv.is_owned = false;
33359         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
33360         return ret_conv;
33361 }
33362
33363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33364         LDKUpdateFee orig_conv;
33365         orig_conv.inner = untag_ptr(orig);
33366         orig_conv.is_owned = ptr_is_owned(orig);
33367         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33368         orig_conv.is_owned = false;
33369         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
33370         int64_t ret_ref = 0;
33371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33373         return ret_ref;
33374 }
33375
33376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33377         LDKDataLossProtect this_obj_conv;
33378         this_obj_conv.inner = untag_ptr(this_obj);
33379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33381         DataLossProtect_free(this_obj_conv);
33382 }
33383
33384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
33385         LDKDataLossProtect this_ptr_conv;
33386         this_ptr_conv.inner = untag_ptr(this_ptr);
33387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33389         this_ptr_conv.is_owned = false;
33390         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33391         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
33392         return ret_arr;
33393 }
33394
33395 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) {
33396         LDKDataLossProtect this_ptr_conv;
33397         this_ptr_conv.inner = untag_ptr(this_ptr);
33398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33400         this_ptr_conv.is_owned = false;
33401         LDKThirtyTwoBytes val_ref;
33402         CHECK((*env)->GetArrayLength(env, val) == 32);
33403         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33404         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
33405 }
33406
33407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
33408         LDKDataLossProtect this_ptr_conv;
33409         this_ptr_conv.inner = untag_ptr(this_ptr);
33410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33412         this_ptr_conv.is_owned = false;
33413         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33414         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
33415         return ret_arr;
33416 }
33417
33418 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) {
33419         LDKDataLossProtect this_ptr_conv;
33420         this_ptr_conv.inner = untag_ptr(this_ptr);
33421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33423         this_ptr_conv.is_owned = false;
33424         LDKPublicKey val_ref;
33425         CHECK((*env)->GetArrayLength(env, val) == 33);
33426         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33427         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
33428 }
33429
33430 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) {
33431         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
33432         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
33433         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
33434         LDKPublicKey my_current_per_commitment_point_arg_ref;
33435         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
33436         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
33437         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
33438         int64_t ret_ref = 0;
33439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33441         return ret_ref;
33442 }
33443
33444 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
33445         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
33446         int64_t ret_ref = 0;
33447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33449         return ret_ref;
33450 }
33451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33452         LDKDataLossProtect arg_conv;
33453         arg_conv.inner = untag_ptr(arg);
33454         arg_conv.is_owned = ptr_is_owned(arg);
33455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33456         arg_conv.is_owned = false;
33457         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
33458         return ret_conv;
33459 }
33460
33461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33462         LDKDataLossProtect orig_conv;
33463         orig_conv.inner = untag_ptr(orig);
33464         orig_conv.is_owned = ptr_is_owned(orig);
33465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33466         orig_conv.is_owned = false;
33467         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
33468         int64_t ret_ref = 0;
33469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33471         return ret_ref;
33472 }
33473
33474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33475         LDKChannelReestablish this_obj_conv;
33476         this_obj_conv.inner = untag_ptr(this_obj);
33477         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33479         ChannelReestablish_free(this_obj_conv);
33480 }
33481
33482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33483         LDKChannelReestablish this_ptr_conv;
33484         this_ptr_conv.inner = untag_ptr(this_ptr);
33485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33487         this_ptr_conv.is_owned = false;
33488         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33489         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
33490         return ret_arr;
33491 }
33492
33493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33494         LDKChannelReestablish this_ptr_conv;
33495         this_ptr_conv.inner = untag_ptr(this_ptr);
33496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33498         this_ptr_conv.is_owned = false;
33499         LDKThirtyTwoBytes val_ref;
33500         CHECK((*env)->GetArrayLength(env, val) == 32);
33501         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33502         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
33503 }
33504
33505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33506         LDKChannelReestablish this_ptr_conv;
33507         this_ptr_conv.inner = untag_ptr(this_ptr);
33508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33510         this_ptr_conv.is_owned = false;
33511         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
33512         return ret_conv;
33513 }
33514
33515 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) {
33516         LDKChannelReestablish this_ptr_conv;
33517         this_ptr_conv.inner = untag_ptr(this_ptr);
33518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33520         this_ptr_conv.is_owned = false;
33521         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
33522 }
33523
33524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
33525         LDKChannelReestablish this_ptr_conv;
33526         this_ptr_conv.inner = untag_ptr(this_ptr);
33527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33529         this_ptr_conv.is_owned = false;
33530         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
33531         return ret_conv;
33532 }
33533
33534 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) {
33535         LDKChannelReestablish this_ptr_conv;
33536         this_ptr_conv.inner = untag_ptr(this_ptr);
33537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33539         this_ptr_conv.is_owned = false;
33540         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
33541 }
33542
33543 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
33544         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
33545         int64_t ret_ref = 0;
33546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33548         return ret_ref;
33549 }
33550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33551         LDKChannelReestablish arg_conv;
33552         arg_conv.inner = untag_ptr(arg);
33553         arg_conv.is_owned = ptr_is_owned(arg);
33554         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33555         arg_conv.is_owned = false;
33556         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
33557         return ret_conv;
33558 }
33559
33560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33561         LDKChannelReestablish orig_conv;
33562         orig_conv.inner = untag_ptr(orig);
33563         orig_conv.is_owned = ptr_is_owned(orig);
33564         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33565         orig_conv.is_owned = false;
33566         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
33567         int64_t ret_ref = 0;
33568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33570         return ret_ref;
33571 }
33572
33573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33574         LDKAnnouncementSignatures this_obj_conv;
33575         this_obj_conv.inner = untag_ptr(this_obj);
33576         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33578         AnnouncementSignatures_free(this_obj_conv);
33579 }
33580
33581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33582         LDKAnnouncementSignatures this_ptr_conv;
33583         this_ptr_conv.inner = untag_ptr(this_ptr);
33584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33586         this_ptr_conv.is_owned = false;
33587         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33588         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
33589         return ret_arr;
33590 }
33591
33592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33593         LDKAnnouncementSignatures this_ptr_conv;
33594         this_ptr_conv.inner = untag_ptr(this_ptr);
33595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33597         this_ptr_conv.is_owned = false;
33598         LDKThirtyTwoBytes val_ref;
33599         CHECK((*env)->GetArrayLength(env, val) == 32);
33600         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33601         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
33602 }
33603
33604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33605         LDKAnnouncementSignatures this_ptr_conv;
33606         this_ptr_conv.inner = untag_ptr(this_ptr);
33607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33609         this_ptr_conv.is_owned = false;
33610         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
33611         return ret_conv;
33612 }
33613
33614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33615         LDKAnnouncementSignatures this_ptr_conv;
33616         this_ptr_conv.inner = untag_ptr(this_ptr);
33617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33619         this_ptr_conv.is_owned = false;
33620         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33621 }
33622
33623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33624         LDKAnnouncementSignatures 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
33631         return ret_arr;
33632 }
33633
33634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33635         LDKAnnouncementSignatures this_ptr_conv;
33636         this_ptr_conv.inner = untag_ptr(this_ptr);
33637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33639         this_ptr_conv.is_owned = false;
33640         LDKSignature val_ref;
33641         CHECK((*env)->GetArrayLength(env, val) == 64);
33642         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33643         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33644 }
33645
33646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33647         LDKAnnouncementSignatures this_ptr_conv;
33648         this_ptr_conv.inner = untag_ptr(this_ptr);
33649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33651         this_ptr_conv.is_owned = false;
33652         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33653         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
33654         return ret_arr;
33655 }
33656
33657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33658         LDKAnnouncementSignatures this_ptr_conv;
33659         this_ptr_conv.inner = untag_ptr(this_ptr);
33660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33662         this_ptr_conv.is_owned = false;
33663         LDKSignature val_ref;
33664         CHECK((*env)->GetArrayLength(env, val) == 64);
33665         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33666         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33667 }
33668
33669 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) {
33670         LDKThirtyTwoBytes channel_id_arg_ref;
33671         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33672         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33673         LDKSignature node_signature_arg_ref;
33674         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
33675         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
33676         LDKSignature bitcoin_signature_arg_ref;
33677         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
33678         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
33679         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33680         int64_t ret_ref = 0;
33681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33683         return ret_ref;
33684 }
33685
33686 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33687         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33688         int64_t ret_ref = 0;
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33691         return ret_ref;
33692 }
33693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33694         LDKAnnouncementSignatures arg_conv;
33695         arg_conv.inner = untag_ptr(arg);
33696         arg_conv.is_owned = ptr_is_owned(arg);
33697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33698         arg_conv.is_owned = false;
33699         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33700         return ret_conv;
33701 }
33702
33703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33704         LDKAnnouncementSignatures orig_conv;
33705         orig_conv.inner = untag_ptr(orig);
33706         orig_conv.is_owned = ptr_is_owned(orig);
33707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33708         orig_conv.is_owned = false;
33709         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33710         int64_t ret_ref = 0;
33711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33713         return ret_ref;
33714 }
33715
33716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33717         if (!ptr_is_owned(this_ptr)) return;
33718         void* this_ptr_ptr = untag_ptr(this_ptr);
33719         CHECK_ACCESS(this_ptr_ptr);
33720         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33721         FREE(untag_ptr(this_ptr));
33722         NetAddress_free(this_ptr_conv);
33723 }
33724
33725 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33726         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33727         *ret_copy = NetAddress_clone(arg);
33728         int64_t ret_ref = tag_ptr(ret_copy, true);
33729         return ret_ref;
33730 }
33731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33732         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33733         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33734         return ret_conv;
33735 }
33736
33737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33738         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33739         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33740         *ret_copy = NetAddress_clone(orig_conv);
33741         int64_t ret_ref = tag_ptr(ret_copy, true);
33742         return ret_ref;
33743 }
33744
33745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33746         LDKFourBytes addr_ref;
33747         CHECK((*env)->GetArrayLength(env, addr) == 4);
33748         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
33749         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33750         *ret_copy = NetAddress_ipv4(addr_ref, port);
33751         int64_t ret_ref = tag_ptr(ret_copy, true);
33752         return ret_ref;
33753 }
33754
33755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33756         LDKSixteenBytes addr_ref;
33757         CHECK((*env)->GetArrayLength(env, addr) == 16);
33758         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
33759         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33760         *ret_copy = NetAddress_ipv6(addr_ref, port);
33761         int64_t ret_ref = tag_ptr(ret_copy, true);
33762         return ret_ref;
33763 }
33764
33765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
33766         LDKTwelveBytes a_ref;
33767         CHECK((*env)->GetArrayLength(env, a) == 12);
33768         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
33769         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33770         *ret_copy = NetAddress_onion_v2(a_ref);
33771         int64_t ret_ref = tag_ptr(ret_copy, true);
33772         return ret_ref;
33773 }
33774
33775 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) {
33776         LDKThirtyTwoBytes ed25519_pubkey_ref;
33777         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
33778         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
33779         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33780         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33781         int64_t ret_ref = tag_ptr(ret_copy, true);
33782         return ret_ref;
33783 }
33784
33785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
33786         LDKHostname hostname_conv;
33787         hostname_conv.inner = untag_ptr(hostname);
33788         hostname_conv.is_owned = ptr_is_owned(hostname);
33789         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33790         hostname_conv = Hostname_clone(&hostname_conv);
33791         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33792         *ret_copy = NetAddress_hostname(hostname_conv, port);
33793         int64_t ret_ref = tag_ptr(ret_copy, true);
33794         return ret_ref;
33795 }
33796
33797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
33798         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33799         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33800         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33801         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33802         CVec_u8Z_free(ret_var);
33803         return ret_arr;
33804 }
33805
33806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33807         LDKu8slice ser_ref;
33808         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33809         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33810         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33811         *ret_conv = NetAddress_read(ser_ref);
33812         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33813         return tag_ptr(ret_conv, true);
33814 }
33815
33816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33817         LDKUnsignedNodeAnnouncement this_obj_conv;
33818         this_obj_conv.inner = untag_ptr(this_obj);
33819         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33821         UnsignedNodeAnnouncement_free(this_obj_conv);
33822 }
33823
33824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33825         LDKUnsignedNodeAnnouncement this_ptr_conv;
33826         this_ptr_conv.inner = untag_ptr(this_ptr);
33827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33829         this_ptr_conv.is_owned = false;
33830         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33831         int64_t ret_ref = 0;
33832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33834         return ret_ref;
33835 }
33836
33837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33838         LDKUnsignedNodeAnnouncement this_ptr_conv;
33839         this_ptr_conv.inner = untag_ptr(this_ptr);
33840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33842         this_ptr_conv.is_owned = false;
33843         LDKNodeFeatures val_conv;
33844         val_conv.inner = untag_ptr(val);
33845         val_conv.is_owned = ptr_is_owned(val);
33846         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33847         val_conv = NodeFeatures_clone(&val_conv);
33848         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33849 }
33850
33851 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33852         LDKUnsignedNodeAnnouncement this_ptr_conv;
33853         this_ptr_conv.inner = untag_ptr(this_ptr);
33854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33856         this_ptr_conv.is_owned = false;
33857         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33858         return ret_conv;
33859 }
33860
33861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33862         LDKUnsignedNodeAnnouncement this_ptr_conv;
33863         this_ptr_conv.inner = untag_ptr(this_ptr);
33864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33866         this_ptr_conv.is_owned = false;
33867         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33868 }
33869
33870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33871         LDKUnsignedNodeAnnouncement this_ptr_conv;
33872         this_ptr_conv.inner = untag_ptr(this_ptr);
33873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33875         this_ptr_conv.is_owned = false;
33876         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
33878         return ret_arr;
33879 }
33880
33881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33882         LDKUnsignedNodeAnnouncement this_ptr_conv;
33883         this_ptr_conv.inner = untag_ptr(this_ptr);
33884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33886         this_ptr_conv.is_owned = false;
33887         LDKPublicKey val_ref;
33888         CHECK((*env)->GetArrayLength(env, val) == 33);
33889         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33890         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
33891 }
33892
33893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
33894         LDKUnsignedNodeAnnouncement this_ptr_conv;
33895         this_ptr_conv.inner = untag_ptr(this_ptr);
33896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33898         this_ptr_conv.is_owned = false;
33899         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
33900         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
33901         return ret_arr;
33902 }
33903
33904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33905         LDKUnsignedNodeAnnouncement this_ptr_conv;
33906         this_ptr_conv.inner = untag_ptr(this_ptr);
33907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33909         this_ptr_conv.is_owned = false;
33910         LDKThreeBytes val_ref;
33911         CHECK((*env)->GetArrayLength(env, val) == 3);
33912         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
33913         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33914 }
33915
33916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33917         LDKUnsignedNodeAnnouncement this_ptr_conv;
33918         this_ptr_conv.inner = untag_ptr(this_ptr);
33919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33921         this_ptr_conv.is_owned = false;
33922         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33923         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
33924         return ret_arr;
33925 }
33926
33927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33928         LDKUnsignedNodeAnnouncement this_ptr_conv;
33929         this_ptr_conv.inner = untag_ptr(this_ptr);
33930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33932         this_ptr_conv.is_owned = false;
33933         LDKThirtyTwoBytes val_ref;
33934         CHECK((*env)->GetArrayLength(env, val) == 32);
33935         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33936         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
33937 }
33938
33939 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
33940         LDKUnsignedNodeAnnouncement 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         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
33946         int64_tArray ret_arr = NULL;
33947         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
33948         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
33949         for (size_t m = 0; m < ret_var.datalen; m++) {
33950                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33951                 *ret_conv_12_copy = ret_var.data[m];
33952                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
33953                 ret_arr_ptr[m] = ret_conv_12_ref;
33954         }
33955         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
33956         FREE(ret_var.data);
33957         return ret_arr;
33958 }
33959
33960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33961         LDKUnsignedNodeAnnouncement this_ptr_conv;
33962         this_ptr_conv.inner = untag_ptr(this_ptr);
33963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33965         this_ptr_conv.is_owned = false;
33966         LDKCVec_NetAddressZ val_constr;
33967         val_constr.datalen = (*env)->GetArrayLength(env, val);
33968         if (val_constr.datalen > 0)
33969                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
33970         else
33971                 val_constr.data = NULL;
33972         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33973         for (size_t m = 0; m < val_constr.datalen; m++) {
33974                 int64_t val_conv_12 = val_vals[m];
33975                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
33976                 CHECK_ACCESS(val_conv_12_ptr);
33977                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
33978                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
33979                 val_constr.data[m] = val_conv_12_conv;
33980         }
33981         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33982         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
33983 }
33984
33985 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
33986         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
33987         int64_t ret_ref = 0;
33988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33990         return ret_ref;
33991 }
33992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33993         LDKUnsignedNodeAnnouncement arg_conv;
33994         arg_conv.inner = untag_ptr(arg);
33995         arg_conv.is_owned = ptr_is_owned(arg);
33996         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33997         arg_conv.is_owned = false;
33998         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
33999         return ret_conv;
34000 }
34001
34002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34003         LDKUnsignedNodeAnnouncement orig_conv;
34004         orig_conv.inner = untag_ptr(orig);
34005         orig_conv.is_owned = ptr_is_owned(orig);
34006         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34007         orig_conv.is_owned = false;
34008         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
34009         int64_t ret_ref = 0;
34010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34012         return ret_ref;
34013 }
34014
34015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34016         LDKNodeAnnouncement this_obj_conv;
34017         this_obj_conv.inner = untag_ptr(this_obj);
34018         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34020         NodeAnnouncement_free(this_obj_conv);
34021 }
34022
34023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34024         LDKNodeAnnouncement this_ptr_conv;
34025         this_ptr_conv.inner = untag_ptr(this_ptr);
34026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34028         this_ptr_conv.is_owned = false;
34029         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34030         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
34031         return ret_arr;
34032 }
34033
34034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34035         LDKNodeAnnouncement this_ptr_conv;
34036         this_ptr_conv.inner = untag_ptr(this_ptr);
34037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34039         this_ptr_conv.is_owned = false;
34040         LDKSignature val_ref;
34041         CHECK((*env)->GetArrayLength(env, val) == 64);
34042         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34043         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
34044 }
34045
34046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34047         LDKNodeAnnouncement this_ptr_conv;
34048         this_ptr_conv.inner = untag_ptr(this_ptr);
34049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34051         this_ptr_conv.is_owned = false;
34052         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
34053         int64_t ret_ref = 0;
34054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34056         return ret_ref;
34057 }
34058
34059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34060         LDKNodeAnnouncement this_ptr_conv;
34061         this_ptr_conv.inner = untag_ptr(this_ptr);
34062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34064         this_ptr_conv.is_owned = false;
34065         LDKUnsignedNodeAnnouncement val_conv;
34066         val_conv.inner = untag_ptr(val);
34067         val_conv.is_owned = ptr_is_owned(val);
34068         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34069         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
34070         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
34071 }
34072
34073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34074         LDKSignature signature_arg_ref;
34075         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34076         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34077         LDKUnsignedNodeAnnouncement contents_arg_conv;
34078         contents_arg_conv.inner = untag_ptr(contents_arg);
34079         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34080         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34081         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
34082         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
34083         int64_t ret_ref = 0;
34084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34086         return ret_ref;
34087 }
34088
34089 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
34090         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
34091         int64_t ret_ref = 0;
34092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34094         return ret_ref;
34095 }
34096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34097         LDKNodeAnnouncement arg_conv;
34098         arg_conv.inner = untag_ptr(arg);
34099         arg_conv.is_owned = ptr_is_owned(arg);
34100         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34101         arg_conv.is_owned = false;
34102         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
34103         return ret_conv;
34104 }
34105
34106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34107         LDKNodeAnnouncement orig_conv;
34108         orig_conv.inner = untag_ptr(orig);
34109         orig_conv.is_owned = ptr_is_owned(orig);
34110         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34111         orig_conv.is_owned = false;
34112         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
34113         int64_t ret_ref = 0;
34114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34116         return ret_ref;
34117 }
34118
34119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34120         LDKUnsignedChannelAnnouncement this_obj_conv;
34121         this_obj_conv.inner = untag_ptr(this_obj);
34122         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34124         UnsignedChannelAnnouncement_free(this_obj_conv);
34125 }
34126
34127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
34128         LDKUnsignedChannelAnnouncement this_ptr_conv;
34129         this_ptr_conv.inner = untag_ptr(this_ptr);
34130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34132         this_ptr_conv.is_owned = false;
34133         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
34134         int64_t ret_ref = 0;
34135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34137         return ret_ref;
34138 }
34139
34140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34141         LDKUnsignedChannelAnnouncement this_ptr_conv;
34142         this_ptr_conv.inner = untag_ptr(this_ptr);
34143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34145         this_ptr_conv.is_owned = false;
34146         LDKChannelFeatures val_conv;
34147         val_conv.inner = untag_ptr(val);
34148         val_conv.is_owned = ptr_is_owned(val);
34149         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34150         val_conv = ChannelFeatures_clone(&val_conv);
34151         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
34152 }
34153
34154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34155         LDKUnsignedChannelAnnouncement this_ptr_conv;
34156         this_ptr_conv.inner = untag_ptr(this_ptr);
34157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34159         this_ptr_conv.is_owned = false;
34160         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34161         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
34162         return ret_arr;
34163 }
34164
34165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34166         LDKUnsignedChannelAnnouncement this_ptr_conv;
34167         this_ptr_conv.inner = untag_ptr(this_ptr);
34168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34170         this_ptr_conv.is_owned = false;
34171         LDKThirtyTwoBytes val_ref;
34172         CHECK((*env)->GetArrayLength(env, val) == 32);
34173         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34174         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
34175 }
34176
34177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34178         LDKUnsignedChannelAnnouncement this_ptr_conv;
34179         this_ptr_conv.inner = untag_ptr(this_ptr);
34180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34182         this_ptr_conv.is_owned = false;
34183         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
34184         return ret_conv;
34185 }
34186
34187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34188         LDKUnsignedChannelAnnouncement this_ptr_conv;
34189         this_ptr_conv.inner = untag_ptr(this_ptr);
34190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34192         this_ptr_conv.is_owned = false;
34193         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
34194 }
34195
34196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34197         LDKUnsignedChannelAnnouncement this_ptr_conv;
34198         this_ptr_conv.inner = untag_ptr(this_ptr);
34199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34201         this_ptr_conv.is_owned = false;
34202         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34203         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
34204         return ret_arr;
34205 }
34206
34207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34208         LDKUnsignedChannelAnnouncement this_ptr_conv;
34209         this_ptr_conv.inner = untag_ptr(this_ptr);
34210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34212         this_ptr_conv.is_owned = false;
34213         LDKPublicKey val_ref;
34214         CHECK((*env)->GetArrayLength(env, val) == 33);
34215         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34216         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
34217 }
34218
34219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34220         LDKUnsignedChannelAnnouncement this_ptr_conv;
34221         this_ptr_conv.inner = untag_ptr(this_ptr);
34222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34224         this_ptr_conv.is_owned = false;
34225         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34226         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
34227         return ret_arr;
34228 }
34229
34230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34231         LDKUnsignedChannelAnnouncement 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         LDKPublicKey val_ref;
34237         CHECK((*env)->GetArrayLength(env, val) == 33);
34238         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34239         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
34240 }
34241
34242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34243         LDKUnsignedChannelAnnouncement this_ptr_conv;
34244         this_ptr_conv.inner = untag_ptr(this_ptr);
34245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34247         this_ptr_conv.is_owned = false;
34248         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34249         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
34250         return ret_arr;
34251 }
34252
34253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34254         LDKUnsignedChannelAnnouncement this_ptr_conv;
34255         this_ptr_conv.inner = untag_ptr(this_ptr);
34256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34258         this_ptr_conv.is_owned = false;
34259         LDKPublicKey val_ref;
34260         CHECK((*env)->GetArrayLength(env, val) == 33);
34261         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34262         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
34263 }
34264
34265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34266         LDKUnsignedChannelAnnouncement this_ptr_conv;
34267         this_ptr_conv.inner = untag_ptr(this_ptr);
34268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34270         this_ptr_conv.is_owned = false;
34271         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34272         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
34273         return ret_arr;
34274 }
34275
34276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34277         LDKUnsignedChannelAnnouncement this_ptr_conv;
34278         this_ptr_conv.inner = untag_ptr(this_ptr);
34279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34281         this_ptr_conv.is_owned = false;
34282         LDKPublicKey val_ref;
34283         CHECK((*env)->GetArrayLength(env, val) == 33);
34284         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34285         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
34286 }
34287
34288 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
34289         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
34290         int64_t ret_ref = 0;
34291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34293         return ret_ref;
34294 }
34295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34296         LDKUnsignedChannelAnnouncement arg_conv;
34297         arg_conv.inner = untag_ptr(arg);
34298         arg_conv.is_owned = ptr_is_owned(arg);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34300         arg_conv.is_owned = false;
34301         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
34302         return ret_conv;
34303 }
34304
34305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34306         LDKUnsignedChannelAnnouncement orig_conv;
34307         orig_conv.inner = untag_ptr(orig);
34308         orig_conv.is_owned = ptr_is_owned(orig);
34309         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34310         orig_conv.is_owned = false;
34311         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
34312         int64_t ret_ref = 0;
34313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34315         return ret_ref;
34316 }
34317
34318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34319         LDKChannelAnnouncement this_obj_conv;
34320         this_obj_conv.inner = untag_ptr(this_obj);
34321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34323         ChannelAnnouncement_free(this_obj_conv);
34324 }
34325
34326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34327         LDKChannelAnnouncement this_ptr_conv;
34328         this_ptr_conv.inner = untag_ptr(this_ptr);
34329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34331         this_ptr_conv.is_owned = false;
34332         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34333         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
34334         return ret_arr;
34335 }
34336
34337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34338         LDKChannelAnnouncement this_ptr_conv;
34339         this_ptr_conv.inner = untag_ptr(this_ptr);
34340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34342         this_ptr_conv.is_owned = false;
34343         LDKSignature val_ref;
34344         CHECK((*env)->GetArrayLength(env, val) == 64);
34345         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34346         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
34347 }
34348
34349 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34350         LDKChannelAnnouncement 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34356         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
34357         return ret_arr;
34358 }
34359
34360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34361         LDKChannelAnnouncement this_ptr_conv;
34362         this_ptr_conv.inner = untag_ptr(this_ptr);
34363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34365         this_ptr_conv.is_owned = false;
34366         LDKSignature val_ref;
34367         CHECK((*env)->GetArrayLength(env, val) == 64);
34368         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34369         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
34370 }
34371
34372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
34373         LDKChannelAnnouncement this_ptr_conv;
34374         this_ptr_conv.inner = untag_ptr(this_ptr);
34375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34377         this_ptr_conv.is_owned = false;
34378         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34379         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
34380         return ret_arr;
34381 }
34382
34383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34384         LDKChannelAnnouncement this_ptr_conv;
34385         this_ptr_conv.inner = untag_ptr(this_ptr);
34386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34388         this_ptr_conv.is_owned = false;
34389         LDKSignature val_ref;
34390         CHECK((*env)->GetArrayLength(env, val) == 64);
34391         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34392         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
34393 }
34394
34395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
34396         LDKChannelAnnouncement this_ptr_conv;
34397         this_ptr_conv.inner = untag_ptr(this_ptr);
34398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34400         this_ptr_conv.is_owned = false;
34401         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34402         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
34403         return ret_arr;
34404 }
34405
34406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34407         LDKChannelAnnouncement 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         LDKSignature val_ref;
34413         CHECK((*env)->GetArrayLength(env, val) == 64);
34414         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34415         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
34416 }
34417
34418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34419         LDKChannelAnnouncement this_ptr_conv;
34420         this_ptr_conv.inner = untag_ptr(this_ptr);
34421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34423         this_ptr_conv.is_owned = false;
34424         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
34425         int64_t ret_ref = 0;
34426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34428         return ret_ref;
34429 }
34430
34431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34432         LDKChannelAnnouncement this_ptr_conv;
34433         this_ptr_conv.inner = untag_ptr(this_ptr);
34434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34436         this_ptr_conv.is_owned = false;
34437         LDKUnsignedChannelAnnouncement val_conv;
34438         val_conv.inner = untag_ptr(val);
34439         val_conv.is_owned = ptr_is_owned(val);
34440         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34441         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
34442         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
34443 }
34444
34445 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) {
34446         LDKSignature node_signature_1_arg_ref;
34447         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
34448         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
34449         LDKSignature node_signature_2_arg_ref;
34450         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
34451         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
34452         LDKSignature bitcoin_signature_1_arg_ref;
34453         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
34454         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
34455         LDKSignature bitcoin_signature_2_arg_ref;
34456         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
34457         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
34458         LDKUnsignedChannelAnnouncement contents_arg_conv;
34459         contents_arg_conv.inner = untag_ptr(contents_arg);
34460         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34461         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34462         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
34463         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);
34464         int64_t ret_ref = 0;
34465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34467         return ret_ref;
34468 }
34469
34470 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
34471         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
34472         int64_t ret_ref = 0;
34473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34475         return ret_ref;
34476 }
34477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34478         LDKChannelAnnouncement arg_conv;
34479         arg_conv.inner = untag_ptr(arg);
34480         arg_conv.is_owned = ptr_is_owned(arg);
34481         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34482         arg_conv.is_owned = false;
34483         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
34484         return ret_conv;
34485 }
34486
34487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34488         LDKChannelAnnouncement orig_conv;
34489         orig_conv.inner = untag_ptr(orig);
34490         orig_conv.is_owned = ptr_is_owned(orig);
34491         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34492         orig_conv.is_owned = false;
34493         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
34494         int64_t ret_ref = 0;
34495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34497         return ret_ref;
34498 }
34499
34500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34501         LDKUnsignedChannelUpdate this_obj_conv;
34502         this_obj_conv.inner = untag_ptr(this_obj);
34503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34505         UnsignedChannelUpdate_free(this_obj_conv);
34506 }
34507
34508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34509         LDKUnsignedChannelUpdate this_ptr_conv;
34510         this_ptr_conv.inner = untag_ptr(this_ptr);
34511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34513         this_ptr_conv.is_owned = false;
34514         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34515         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
34516         return ret_arr;
34517 }
34518
34519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34520         LDKUnsignedChannelUpdate this_ptr_conv;
34521         this_ptr_conv.inner = untag_ptr(this_ptr);
34522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34524         this_ptr_conv.is_owned = false;
34525         LDKThirtyTwoBytes val_ref;
34526         CHECK((*env)->GetArrayLength(env, val) == 32);
34527         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34528         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
34529 }
34530
34531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
34532         LDKUnsignedChannelUpdate this_ptr_conv;
34533         this_ptr_conv.inner = untag_ptr(this_ptr);
34534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34536         this_ptr_conv.is_owned = false;
34537         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
34538         return ret_conv;
34539 }
34540
34541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34542         LDKUnsignedChannelUpdate this_ptr_conv;
34543         this_ptr_conv.inner = untag_ptr(this_ptr);
34544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34546         this_ptr_conv.is_owned = false;
34547         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34548 }
34549
34550 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34551         LDKUnsignedChannelUpdate this_ptr_conv;
34552         this_ptr_conv.inner = untag_ptr(this_ptr);
34553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34555         this_ptr_conv.is_owned = false;
34556         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34557         return ret_conv;
34558 }
34559
34560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34561         LDKUnsignedChannelUpdate this_ptr_conv;
34562         this_ptr_conv.inner = untag_ptr(this_ptr);
34563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34565         this_ptr_conv.is_owned = false;
34566         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34567 }
34568
34569 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
34570         LDKUnsignedChannelUpdate this_ptr_conv;
34571         this_ptr_conv.inner = untag_ptr(this_ptr);
34572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34574         this_ptr_conv.is_owned = false;
34575         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34576         return ret_conv;
34577 }
34578
34579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
34580         LDKUnsignedChannelUpdate this_ptr_conv;
34581         this_ptr_conv.inner = untag_ptr(this_ptr);
34582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34584         this_ptr_conv.is_owned = false;
34585         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34586 }
34587
34588 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34589         LDKUnsignedChannelUpdate this_ptr_conv;
34590         this_ptr_conv.inner = untag_ptr(this_ptr);
34591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34593         this_ptr_conv.is_owned = false;
34594         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34595         return ret_conv;
34596 }
34597
34598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34599         LDKUnsignedChannelUpdate this_ptr_conv;
34600         this_ptr_conv.inner = untag_ptr(this_ptr);
34601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34603         this_ptr_conv.is_owned = false;
34604         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34605 }
34606
34607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34608         LDKUnsignedChannelUpdate this_ptr_conv;
34609         this_ptr_conv.inner = untag_ptr(this_ptr);
34610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34612         this_ptr_conv.is_owned = false;
34613         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34614         return ret_conv;
34615 }
34616
34617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34618         LDKUnsignedChannelUpdate this_ptr_conv;
34619         this_ptr_conv.inner = untag_ptr(this_ptr);
34620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34622         this_ptr_conv.is_owned = false;
34623         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34624 }
34625
34626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34627         LDKUnsignedChannelUpdate this_ptr_conv;
34628         this_ptr_conv.inner = untag_ptr(this_ptr);
34629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34631         this_ptr_conv.is_owned = false;
34632         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34633         return ret_conv;
34634 }
34635
34636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34637         LDKUnsignedChannelUpdate this_ptr_conv;
34638         this_ptr_conv.inner = untag_ptr(this_ptr);
34639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34641         this_ptr_conv.is_owned = false;
34642         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34643 }
34644
34645 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34646         LDKUnsignedChannelUpdate this_ptr_conv;
34647         this_ptr_conv.inner = untag_ptr(this_ptr);
34648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34650         this_ptr_conv.is_owned = false;
34651         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34652         return ret_conv;
34653 }
34654
34655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34656         LDKUnsignedChannelUpdate this_ptr_conv;
34657         this_ptr_conv.inner = untag_ptr(this_ptr);
34658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34660         this_ptr_conv.is_owned = false;
34661         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34662 }
34663
34664 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34665         LDKUnsignedChannelUpdate this_ptr_conv;
34666         this_ptr_conv.inner = untag_ptr(this_ptr);
34667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34669         this_ptr_conv.is_owned = false;
34670         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34671         return ret_conv;
34672 }
34673
34674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34675         LDKUnsignedChannelUpdate this_ptr_conv;
34676         this_ptr_conv.inner = untag_ptr(this_ptr);
34677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34679         this_ptr_conv.is_owned = false;
34680         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34681 }
34682
34683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
34684         LDKUnsignedChannelUpdate this_ptr_conv;
34685         this_ptr_conv.inner = untag_ptr(this_ptr);
34686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34688         this_ptr_conv.is_owned = false;
34689         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34690         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34691         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34692         CVec_u8Z_free(ret_var);
34693         return ret_arr;
34694 }
34695
34696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34697         LDKUnsignedChannelUpdate this_ptr_conv;
34698         this_ptr_conv.inner = untag_ptr(this_ptr);
34699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34701         this_ptr_conv.is_owned = false;
34702         LDKCVec_u8Z val_ref;
34703         val_ref.datalen = (*env)->GetArrayLength(env, val);
34704         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34705         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
34706         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34707 }
34708
34709 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) {
34710         LDKThirtyTwoBytes chain_hash_arg_ref;
34711         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34712         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34713         LDKCVec_u8Z excess_data_arg_ref;
34714         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
34715         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34716         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
34717         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);
34718         int64_t ret_ref = 0;
34719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34721         return ret_ref;
34722 }
34723
34724 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34725         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34726         int64_t ret_ref = 0;
34727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34729         return ret_ref;
34730 }
34731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34732         LDKUnsignedChannelUpdate arg_conv;
34733         arg_conv.inner = untag_ptr(arg);
34734         arg_conv.is_owned = ptr_is_owned(arg);
34735         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34736         arg_conv.is_owned = false;
34737         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34738         return ret_conv;
34739 }
34740
34741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34742         LDKUnsignedChannelUpdate orig_conv;
34743         orig_conv.inner = untag_ptr(orig);
34744         orig_conv.is_owned = ptr_is_owned(orig);
34745         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34746         orig_conv.is_owned = false;
34747         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34748         int64_t ret_ref = 0;
34749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34751         return ret_ref;
34752 }
34753
34754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34755         LDKChannelUpdate this_obj_conv;
34756         this_obj_conv.inner = untag_ptr(this_obj);
34757         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34759         ChannelUpdate_free(this_obj_conv);
34760 }
34761
34762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34763         LDKChannelUpdate this_ptr_conv;
34764         this_ptr_conv.inner = untag_ptr(this_ptr);
34765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34767         this_ptr_conv.is_owned = false;
34768         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34769         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
34770         return ret_arr;
34771 }
34772
34773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34774         LDKChannelUpdate this_ptr_conv;
34775         this_ptr_conv.inner = untag_ptr(this_ptr);
34776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34778         this_ptr_conv.is_owned = false;
34779         LDKSignature val_ref;
34780         CHECK((*env)->GetArrayLength(env, val) == 64);
34781         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34782         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34783 }
34784
34785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34786         LDKChannelUpdate this_ptr_conv;
34787         this_ptr_conv.inner = untag_ptr(this_ptr);
34788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34790         this_ptr_conv.is_owned = false;
34791         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34792         int64_t ret_ref = 0;
34793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34795         return ret_ref;
34796 }
34797
34798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34799         LDKChannelUpdate 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         LDKUnsignedChannelUpdate val_conv;
34805         val_conv.inner = untag_ptr(val);
34806         val_conv.is_owned = ptr_is_owned(val);
34807         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34808         val_conv = UnsignedChannelUpdate_clone(&val_conv);
34809         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34810 }
34811
34812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34813         LDKSignature signature_arg_ref;
34814         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34815         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34816         LDKUnsignedChannelUpdate contents_arg_conv;
34817         contents_arg_conv.inner = untag_ptr(contents_arg);
34818         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34819         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34820         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
34821         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
34822         int64_t ret_ref = 0;
34823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34825         return ret_ref;
34826 }
34827
34828 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
34829         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
34830         int64_t ret_ref = 0;
34831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34833         return ret_ref;
34834 }
34835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34836         LDKChannelUpdate arg_conv;
34837         arg_conv.inner = untag_ptr(arg);
34838         arg_conv.is_owned = ptr_is_owned(arg);
34839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34840         arg_conv.is_owned = false;
34841         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
34842         return ret_conv;
34843 }
34844
34845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34846         LDKChannelUpdate orig_conv;
34847         orig_conv.inner = untag_ptr(orig);
34848         orig_conv.is_owned = ptr_is_owned(orig);
34849         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34850         orig_conv.is_owned = false;
34851         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
34852         int64_t ret_ref = 0;
34853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34855         return ret_ref;
34856 }
34857
34858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34859         LDKQueryChannelRange this_obj_conv;
34860         this_obj_conv.inner = untag_ptr(this_obj);
34861         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34863         QueryChannelRange_free(this_obj_conv);
34864 }
34865
34866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34867         LDKQueryChannelRange this_ptr_conv;
34868         this_ptr_conv.inner = untag_ptr(this_ptr);
34869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34871         this_ptr_conv.is_owned = false;
34872         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34873         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
34874         return ret_arr;
34875 }
34876
34877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34878         LDKQueryChannelRange this_ptr_conv;
34879         this_ptr_conv.inner = untag_ptr(this_ptr);
34880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34882         this_ptr_conv.is_owned = false;
34883         LDKThirtyTwoBytes val_ref;
34884         CHECK((*env)->GetArrayLength(env, val) == 32);
34885         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34886         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34887 }
34888
34889 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34890         LDKQueryChannelRange this_ptr_conv;
34891         this_ptr_conv.inner = untag_ptr(this_ptr);
34892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34894         this_ptr_conv.is_owned = false;
34895         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
34896         return ret_conv;
34897 }
34898
34899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34900         LDKQueryChannelRange this_ptr_conv;
34901         this_ptr_conv.inner = untag_ptr(this_ptr);
34902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34904         this_ptr_conv.is_owned = false;
34905         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
34906 }
34907
34908 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34909         LDKQueryChannelRange this_ptr_conv;
34910         this_ptr_conv.inner = untag_ptr(this_ptr);
34911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34913         this_ptr_conv.is_owned = false;
34914         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
34915         return ret_conv;
34916 }
34917
34918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34919         LDKQueryChannelRange this_ptr_conv;
34920         this_ptr_conv.inner = untag_ptr(this_ptr);
34921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34923         this_ptr_conv.is_owned = false;
34924         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34925 }
34926
34927 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) {
34928         LDKThirtyTwoBytes chain_hash_arg_ref;
34929         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34930         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34931         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
34932         int64_t ret_ref = 0;
34933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34935         return ret_ref;
34936 }
34937
34938 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
34939         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
34940         int64_t ret_ref = 0;
34941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34943         return ret_ref;
34944 }
34945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34946         LDKQueryChannelRange arg_conv;
34947         arg_conv.inner = untag_ptr(arg);
34948         arg_conv.is_owned = ptr_is_owned(arg);
34949         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34950         arg_conv.is_owned = false;
34951         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
34952         return ret_conv;
34953 }
34954
34955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34956         LDKQueryChannelRange orig_conv;
34957         orig_conv.inner = untag_ptr(orig);
34958         orig_conv.is_owned = ptr_is_owned(orig);
34959         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34960         orig_conv.is_owned = false;
34961         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
34962         int64_t ret_ref = 0;
34963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34965         return ret_ref;
34966 }
34967
34968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34969         LDKReplyChannelRange this_obj_conv;
34970         this_obj_conv.inner = untag_ptr(this_obj);
34971         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34973         ReplyChannelRange_free(this_obj_conv);
34974 }
34975
34976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34977         LDKReplyChannelRange this_ptr_conv;
34978         this_ptr_conv.inner = untag_ptr(this_ptr);
34979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34981         this_ptr_conv.is_owned = false;
34982         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34983         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
34984         return ret_arr;
34985 }
34986
34987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34988         LDKReplyChannelRange this_ptr_conv;
34989         this_ptr_conv.inner = untag_ptr(this_ptr);
34990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34992         this_ptr_conv.is_owned = false;
34993         LDKThirtyTwoBytes val_ref;
34994         CHECK((*env)->GetArrayLength(env, val) == 32);
34995         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34996         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34997 }
34998
34999 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
35000         LDKReplyChannelRange this_ptr_conv;
35001         this_ptr_conv.inner = untag_ptr(this_ptr);
35002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35004         this_ptr_conv.is_owned = false;
35005         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
35006         return ret_conv;
35007 }
35008
35009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35010         LDKReplyChannelRange this_ptr_conv;
35011         this_ptr_conv.inner = untag_ptr(this_ptr);
35012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35014         this_ptr_conv.is_owned = false;
35015         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
35016 }
35017
35018 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
35019         LDKReplyChannelRange this_ptr_conv;
35020         this_ptr_conv.inner = untag_ptr(this_ptr);
35021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35023         this_ptr_conv.is_owned = false;
35024         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
35025         return ret_conv;
35026 }
35027
35028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35029         LDKReplyChannelRange this_ptr_conv;
35030         this_ptr_conv.inner = untag_ptr(this_ptr);
35031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35033         this_ptr_conv.is_owned = false;
35034         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
35035 }
35036
35037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
35038         LDKReplyChannelRange this_ptr_conv;
35039         this_ptr_conv.inner = untag_ptr(this_ptr);
35040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35042         this_ptr_conv.is_owned = false;
35043         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
35044         return ret_conv;
35045 }
35046
35047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35048         LDKReplyChannelRange this_ptr_conv;
35049         this_ptr_conv.inner = untag_ptr(this_ptr);
35050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35052         this_ptr_conv.is_owned = false;
35053         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
35054 }
35055
35056 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
35057         LDKReplyChannelRange this_ptr_conv;
35058         this_ptr_conv.inner = untag_ptr(this_ptr);
35059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35061         this_ptr_conv.is_owned = false;
35062         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
35063         int64_tArray ret_arr = NULL;
35064         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35065         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35066         for (size_t g = 0; g < ret_var.datalen; g++) {
35067                 int64_t ret_conv_6_conv = ret_var.data[g];
35068                 ret_arr_ptr[g] = ret_conv_6_conv;
35069         }
35070         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35071         FREE(ret_var.data);
35072         return ret_arr;
35073 }
35074
35075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35076         LDKReplyChannelRange this_ptr_conv;
35077         this_ptr_conv.inner = untag_ptr(this_ptr);
35078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35080         this_ptr_conv.is_owned = false;
35081         LDKCVec_u64Z val_constr;
35082         val_constr.datalen = (*env)->GetArrayLength(env, val);
35083         if (val_constr.datalen > 0)
35084                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35085         else
35086                 val_constr.data = NULL;
35087         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35088         for (size_t g = 0; g < val_constr.datalen; g++) {
35089                 int64_t val_conv_6 = val_vals[g];
35090                 val_constr.data[g] = val_conv_6;
35091         }
35092         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35093         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
35094 }
35095
35096 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) {
35097         LDKThirtyTwoBytes chain_hash_arg_ref;
35098         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35099         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35100         LDKCVec_u64Z short_channel_ids_arg_constr;
35101         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35102         if (short_channel_ids_arg_constr.datalen > 0)
35103                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35104         else
35105                 short_channel_ids_arg_constr.data = NULL;
35106         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35107         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35108                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35109                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35110         }
35111         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35112         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
35113         int64_t ret_ref = 0;
35114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35116         return ret_ref;
35117 }
35118
35119 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
35120         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
35121         int64_t ret_ref = 0;
35122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35124         return ret_ref;
35125 }
35126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35127         LDKReplyChannelRange arg_conv;
35128         arg_conv.inner = untag_ptr(arg);
35129         arg_conv.is_owned = ptr_is_owned(arg);
35130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35131         arg_conv.is_owned = false;
35132         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
35133         return ret_conv;
35134 }
35135
35136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35137         LDKReplyChannelRange orig_conv;
35138         orig_conv.inner = untag_ptr(orig);
35139         orig_conv.is_owned = ptr_is_owned(orig);
35140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35141         orig_conv.is_owned = false;
35142         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
35143         int64_t ret_ref = 0;
35144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35146         return ret_ref;
35147 }
35148
35149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35150         LDKQueryShortChannelIds this_obj_conv;
35151         this_obj_conv.inner = untag_ptr(this_obj);
35152         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35154         QueryShortChannelIds_free(this_obj_conv);
35155 }
35156
35157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35158         LDKQueryShortChannelIds this_ptr_conv;
35159         this_ptr_conv.inner = untag_ptr(this_ptr);
35160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35162         this_ptr_conv.is_owned = false;
35163         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35164         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
35165         return ret_arr;
35166 }
35167
35168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35169         LDKQueryShortChannelIds this_ptr_conv;
35170         this_ptr_conv.inner = untag_ptr(this_ptr);
35171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35173         this_ptr_conv.is_owned = false;
35174         LDKThirtyTwoBytes val_ref;
35175         CHECK((*env)->GetArrayLength(env, val) == 32);
35176         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35177         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
35178 }
35179
35180 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
35181         LDKQueryShortChannelIds this_ptr_conv;
35182         this_ptr_conv.inner = untag_ptr(this_ptr);
35183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35185         this_ptr_conv.is_owned = false;
35186         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
35187         int64_tArray ret_arr = NULL;
35188         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35189         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35190         for (size_t g = 0; g < ret_var.datalen; g++) {
35191                 int64_t ret_conv_6_conv = ret_var.data[g];
35192                 ret_arr_ptr[g] = ret_conv_6_conv;
35193         }
35194         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35195         FREE(ret_var.data);
35196         return ret_arr;
35197 }
35198
35199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35200         LDKQueryShortChannelIds this_ptr_conv;
35201         this_ptr_conv.inner = untag_ptr(this_ptr);
35202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35204         this_ptr_conv.is_owned = false;
35205         LDKCVec_u64Z val_constr;
35206         val_constr.datalen = (*env)->GetArrayLength(env, val);
35207         if (val_constr.datalen > 0)
35208                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35209         else
35210                 val_constr.data = NULL;
35211         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35212         for (size_t g = 0; g < val_constr.datalen; g++) {
35213                 int64_t val_conv_6 = val_vals[g];
35214                 val_constr.data[g] = val_conv_6;
35215         }
35216         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35217         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
35218 }
35219
35220 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) {
35221         LDKThirtyTwoBytes chain_hash_arg_ref;
35222         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35223         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35224         LDKCVec_u64Z short_channel_ids_arg_constr;
35225         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
35226         if (short_channel_ids_arg_constr.datalen > 0)
35227                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
35228         else
35229                 short_channel_ids_arg_constr.data = NULL;
35230         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
35231         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
35232                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
35233                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
35234         }
35235         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
35236         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
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 QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
35244         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_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_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35251         LDKQueryShortChannelIds 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 = QueryShortChannelIds_clone_ptr(&arg_conv);
35257         return ret_conv;
35258 }
35259
35260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35261         LDKQueryShortChannelIds 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         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_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_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35274         LDKReplyShortChannelIdsEnd this_obj_conv;
35275         this_obj_conv.inner = untag_ptr(this_obj);
35276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35278         ReplyShortChannelIdsEnd_free(this_obj_conv);
35279 }
35280
35281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35282         LDKReplyShortChannelIdsEnd this_ptr_conv;
35283         this_ptr_conv.inner = untag_ptr(this_ptr);
35284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35286         this_ptr_conv.is_owned = false;
35287         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35288         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
35289         return ret_arr;
35290 }
35291
35292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35293         LDKReplyShortChannelIdsEnd this_ptr_conv;
35294         this_ptr_conv.inner = untag_ptr(this_ptr);
35295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35297         this_ptr_conv.is_owned = false;
35298         LDKThirtyTwoBytes val_ref;
35299         CHECK((*env)->GetArrayLength(env, val) == 32);
35300         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35301         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
35302 }
35303
35304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
35305         LDKReplyShortChannelIdsEnd this_ptr_conv;
35306         this_ptr_conv.inner = untag_ptr(this_ptr);
35307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35309         this_ptr_conv.is_owned = false;
35310         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
35311         return ret_conv;
35312 }
35313
35314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35315         LDKReplyShortChannelIdsEnd this_ptr_conv;
35316         this_ptr_conv.inner = untag_ptr(this_ptr);
35317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35319         this_ptr_conv.is_owned = false;
35320         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
35321 }
35322
35323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
35324         LDKThirtyTwoBytes chain_hash_arg_ref;
35325         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35326         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35327         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
35328         int64_t ret_ref = 0;
35329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35331         return ret_ref;
35332 }
35333
35334 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
35335         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
35336         int64_t ret_ref = 0;
35337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35339         return ret_ref;
35340 }
35341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35342         LDKReplyShortChannelIdsEnd arg_conv;
35343         arg_conv.inner = untag_ptr(arg);
35344         arg_conv.is_owned = ptr_is_owned(arg);
35345         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35346         arg_conv.is_owned = false;
35347         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
35348         return ret_conv;
35349 }
35350
35351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35352         LDKReplyShortChannelIdsEnd orig_conv;
35353         orig_conv.inner = untag_ptr(orig);
35354         orig_conv.is_owned = ptr_is_owned(orig);
35355         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35356         orig_conv.is_owned = false;
35357         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
35358         int64_t ret_ref = 0;
35359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35361         return ret_ref;
35362 }
35363
35364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35365         LDKGossipTimestampFilter this_obj_conv;
35366         this_obj_conv.inner = untag_ptr(this_obj);
35367         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35369         GossipTimestampFilter_free(this_obj_conv);
35370 }
35371
35372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
35373         LDKGossipTimestampFilter this_ptr_conv;
35374         this_ptr_conv.inner = untag_ptr(this_ptr);
35375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35377         this_ptr_conv.is_owned = false;
35378         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35379         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
35380         return ret_arr;
35381 }
35382
35383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35384         LDKGossipTimestampFilter this_ptr_conv;
35385         this_ptr_conv.inner = untag_ptr(this_ptr);
35386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35388         this_ptr_conv.is_owned = false;
35389         LDKThirtyTwoBytes val_ref;
35390         CHECK((*env)->GetArrayLength(env, val) == 32);
35391         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35392         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
35393 }
35394
35395 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
35396         LDKGossipTimestampFilter this_ptr_conv;
35397         this_ptr_conv.inner = untag_ptr(this_ptr);
35398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35400         this_ptr_conv.is_owned = false;
35401         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
35402         return ret_conv;
35403 }
35404
35405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35406         LDKGossipTimestampFilter this_ptr_conv;
35407         this_ptr_conv.inner = untag_ptr(this_ptr);
35408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35410         this_ptr_conv.is_owned = false;
35411         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
35412 }
35413
35414 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
35415         LDKGossipTimestampFilter this_ptr_conv;
35416         this_ptr_conv.inner = untag_ptr(this_ptr);
35417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35419         this_ptr_conv.is_owned = false;
35420         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
35421         return ret_conv;
35422 }
35423
35424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
35425         LDKGossipTimestampFilter this_ptr_conv;
35426         this_ptr_conv.inner = untag_ptr(this_ptr);
35427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35429         this_ptr_conv.is_owned = false;
35430         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
35431 }
35432
35433 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) {
35434         LDKThirtyTwoBytes chain_hash_arg_ref;
35435         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
35436         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
35437         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
35438         int64_t ret_ref = 0;
35439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35441         return ret_ref;
35442 }
35443
35444 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
35445         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
35446         int64_t ret_ref = 0;
35447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35449         return ret_ref;
35450 }
35451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35452         LDKGossipTimestampFilter arg_conv;
35453         arg_conv.inner = untag_ptr(arg);
35454         arg_conv.is_owned = ptr_is_owned(arg);
35455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35456         arg_conv.is_owned = false;
35457         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35458         return ret_conv;
35459 }
35460
35461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35462         LDKGossipTimestampFilter orig_conv;
35463         orig_conv.inner = untag_ptr(orig);
35464         orig_conv.is_owned = ptr_is_owned(orig);
35465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35466         orig_conv.is_owned = false;
35467         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35468         int64_t ret_ref = 0;
35469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35471         return ret_ref;
35472 }
35473
35474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35475         if (!ptr_is_owned(this_ptr)) return;
35476         void* this_ptr_ptr = untag_ptr(this_ptr);
35477         CHECK_ACCESS(this_ptr_ptr);
35478         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35479         FREE(untag_ptr(this_ptr));
35480         ErrorAction_free(this_ptr_conv);
35481 }
35482
35483 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35484         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35485         *ret_copy = ErrorAction_clone(arg);
35486         int64_t ret_ref = tag_ptr(ret_copy, true);
35487         return ret_ref;
35488 }
35489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35490         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35491         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35492         return ret_conv;
35493 }
35494
35495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35496         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35497         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35498         *ret_copy = ErrorAction_clone(orig_conv);
35499         int64_t ret_ref = tag_ptr(ret_copy, true);
35500         return ret_ref;
35501 }
35502
35503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
35504         LDKErrorMessage msg_conv;
35505         msg_conv.inner = untag_ptr(msg);
35506         msg_conv.is_owned = ptr_is_owned(msg);
35507         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35508         msg_conv = ErrorMessage_clone(&msg_conv);
35509         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35510         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35511         int64_t ret_ref = tag_ptr(ret_copy, true);
35512         return ret_ref;
35513 }
35514
35515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
35516         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35517         *ret_copy = ErrorAction_ignore_error();
35518         int64_t ret_ref = tag_ptr(ret_copy, true);
35519         return ret_ref;
35520 }
35521
35522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
35523         LDKLevel a_conv = LDKLevel_from_java(env, a);
35524         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35525         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35526         int64_t ret_ref = tag_ptr(ret_copy, true);
35527         return ret_ref;
35528 }
35529
35530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
35531         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35532         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35533         int64_t ret_ref = tag_ptr(ret_copy, true);
35534         return ret_ref;
35535 }
35536
35537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
35538         LDKErrorMessage msg_conv;
35539         msg_conv.inner = untag_ptr(msg);
35540         msg_conv.is_owned = ptr_is_owned(msg);
35541         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35542         msg_conv = ErrorMessage_clone(&msg_conv);
35543         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35544         *ret_copy = ErrorAction_send_error_message(msg_conv);
35545         int64_t ret_ref = tag_ptr(ret_copy, true);
35546         return ret_ref;
35547 }
35548
35549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
35550         LDKWarningMessage msg_conv;
35551         msg_conv.inner = untag_ptr(msg);
35552         msg_conv.is_owned = ptr_is_owned(msg);
35553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35554         msg_conv = WarningMessage_clone(&msg_conv);
35555         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
35556         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35557         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35558         int64_t ret_ref = tag_ptr(ret_copy, true);
35559         return ret_ref;
35560 }
35561
35562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35563         LDKLightningError this_obj_conv;
35564         this_obj_conv.inner = untag_ptr(this_obj);
35565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35567         LightningError_free(this_obj_conv);
35568 }
35569
35570 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
35571         LDKLightningError this_ptr_conv;
35572         this_ptr_conv.inner = untag_ptr(this_ptr);
35573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35575         this_ptr_conv.is_owned = false;
35576         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35577         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
35578         Str_free(ret_str);
35579         return ret_conv;
35580 }
35581
35582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
35583         LDKLightningError this_ptr_conv;
35584         this_ptr_conv.inner = untag_ptr(this_ptr);
35585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35587         this_ptr_conv.is_owned = false;
35588         LDKStr val_conv = java_to_owned_str(env, val);
35589         LightningError_set_err(&this_ptr_conv, val_conv);
35590 }
35591
35592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
35593         LDKLightningError this_ptr_conv;
35594         this_ptr_conv.inner = untag_ptr(this_ptr);
35595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35597         this_ptr_conv.is_owned = false;
35598         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35599         *ret_copy = LightningError_get_action(&this_ptr_conv);
35600         int64_t ret_ref = tag_ptr(ret_copy, true);
35601         return ret_ref;
35602 }
35603
35604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35605         LDKLightningError this_ptr_conv;
35606         this_ptr_conv.inner = untag_ptr(this_ptr);
35607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35609         this_ptr_conv.is_owned = false;
35610         void* val_ptr = untag_ptr(val);
35611         CHECK_ACCESS(val_ptr);
35612         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35613         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35614         LightningError_set_action(&this_ptr_conv, val_conv);
35615 }
35616
35617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
35618         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
35619         void* action_arg_ptr = untag_ptr(action_arg);
35620         CHECK_ACCESS(action_arg_ptr);
35621         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35622         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35623         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35624         int64_t ret_ref = 0;
35625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35627         return ret_ref;
35628 }
35629
35630 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35631         LDKLightningError ret_var = LightningError_clone(arg);
35632         int64_t ret_ref = 0;
35633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35635         return ret_ref;
35636 }
35637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35638         LDKLightningError arg_conv;
35639         arg_conv.inner = untag_ptr(arg);
35640         arg_conv.is_owned = ptr_is_owned(arg);
35641         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35642         arg_conv.is_owned = false;
35643         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35644         return ret_conv;
35645 }
35646
35647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35648         LDKLightningError orig_conv;
35649         orig_conv.inner = untag_ptr(orig);
35650         orig_conv.is_owned = ptr_is_owned(orig);
35651         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35652         orig_conv.is_owned = false;
35653         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35654         int64_t ret_ref = 0;
35655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35657         return ret_ref;
35658 }
35659
35660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35661         LDKCommitmentUpdate this_obj_conv;
35662         this_obj_conv.inner = untag_ptr(this_obj);
35663         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35665         CommitmentUpdate_free(this_obj_conv);
35666 }
35667
35668 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35669         LDKCommitmentUpdate this_ptr_conv;
35670         this_ptr_conv.inner = untag_ptr(this_ptr);
35671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35673         this_ptr_conv.is_owned = false;
35674         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35675         int64_tArray ret_arr = NULL;
35676         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35677         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35678         for (size_t p = 0; p < ret_var.datalen; p++) {
35679                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35680                 int64_t ret_conv_15_ref = 0;
35681                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35682                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35683                 ret_arr_ptr[p] = ret_conv_15_ref;
35684         }
35685         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35686         FREE(ret_var.data);
35687         return ret_arr;
35688 }
35689
35690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35691         LDKCommitmentUpdate this_ptr_conv;
35692         this_ptr_conv.inner = untag_ptr(this_ptr);
35693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35695         this_ptr_conv.is_owned = false;
35696         LDKCVec_UpdateAddHTLCZ val_constr;
35697         val_constr.datalen = (*env)->GetArrayLength(env, val);
35698         if (val_constr.datalen > 0)
35699                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35700         else
35701                 val_constr.data = NULL;
35702         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35703         for (size_t p = 0; p < val_constr.datalen; p++) {
35704                 int64_t val_conv_15 = val_vals[p];
35705                 LDKUpdateAddHTLC val_conv_15_conv;
35706                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35707                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35709                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35710                 val_constr.data[p] = val_conv_15_conv;
35711         }
35712         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35713         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35714 }
35715
35716 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35717         LDKCommitmentUpdate this_ptr_conv;
35718         this_ptr_conv.inner = untag_ptr(this_ptr);
35719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35721         this_ptr_conv.is_owned = false;
35722         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35723         int64_tArray ret_arr = NULL;
35724         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35725         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35726         for (size_t t = 0; t < ret_var.datalen; t++) {
35727                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35728                 int64_t ret_conv_19_ref = 0;
35729                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35730                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
35731                 ret_arr_ptr[t] = ret_conv_19_ref;
35732         }
35733         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35734         FREE(ret_var.data);
35735         return ret_arr;
35736 }
35737
35738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35739         LDKCommitmentUpdate this_ptr_conv;
35740         this_ptr_conv.inner = untag_ptr(this_ptr);
35741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35743         this_ptr_conv.is_owned = false;
35744         LDKCVec_UpdateFulfillHTLCZ val_constr;
35745         val_constr.datalen = (*env)->GetArrayLength(env, val);
35746         if (val_constr.datalen > 0)
35747                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35748         else
35749                 val_constr.data = NULL;
35750         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35751         for (size_t t = 0; t < val_constr.datalen; t++) {
35752                 int64_t val_conv_19 = val_vals[t];
35753                 LDKUpdateFulfillHTLC val_conv_19_conv;
35754                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
35755                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
35756                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35757                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35758                 val_constr.data[t] = val_conv_19_conv;
35759         }
35760         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35761         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35762 }
35763
35764 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35765         LDKCommitmentUpdate this_ptr_conv;
35766         this_ptr_conv.inner = untag_ptr(this_ptr);
35767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35769         this_ptr_conv.is_owned = false;
35770         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35771         int64_tArray ret_arr = NULL;
35772         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35773         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35774         for (size_t q = 0; q < ret_var.datalen; q++) {
35775                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35776                 int64_t ret_conv_16_ref = 0;
35777                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35778                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35779                 ret_arr_ptr[q] = ret_conv_16_ref;
35780         }
35781         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35782         FREE(ret_var.data);
35783         return ret_arr;
35784 }
35785
35786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35787         LDKCommitmentUpdate this_ptr_conv;
35788         this_ptr_conv.inner = untag_ptr(this_ptr);
35789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35791         this_ptr_conv.is_owned = false;
35792         LDKCVec_UpdateFailHTLCZ val_constr;
35793         val_constr.datalen = (*env)->GetArrayLength(env, val);
35794         if (val_constr.datalen > 0)
35795                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35796         else
35797                 val_constr.data = NULL;
35798         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35799         for (size_t q = 0; q < val_constr.datalen; q++) {
35800                 int64_t val_conv_16 = val_vals[q];
35801                 LDKUpdateFailHTLC val_conv_16_conv;
35802                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
35803                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
35804                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35805                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
35806                 val_constr.data[q] = val_conv_16_conv;
35807         }
35808         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35809         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
35810 }
35811
35812 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35813         LDKCommitmentUpdate this_ptr_conv;
35814         this_ptr_conv.inner = untag_ptr(this_ptr);
35815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35817         this_ptr_conv.is_owned = false;
35818         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
35819         int64_tArray ret_arr = NULL;
35820         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35821         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35822         for (size_t z = 0; z < ret_var.datalen; z++) {
35823                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
35824                 int64_t ret_conv_25_ref = 0;
35825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
35826                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
35827                 ret_arr_ptr[z] = ret_conv_25_ref;
35828         }
35829         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35830         FREE(ret_var.data);
35831         return ret_arr;
35832 }
35833
35834 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) {
35835         LDKCommitmentUpdate this_ptr_conv;
35836         this_ptr_conv.inner = untag_ptr(this_ptr);
35837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35839         this_ptr_conv.is_owned = false;
35840         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
35841         val_constr.datalen = (*env)->GetArrayLength(env, val);
35842         if (val_constr.datalen > 0)
35843                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35844         else
35845                 val_constr.data = NULL;
35846         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35847         for (size_t z = 0; z < val_constr.datalen; z++) {
35848                 int64_t val_conv_25 = val_vals[z];
35849                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
35850                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
35851                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
35852                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
35853                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
35854                 val_constr.data[z] = val_conv_25_conv;
35855         }
35856         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35857         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
35858 }
35859
35860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
35861         LDKCommitmentUpdate this_ptr_conv;
35862         this_ptr_conv.inner = untag_ptr(this_ptr);
35863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35865         this_ptr_conv.is_owned = false;
35866         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
35867         int64_t ret_ref = 0;
35868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35870         return ret_ref;
35871 }
35872
35873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35874         LDKCommitmentUpdate this_ptr_conv;
35875         this_ptr_conv.inner = untag_ptr(this_ptr);
35876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35878         this_ptr_conv.is_owned = false;
35879         LDKUpdateFee val_conv;
35880         val_conv.inner = untag_ptr(val);
35881         val_conv.is_owned = ptr_is_owned(val);
35882         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35883         val_conv = UpdateFee_clone(&val_conv);
35884         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
35885 }
35886
35887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
35888         LDKCommitmentUpdate this_ptr_conv;
35889         this_ptr_conv.inner = untag_ptr(this_ptr);
35890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35892         this_ptr_conv.is_owned = false;
35893         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
35894         int64_t ret_ref = 0;
35895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35897         return ret_ref;
35898 }
35899
35900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35901         LDKCommitmentUpdate this_ptr_conv;
35902         this_ptr_conv.inner = untag_ptr(this_ptr);
35903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35905         this_ptr_conv.is_owned = false;
35906         LDKCommitmentSigned val_conv;
35907         val_conv.inner = untag_ptr(val);
35908         val_conv.is_owned = ptr_is_owned(val);
35909         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35910         val_conv = CommitmentSigned_clone(&val_conv);
35911         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
35912 }
35913
35914 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) {
35915         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
35916         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
35917         if (update_add_htlcs_arg_constr.datalen > 0)
35918                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35919         else
35920                 update_add_htlcs_arg_constr.data = NULL;
35921         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
35922         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
35923                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
35924                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
35925                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
35926                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
35927                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
35928                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
35929                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
35930         }
35931         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
35932         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
35933         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
35934         if (update_fulfill_htlcs_arg_constr.datalen > 0)
35935                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35936         else
35937                 update_fulfill_htlcs_arg_constr.data = NULL;
35938         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
35939         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
35940                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
35941                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
35942                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
35943                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
35944                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
35945                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
35946                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
35947         }
35948         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
35949         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
35950         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
35951         if (update_fail_htlcs_arg_constr.datalen > 0)
35952                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35953         else
35954                 update_fail_htlcs_arg_constr.data = NULL;
35955         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
35956         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
35957                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
35958                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
35959                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
35960                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
35961                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
35962                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
35963                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
35964         }
35965         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
35966         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
35967         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
35968         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
35969                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35970         else
35971                 update_fail_malformed_htlcs_arg_constr.data = NULL;
35972         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
35973         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
35974                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
35975                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
35976                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
35977                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
35978                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
35979                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
35980                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
35981         }
35982         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
35983         LDKUpdateFee update_fee_arg_conv;
35984         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
35985         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
35986         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
35987         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
35988         LDKCommitmentSigned commitment_signed_arg_conv;
35989         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
35990         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
35991         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
35992         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
35993         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);
35994         int64_t ret_ref = 0;
35995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35997         return ret_ref;
35998 }
35999
36000 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
36001         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
36002         int64_t ret_ref = 0;
36003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36005         return ret_ref;
36006 }
36007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36008         LDKCommitmentUpdate arg_conv;
36009         arg_conv.inner = untag_ptr(arg);
36010         arg_conv.is_owned = ptr_is_owned(arg);
36011         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36012         arg_conv.is_owned = false;
36013         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
36014         return ret_conv;
36015 }
36016
36017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36018         LDKCommitmentUpdate orig_conv;
36019         orig_conv.inner = untag_ptr(orig);
36020         orig_conv.is_owned = ptr_is_owned(orig);
36021         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36022         orig_conv.is_owned = false;
36023         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
36024         int64_t ret_ref = 0;
36025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36027         return ret_ref;
36028 }
36029
36030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36031         if (!ptr_is_owned(this_ptr)) return;
36032         void* this_ptr_ptr = untag_ptr(this_ptr);
36033         CHECK_ACCESS(this_ptr_ptr);
36034         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
36035         FREE(untag_ptr(this_ptr));
36036         ChannelMessageHandler_free(this_ptr_conv);
36037 }
36038
36039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36040         if (!ptr_is_owned(this_ptr)) return;
36041         void* this_ptr_ptr = untag_ptr(this_ptr);
36042         CHECK_ACCESS(this_ptr_ptr);
36043         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
36044         FREE(untag_ptr(this_ptr));
36045         RoutingMessageHandler_free(this_ptr_conv);
36046 }
36047
36048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36049         LDKAcceptChannel obj_conv;
36050         obj_conv.inner = untag_ptr(obj);
36051         obj_conv.is_owned = ptr_is_owned(obj);
36052         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36053         obj_conv.is_owned = false;
36054         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
36055         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36056         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36057         CVec_u8Z_free(ret_var);
36058         return ret_arr;
36059 }
36060
36061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36062         LDKu8slice ser_ref;
36063         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36064         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36065         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
36066         *ret_conv = AcceptChannel_read(ser_ref);
36067         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36068         return tag_ptr(ret_conv, true);
36069 }
36070
36071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36072         LDKAnnouncementSignatures obj_conv;
36073         obj_conv.inner = untag_ptr(obj);
36074         obj_conv.is_owned = ptr_is_owned(obj);
36075         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36076         obj_conv.is_owned = false;
36077         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
36078         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36079         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36080         CVec_u8Z_free(ret_var);
36081         return ret_arr;
36082 }
36083
36084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36085         LDKu8slice ser_ref;
36086         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36087         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36088         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
36089         *ret_conv = AnnouncementSignatures_read(ser_ref);
36090         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36091         return tag_ptr(ret_conv, true);
36092 }
36093
36094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
36095         LDKChannelReestablish obj_conv;
36096         obj_conv.inner = untag_ptr(obj);
36097         obj_conv.is_owned = ptr_is_owned(obj);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36099         obj_conv.is_owned = false;
36100         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
36101         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36102         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36103         CVec_u8Z_free(ret_var);
36104         return ret_arr;
36105 }
36106
36107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36108         LDKu8slice ser_ref;
36109         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36110         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36111         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
36112         *ret_conv = ChannelReestablish_read(ser_ref);
36113         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36114         return tag_ptr(ret_conv, true);
36115 }
36116
36117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36118         LDKClosingSigned obj_conv;
36119         obj_conv.inner = untag_ptr(obj);
36120         obj_conv.is_owned = ptr_is_owned(obj);
36121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36122         obj_conv.is_owned = false;
36123         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
36124         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36125         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36126         CVec_u8Z_free(ret_var);
36127         return ret_arr;
36128 }
36129
36130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36131         LDKu8slice ser_ref;
36132         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36133         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36134         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
36135         *ret_conv = ClosingSigned_read(ser_ref);
36136         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36137         return tag_ptr(ret_conv, true);
36138 }
36139
36140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36141         LDKClosingSignedFeeRange obj_conv;
36142         obj_conv.inner = untag_ptr(obj);
36143         obj_conv.is_owned = ptr_is_owned(obj);
36144         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36145         obj_conv.is_owned = false;
36146         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
36147         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36148         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36149         CVec_u8Z_free(ret_var);
36150         return ret_arr;
36151 }
36152
36153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36154         LDKu8slice ser_ref;
36155         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36156         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36157         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
36158         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
36159         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36160         return tag_ptr(ret_conv, true);
36161 }
36162
36163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36164         LDKCommitmentSigned obj_conv;
36165         obj_conv.inner = untag_ptr(obj);
36166         obj_conv.is_owned = ptr_is_owned(obj);
36167         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36168         obj_conv.is_owned = false;
36169         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
36170         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36171         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36172         CVec_u8Z_free(ret_var);
36173         return ret_arr;
36174 }
36175
36176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36177         LDKu8slice ser_ref;
36178         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36179         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36180         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
36181         *ret_conv = CommitmentSigned_read(ser_ref);
36182         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36183         return tag_ptr(ret_conv, true);
36184 }
36185
36186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
36187         LDKFundingCreated obj_conv;
36188         obj_conv.inner = untag_ptr(obj);
36189         obj_conv.is_owned = ptr_is_owned(obj);
36190         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36191         obj_conv.is_owned = false;
36192         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
36193         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36194         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36195         CVec_u8Z_free(ret_var);
36196         return ret_arr;
36197 }
36198
36199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36200         LDKu8slice ser_ref;
36201         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36202         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36203         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
36204         *ret_conv = FundingCreated_read(ser_ref);
36205         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36206         return tag_ptr(ret_conv, true);
36207 }
36208
36209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
36210         LDKFundingSigned obj_conv;
36211         obj_conv.inner = untag_ptr(obj);
36212         obj_conv.is_owned = ptr_is_owned(obj);
36213         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36214         obj_conv.is_owned = false;
36215         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
36216         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36217         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36218         CVec_u8Z_free(ret_var);
36219         return ret_arr;
36220 }
36221
36222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36223         LDKu8slice ser_ref;
36224         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36225         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36226         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
36227         *ret_conv = FundingSigned_read(ser_ref);
36228         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36229         return tag_ptr(ret_conv, true);
36230 }
36231
36232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
36233         LDKChannelReady obj_conv;
36234         obj_conv.inner = untag_ptr(obj);
36235         obj_conv.is_owned = ptr_is_owned(obj);
36236         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36237         obj_conv.is_owned = false;
36238         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
36239         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36240         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36241         CVec_u8Z_free(ret_var);
36242         return ret_arr;
36243 }
36244
36245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36246         LDKu8slice ser_ref;
36247         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36248         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36249         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
36250         *ret_conv = ChannelReady_read(ser_ref);
36251         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36252         return tag_ptr(ret_conv, true);
36253 }
36254
36255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
36256         LDKInit obj_conv;
36257         obj_conv.inner = untag_ptr(obj);
36258         obj_conv.is_owned = ptr_is_owned(obj);
36259         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36260         obj_conv.is_owned = false;
36261         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
36262         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36263         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36264         CVec_u8Z_free(ret_var);
36265         return ret_arr;
36266 }
36267
36268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36269         LDKu8slice ser_ref;
36270         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36271         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36272         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
36273         *ret_conv = Init_read(ser_ref);
36274         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36275         return tag_ptr(ret_conv, true);
36276 }
36277
36278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
36279         LDKOpenChannel obj_conv;
36280         obj_conv.inner = untag_ptr(obj);
36281         obj_conv.is_owned = ptr_is_owned(obj);
36282         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36283         obj_conv.is_owned = false;
36284         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
36285         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36286         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36287         CVec_u8Z_free(ret_var);
36288         return ret_arr;
36289 }
36290
36291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36292         LDKu8slice ser_ref;
36293         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36294         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36295         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
36296         *ret_conv = OpenChannel_read(ser_ref);
36297         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36298         return tag_ptr(ret_conv, true);
36299 }
36300
36301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
36302         LDKRevokeAndACK obj_conv;
36303         obj_conv.inner = untag_ptr(obj);
36304         obj_conv.is_owned = ptr_is_owned(obj);
36305         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36306         obj_conv.is_owned = false;
36307         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
36308         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36309         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36310         CVec_u8Z_free(ret_var);
36311         return ret_arr;
36312 }
36313
36314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36315         LDKu8slice ser_ref;
36316         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36317         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36318         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
36319         *ret_conv = RevokeAndACK_read(ser_ref);
36320         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36321         return tag_ptr(ret_conv, true);
36322 }
36323
36324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
36325         LDKShutdown obj_conv;
36326         obj_conv.inner = untag_ptr(obj);
36327         obj_conv.is_owned = ptr_is_owned(obj);
36328         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36329         obj_conv.is_owned = false;
36330         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
36331         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36332         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36333         CVec_u8Z_free(ret_var);
36334         return ret_arr;
36335 }
36336
36337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36338         LDKu8slice ser_ref;
36339         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36340         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36341         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
36342         *ret_conv = Shutdown_read(ser_ref);
36343         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36344         return tag_ptr(ret_conv, true);
36345 }
36346
36347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36348         LDKUpdateFailHTLC obj_conv;
36349         obj_conv.inner = untag_ptr(obj);
36350         obj_conv.is_owned = ptr_is_owned(obj);
36351         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36352         obj_conv.is_owned = false;
36353         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
36354         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36355         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36356         CVec_u8Z_free(ret_var);
36357         return ret_arr;
36358 }
36359
36360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36361         LDKu8slice ser_ref;
36362         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36363         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36364         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
36365         *ret_conv = UpdateFailHTLC_read(ser_ref);
36366         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36367         return tag_ptr(ret_conv, true);
36368 }
36369
36370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36371         LDKUpdateFailMalformedHTLC obj_conv;
36372         obj_conv.inner = untag_ptr(obj);
36373         obj_conv.is_owned = ptr_is_owned(obj);
36374         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36375         obj_conv.is_owned = false;
36376         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
36377         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36378         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36379         CVec_u8Z_free(ret_var);
36380         return ret_arr;
36381 }
36382
36383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36384         LDKu8slice ser_ref;
36385         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36386         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36387         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
36388         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
36389         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36390         return tag_ptr(ret_conv, true);
36391 }
36392
36393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
36394         LDKUpdateFee obj_conv;
36395         obj_conv.inner = untag_ptr(obj);
36396         obj_conv.is_owned = ptr_is_owned(obj);
36397         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36398         obj_conv.is_owned = false;
36399         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
36400         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36401         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36402         CVec_u8Z_free(ret_var);
36403         return ret_arr;
36404 }
36405
36406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36407         LDKu8slice ser_ref;
36408         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36409         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36410         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
36411         *ret_conv = UpdateFee_read(ser_ref);
36412         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36413         return tag_ptr(ret_conv, true);
36414 }
36415
36416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36417         LDKUpdateFulfillHTLC obj_conv;
36418         obj_conv.inner = untag_ptr(obj);
36419         obj_conv.is_owned = ptr_is_owned(obj);
36420         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36421         obj_conv.is_owned = false;
36422         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36423         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36424         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36425         CVec_u8Z_free(ret_var);
36426         return ret_arr;
36427 }
36428
36429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36430         LDKu8slice ser_ref;
36431         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36432         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36433         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36434         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36435         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36436         return tag_ptr(ret_conv, true);
36437 }
36438
36439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
36440         LDKUpdateAddHTLC obj_conv;
36441         obj_conv.inner = untag_ptr(obj);
36442         obj_conv.is_owned = ptr_is_owned(obj);
36443         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36444         obj_conv.is_owned = false;
36445         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36446         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36447         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36448         CVec_u8Z_free(ret_var);
36449         return ret_arr;
36450 }
36451
36452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36453         LDKu8slice ser_ref;
36454         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36455         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36456         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36457         *ret_conv = UpdateAddHTLC_read(ser_ref);
36458         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36459         return tag_ptr(ret_conv, true);
36460 }
36461
36462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
36463         LDKPing obj_conv;
36464         obj_conv.inner = untag_ptr(obj);
36465         obj_conv.is_owned = ptr_is_owned(obj);
36466         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36467         obj_conv.is_owned = false;
36468         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36469         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36470         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36471         CVec_u8Z_free(ret_var);
36472         return ret_arr;
36473 }
36474
36475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36476         LDKu8slice ser_ref;
36477         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36478         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36479         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36480         *ret_conv = Ping_read(ser_ref);
36481         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36482         return tag_ptr(ret_conv, true);
36483 }
36484
36485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
36486         LDKPong obj_conv;
36487         obj_conv.inner = untag_ptr(obj);
36488         obj_conv.is_owned = ptr_is_owned(obj);
36489         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36490         obj_conv.is_owned = false;
36491         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36492         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36493         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36494         CVec_u8Z_free(ret_var);
36495         return ret_arr;
36496 }
36497
36498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36499         LDKu8slice ser_ref;
36500         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36501         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36502         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36503         *ret_conv = Pong_read(ser_ref);
36504         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36505         return tag_ptr(ret_conv, true);
36506 }
36507
36508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36509         LDKUnsignedChannelAnnouncement obj_conv;
36510         obj_conv.inner = untag_ptr(obj);
36511         obj_conv.is_owned = ptr_is_owned(obj);
36512         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36513         obj_conv.is_owned = false;
36514         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36515         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36516         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36517         CVec_u8Z_free(ret_var);
36518         return ret_arr;
36519 }
36520
36521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36522         LDKu8slice ser_ref;
36523         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36524         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36525         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36526         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36527         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36528         return tag_ptr(ret_conv, true);
36529 }
36530
36531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36532         LDKChannelAnnouncement obj_conv;
36533         obj_conv.inner = untag_ptr(obj);
36534         obj_conv.is_owned = ptr_is_owned(obj);
36535         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36536         obj_conv.is_owned = false;
36537         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36538         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36539         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36540         CVec_u8Z_free(ret_var);
36541         return ret_arr;
36542 }
36543
36544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36545         LDKu8slice ser_ref;
36546         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36547         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36548         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36549         *ret_conv = ChannelAnnouncement_read(ser_ref);
36550         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36551         return tag_ptr(ret_conv, true);
36552 }
36553
36554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36555         LDKUnsignedChannelUpdate obj_conv;
36556         obj_conv.inner = untag_ptr(obj);
36557         obj_conv.is_owned = ptr_is_owned(obj);
36558         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36559         obj_conv.is_owned = false;
36560         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36561         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36562         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36563         CVec_u8Z_free(ret_var);
36564         return ret_arr;
36565 }
36566
36567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36568         LDKu8slice ser_ref;
36569         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36570         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36571         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36572         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36573         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36574         return tag_ptr(ret_conv, true);
36575 }
36576
36577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
36578         LDKChannelUpdate obj_conv;
36579         obj_conv.inner = untag_ptr(obj);
36580         obj_conv.is_owned = ptr_is_owned(obj);
36581         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36582         obj_conv.is_owned = false;
36583         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36584         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36585         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36586         CVec_u8Z_free(ret_var);
36587         return ret_arr;
36588 }
36589
36590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36591         LDKu8slice ser_ref;
36592         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36593         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36594         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36595         *ret_conv = ChannelUpdate_read(ser_ref);
36596         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36597         return tag_ptr(ret_conv, true);
36598 }
36599
36600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36601         LDKErrorMessage obj_conv;
36602         obj_conv.inner = untag_ptr(obj);
36603         obj_conv.is_owned = ptr_is_owned(obj);
36604         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36605         obj_conv.is_owned = false;
36606         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36607         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36608         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36609         CVec_u8Z_free(ret_var);
36610         return ret_arr;
36611 }
36612
36613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36614         LDKu8slice ser_ref;
36615         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36616         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36617         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36618         *ret_conv = ErrorMessage_read(ser_ref);
36619         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36620         return tag_ptr(ret_conv, true);
36621 }
36622
36623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
36624         LDKWarningMessage obj_conv;
36625         obj_conv.inner = untag_ptr(obj);
36626         obj_conv.is_owned = ptr_is_owned(obj);
36627         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36628         obj_conv.is_owned = false;
36629         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36630         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36631         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36632         CVec_u8Z_free(ret_var);
36633         return ret_arr;
36634 }
36635
36636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36637         LDKu8slice ser_ref;
36638         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36639         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36640         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36641         *ret_conv = WarningMessage_read(ser_ref);
36642         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36643         return tag_ptr(ret_conv, true);
36644 }
36645
36646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36647         LDKUnsignedNodeAnnouncement obj_conv;
36648         obj_conv.inner = untag_ptr(obj);
36649         obj_conv.is_owned = ptr_is_owned(obj);
36650         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36651         obj_conv.is_owned = false;
36652         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36653         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36654         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36655         CVec_u8Z_free(ret_var);
36656         return ret_arr;
36657 }
36658
36659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36660         LDKu8slice ser_ref;
36661         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36662         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36663         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36664         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36665         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36666         return tag_ptr(ret_conv, true);
36667 }
36668
36669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36670         LDKNodeAnnouncement obj_conv;
36671         obj_conv.inner = untag_ptr(obj);
36672         obj_conv.is_owned = ptr_is_owned(obj);
36673         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36674         obj_conv.is_owned = false;
36675         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36676         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36677         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36678         CVec_u8Z_free(ret_var);
36679         return ret_arr;
36680 }
36681
36682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36683         LDKu8slice ser_ref;
36684         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36685         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36686         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36687         *ret_conv = NodeAnnouncement_read(ser_ref);
36688         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36689         return tag_ptr(ret_conv, true);
36690 }
36691
36692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36693         LDKu8slice ser_ref;
36694         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36695         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36696         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36697         *ret_conv = QueryShortChannelIds_read(ser_ref);
36698         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36699         return tag_ptr(ret_conv, true);
36700 }
36701
36702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
36703         LDKQueryShortChannelIds obj_conv;
36704         obj_conv.inner = untag_ptr(obj);
36705         obj_conv.is_owned = ptr_is_owned(obj);
36706         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36707         obj_conv.is_owned = false;
36708         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
36709         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36710         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36711         CVec_u8Z_free(ret_var);
36712         return ret_arr;
36713 }
36714
36715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
36716         LDKReplyShortChannelIdsEnd obj_conv;
36717         obj_conv.inner = untag_ptr(obj);
36718         obj_conv.is_owned = ptr_is_owned(obj);
36719         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36720         obj_conv.is_owned = false;
36721         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36722         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36723         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36724         CVec_u8Z_free(ret_var);
36725         return ret_arr;
36726 }
36727
36728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36729         LDKu8slice ser_ref;
36730         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36731         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36732         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36733         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36734         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36735         return tag_ptr(ret_conv, true);
36736 }
36737
36738 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
36739         LDKQueryChannelRange this_arg_conv;
36740         this_arg_conv.inner = untag_ptr(this_arg);
36741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36743         this_arg_conv.is_owned = false;
36744         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
36745         return ret_conv;
36746 }
36747
36748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36749         LDKQueryChannelRange obj_conv;
36750         obj_conv.inner = untag_ptr(obj);
36751         obj_conv.is_owned = ptr_is_owned(obj);
36752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36753         obj_conv.is_owned = false;
36754         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36755         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36756         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36757         CVec_u8Z_free(ret_var);
36758         return ret_arr;
36759 }
36760
36761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36762         LDKu8slice ser_ref;
36763         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36764         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36765         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36766         *ret_conv = QueryChannelRange_read(ser_ref);
36767         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36768         return tag_ptr(ret_conv, true);
36769 }
36770
36771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36772         LDKu8slice ser_ref;
36773         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36774         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36775         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36776         *ret_conv = ReplyChannelRange_read(ser_ref);
36777         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36778         return tag_ptr(ret_conv, true);
36779 }
36780
36781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36782         LDKReplyChannelRange obj_conv;
36783         obj_conv.inner = untag_ptr(obj);
36784         obj_conv.is_owned = ptr_is_owned(obj);
36785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36786         obj_conv.is_owned = false;
36787         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36788         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36789         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36790         CVec_u8Z_free(ret_var);
36791         return ret_arr;
36792 }
36793
36794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
36795         LDKGossipTimestampFilter obj_conv;
36796         obj_conv.inner = untag_ptr(obj);
36797         obj_conv.is_owned = ptr_is_owned(obj);
36798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36799         obj_conv.is_owned = false;
36800         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
36801         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36802         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36803         CVec_u8Z_free(ret_var);
36804         return ret_arr;
36805 }
36806
36807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36808         LDKu8slice ser_ref;
36809         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36810         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36811         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36812         *ret_conv = GossipTimestampFilter_read(ser_ref);
36813         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36814         return tag_ptr(ret_conv, true);
36815 }
36816
36817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36818         if (!ptr_is_owned(this_ptr)) return;
36819         void* this_ptr_ptr = untag_ptr(this_ptr);
36820         CHECK_ACCESS(this_ptr_ptr);
36821         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
36822         FREE(untag_ptr(this_ptr));
36823         CustomMessageHandler_free(this_ptr_conv);
36824 }
36825
36826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36827         LDKIgnoringMessageHandler this_obj_conv;
36828         this_obj_conv.inner = untag_ptr(this_obj);
36829         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36831         IgnoringMessageHandler_free(this_obj_conv);
36832 }
36833
36834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
36835         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
36836         int64_t ret_ref = 0;
36837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36839         return ret_ref;
36840 }
36841
36842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36843         LDKIgnoringMessageHandler this_arg_conv;
36844         this_arg_conv.inner = untag_ptr(this_arg);
36845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36847         this_arg_conv.is_owned = false;
36848         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36849         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36850         return tag_ptr(ret_ret, true);
36851 }
36852
36853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36854         LDKIgnoringMessageHandler this_arg_conv;
36855         this_arg_conv.inner = untag_ptr(this_arg);
36856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36858         this_arg_conv.is_owned = false;
36859         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
36860         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
36861         return tag_ptr(ret_ret, true);
36862 }
36863
36864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
36865         LDKIgnoringMessageHandler this_arg_conv;
36866         this_arg_conv.inner = untag_ptr(this_arg);
36867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36869         this_arg_conv.is_owned = false;
36870         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
36871         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
36872         return tag_ptr(ret_ret, true);
36873 }
36874
36875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36876         LDKIgnoringMessageHandler this_arg_conv;
36877         this_arg_conv.inner = untag_ptr(this_arg);
36878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36880         this_arg_conv.is_owned = false;
36881         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
36882         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
36883         return tag_ptr(ret_ret, true);
36884 }
36885
36886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36887         LDKErroringMessageHandler this_obj_conv;
36888         this_obj_conv.inner = untag_ptr(this_obj);
36889         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36891         ErroringMessageHandler_free(this_obj_conv);
36892 }
36893
36894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
36895         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
36896         int64_t ret_ref = 0;
36897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36899         return ret_ref;
36900 }
36901
36902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36903         LDKErroringMessageHandler this_arg_conv;
36904         this_arg_conv.inner = untag_ptr(this_arg);
36905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36907         this_arg_conv.is_owned = false;
36908         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36909         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36910         return tag_ptr(ret_ret, true);
36911 }
36912
36913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36914         LDKErroringMessageHandler this_arg_conv;
36915         this_arg_conv.inner = untag_ptr(this_arg);
36916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36918         this_arg_conv.is_owned = false;
36919         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36920         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
36921         return tag_ptr(ret_ret, true);
36922 }
36923
36924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36925         LDKMessageHandler this_obj_conv;
36926         this_obj_conv.inner = untag_ptr(this_obj);
36927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36929         MessageHandler_free(this_obj_conv);
36930 }
36931
36932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36933         LDKMessageHandler this_ptr_conv;
36934         this_ptr_conv.inner = untag_ptr(this_ptr);
36935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36937         this_ptr_conv.is_owned = false;
36938         // WARNING: This object doesn't live past this scope, needs clone!
36939         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
36940         return ret_ret;
36941 }
36942
36943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36944         LDKMessageHandler this_ptr_conv;
36945         this_ptr_conv.inner = untag_ptr(this_ptr);
36946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36948         this_ptr_conv.is_owned = false;
36949         void* val_ptr = untag_ptr(val);
36950         CHECK_ACCESS(val_ptr);
36951         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
36952         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
36953                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36954                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
36955         }
36956         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
36957 }
36958
36959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36960         LDKMessageHandler this_ptr_conv;
36961         this_ptr_conv.inner = untag_ptr(this_ptr);
36962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36964         this_ptr_conv.is_owned = false;
36965         // WARNING: This object doesn't live past this scope, needs clone!
36966         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
36967         return ret_ret;
36968 }
36969
36970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36971         LDKMessageHandler this_ptr_conv;
36972         this_ptr_conv.inner = untag_ptr(this_ptr);
36973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36975         this_ptr_conv.is_owned = false;
36976         void* val_ptr = untag_ptr(val);
36977         CHECK_ACCESS(val_ptr);
36978         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
36979         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36980                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36981                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
36982         }
36983         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
36984 }
36985
36986 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) {
36987         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
36988         CHECK_ACCESS(chan_handler_arg_ptr);
36989         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
36990         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
36991                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36992                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
36993         }
36994         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
36995         CHECK_ACCESS(route_handler_arg_ptr);
36996         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
36997         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36999                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
37000         }
37001         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
37002         int64_t ret_ref = 0;
37003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37005         return ret_ref;
37006 }
37007
37008 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
37009         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37010         *ret_ret = SocketDescriptor_clone(arg);
37011         return tag_ptr(ret_ret, true);
37012 }
37013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37014         void* arg_ptr = untag_ptr(arg);
37015         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
37016         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
37017         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
37018         return ret_conv;
37019 }
37020
37021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37022         void* orig_ptr = untag_ptr(orig);
37023         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
37024         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
37025         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
37026         *ret_ret = SocketDescriptor_clone(orig_conv);
37027         return tag_ptr(ret_ret, true);
37028 }
37029
37030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37031         if (!ptr_is_owned(this_ptr)) return;
37032         void* this_ptr_ptr = untag_ptr(this_ptr);
37033         CHECK_ACCESS(this_ptr_ptr);
37034         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
37035         FREE(untag_ptr(this_ptr));
37036         SocketDescriptor_free(this_ptr_conv);
37037 }
37038
37039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37040         LDKPeerHandleError this_obj_conv;
37041         this_obj_conv.inner = untag_ptr(this_obj);
37042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37044         PeerHandleError_free(this_obj_conv);
37045 }
37046
37047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
37048         LDKPeerHandleError this_ptr_conv;
37049         this_ptr_conv.inner = untag_ptr(this_ptr);
37050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37052         this_ptr_conv.is_owned = false;
37053         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
37054         return ret_conv;
37055 }
37056
37057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37058         LDKPeerHandleError this_ptr_conv;
37059         this_ptr_conv.inner = untag_ptr(this_ptr);
37060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37062         this_ptr_conv.is_owned = false;
37063         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
37064 }
37065
37066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
37067         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
37068         int64_t ret_ref = 0;
37069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37071         return ret_ref;
37072 }
37073
37074 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
37075         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
37076         int64_t ret_ref = 0;
37077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37079         return ret_ref;
37080 }
37081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37082         LDKPeerHandleError arg_conv;
37083         arg_conv.inner = untag_ptr(arg);
37084         arg_conv.is_owned = ptr_is_owned(arg);
37085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37086         arg_conv.is_owned = false;
37087         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
37088         return ret_conv;
37089 }
37090
37091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37092         LDKPeerHandleError orig_conv;
37093         orig_conv.inner = untag_ptr(orig);
37094         orig_conv.is_owned = ptr_is_owned(orig);
37095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37096         orig_conv.is_owned = false;
37097         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
37098         int64_t ret_ref = 0;
37099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37101         return ret_ref;
37102 }
37103
37104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37105         LDKPeerManager this_obj_conv;
37106         this_obj_conv.inner = untag_ptr(this_obj);
37107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37109         PeerManager_free(this_obj_conv);
37110 }
37111
37112 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) {
37113         LDKMessageHandler message_handler_conv;
37114         message_handler_conv.inner = untag_ptr(message_handler);
37115         message_handler_conv.is_owned = ptr_is_owned(message_handler);
37116         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
37117         // WARNING: we need a move here but no clone is available for LDKMessageHandler
37118         
37119         LDKSecretKey our_node_secret_ref;
37120         CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
37121         (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
37122         unsigned char ephemeral_random_data_arr[32];
37123         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
37124         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
37125         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
37126         void* logger_ptr = untag_ptr(logger);
37127         CHECK_ACCESS(logger_ptr);
37128         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37129         if (logger_conv.free == LDKLogger_JCalls_free) {
37130                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37131                 LDKLogger_JCalls_cloned(&logger_conv);
37132         }
37133         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
37134         CHECK_ACCESS(custom_message_handler_ptr);
37135         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
37136         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
37137                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37138                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
37139         }
37140         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
37141         int64_t ret_ref = 0;
37142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37144         return ret_ref;
37145 }
37146
37147 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
37148         LDKPeerManager this_arg_conv;
37149         this_arg_conv.inner = untag_ptr(this_arg);
37150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37152         this_arg_conv.is_owned = false;
37153         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
37154         jobjectArray ret_arr = NULL;
37155         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
37156         ;
37157         for (size_t i = 0; i < ret_var.datalen; i++) {
37158                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
37159                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
37160                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
37161         }
37162         
37163         FREE(ret_var.data);
37164         return ret_arr;
37165 }
37166
37167 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) {
37168         LDKPeerManager this_arg_conv;
37169         this_arg_conv.inner = untag_ptr(this_arg);
37170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37172         this_arg_conv.is_owned = false;
37173         LDKPublicKey their_node_id_ref;
37174         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
37175         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
37176         void* descriptor_ptr = untag_ptr(descriptor);
37177         CHECK_ACCESS(descriptor_ptr);
37178         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37179         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37180                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37181                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37182         }
37183         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37184         CHECK_ACCESS(remote_network_address_ptr);
37185         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37186         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
37187         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
37188         return tag_ptr(ret_conv, true);
37189 }
37190
37191 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) {
37192         LDKPeerManager 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         void* descriptor_ptr = untag_ptr(descriptor);
37198         CHECK_ACCESS(descriptor_ptr);
37199         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
37200         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
37201                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37202                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
37203         }
37204         void* remote_network_address_ptr = untag_ptr(remote_network_address);
37205         CHECK_ACCESS(remote_network_address_ptr);
37206         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
37207         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37208         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
37209         return tag_ptr(ret_conv, true);
37210 }
37211
37212 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) {
37213         LDKPeerManager this_arg_conv;
37214         this_arg_conv.inner = untag_ptr(this_arg);
37215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37217         this_arg_conv.is_owned = false;
37218         void* descriptor_ptr = untag_ptr(descriptor);
37219         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37220         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37221         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
37222         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
37223         return tag_ptr(ret_conv, true);
37224 }
37225
37226 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) {
37227         LDKPeerManager this_arg_conv;
37228         this_arg_conv.inner = untag_ptr(this_arg);
37229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37231         this_arg_conv.is_owned = false;
37232         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
37233         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
37234         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
37235         LDKu8slice data_ref;
37236         data_ref.datalen = (*env)->GetArrayLength(env, data);
37237         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
37238         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
37239         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
37240         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
37241         return tag_ptr(ret_conv, true);
37242 }
37243
37244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
37245         LDKPeerManager this_arg_conv;
37246         this_arg_conv.inner = untag_ptr(this_arg);
37247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37249         this_arg_conv.is_owned = false;
37250         PeerManager_process_events(&this_arg_conv);
37251 }
37252
37253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
37254         LDKPeerManager this_arg_conv;
37255         this_arg_conv.inner = untag_ptr(this_arg);
37256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37258         this_arg_conv.is_owned = false;
37259         void* descriptor_ptr = untag_ptr(descriptor);
37260         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
37261         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
37262         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
37263 }
37264
37265 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) {
37266         LDKPeerManager this_arg_conv;
37267         this_arg_conv.inner = untag_ptr(this_arg);
37268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37270         this_arg_conv.is_owned = false;
37271         LDKPublicKey node_id_ref;
37272         CHECK((*env)->GetArrayLength(env, node_id) == 33);
37273         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
37274         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
37275 }
37276
37277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
37278         LDKPeerManager this_arg_conv;
37279         this_arg_conv.inner = untag_ptr(this_arg);
37280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37282         this_arg_conv.is_owned = false;
37283         PeerManager_disconnect_all_peers(&this_arg_conv);
37284 }
37285
37286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
37287         LDKPeerManager this_arg_conv;
37288         this_arg_conv.inner = untag_ptr(this_arg);
37289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37291         this_arg_conv.is_owned = false;
37292         PeerManager_timer_tick_occurred(&this_arg_conv);
37293 }
37294
37295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37296         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
37297         return ret_conv;
37298 }
37299
37300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
37301         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37302         return ret_conv;
37303 }
37304
37305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
37306         unsigned char commitment_seed_arr[32];
37307         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
37308         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
37309         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
37310         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37311         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
37312         return ret_arr;
37313 }
37314
37315 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) {
37316         LDKCVec_u8Z to_holder_script_ref;
37317         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
37318         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37319         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
37320         LDKCVec_u8Z to_counterparty_script_ref;
37321         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
37322         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37323         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
37324         LDKOutPoint funding_outpoint_conv;
37325         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37326         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37327         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37328         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37329         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);
37330         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37331         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37332         Transaction_free(ret_var);
37333         return ret_arr;
37334 }
37335
37336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37337         LDKCounterpartyCommitmentSecrets this_obj_conv;
37338         this_obj_conv.inner = untag_ptr(this_obj);
37339         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37341         CounterpartyCommitmentSecrets_free(this_obj_conv);
37342 }
37343
37344 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37345         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37346         int64_t ret_ref = 0;
37347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37349         return ret_ref;
37350 }
37351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37352         LDKCounterpartyCommitmentSecrets arg_conv;
37353         arg_conv.inner = untag_ptr(arg);
37354         arg_conv.is_owned = ptr_is_owned(arg);
37355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37356         arg_conv.is_owned = false;
37357         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37358         return ret_conv;
37359 }
37360
37361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37362         LDKCounterpartyCommitmentSecrets orig_conv;
37363         orig_conv.inner = untag_ptr(orig);
37364         orig_conv.is_owned = ptr_is_owned(orig);
37365         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37366         orig_conv.is_owned = false;
37367         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37368         int64_t ret_ref = 0;
37369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37371         return ret_ref;
37372 }
37373
37374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
37375         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37376         int64_t ret_ref = 0;
37377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37379         return ret_ref;
37380 }
37381
37382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
37383         LDKCounterpartyCommitmentSecrets this_arg_conv;
37384         this_arg_conv.inner = untag_ptr(this_arg);
37385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37387         this_arg_conv.is_owned = false;
37388         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37389         return ret_conv;
37390 }
37391
37392 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) {
37393         LDKCounterpartyCommitmentSecrets this_arg_conv;
37394         this_arg_conv.inner = untag_ptr(this_arg);
37395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37397         this_arg_conv.is_owned = false;
37398         LDKThirtyTwoBytes secret_ref;
37399         CHECK((*env)->GetArrayLength(env, secret) == 32);
37400         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
37401         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37402         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37403         return tag_ptr(ret_conv, true);
37404 }
37405
37406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
37407         LDKCounterpartyCommitmentSecrets this_arg_conv;
37408         this_arg_conv.inner = untag_ptr(this_arg);
37409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37411         this_arg_conv.is_owned = false;
37412         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37413         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
37414         return ret_arr;
37415 }
37416
37417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
37418         LDKCounterpartyCommitmentSecrets obj_conv;
37419         obj_conv.inner = untag_ptr(obj);
37420         obj_conv.is_owned = ptr_is_owned(obj);
37421         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37422         obj_conv.is_owned = false;
37423         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37424         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37425         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37426         CVec_u8Z_free(ret_var);
37427         return ret_arr;
37428 }
37429
37430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37431         LDKu8slice ser_ref;
37432         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37433         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37434         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37435         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37436         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37437         return tag_ptr(ret_conv, true);
37438 }
37439
37440 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) {
37441         LDKPublicKey per_commitment_point_ref;
37442         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37443         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37444         unsigned char base_secret_arr[32];
37445         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
37446         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
37447         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
37448         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37449         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
37450         return tag_ptr(ret_conv, true);
37451 }
37452
37453 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) {
37454         LDKPublicKey per_commitment_point_ref;
37455         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37456         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37457         LDKPublicKey base_point_ref;
37458         CHECK((*env)->GetArrayLength(env, base_point) == 33);
37459         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
37460         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37461         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
37462         return tag_ptr(ret_conv, true);
37463 }
37464
37465 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) {
37466         unsigned char per_commitment_secret_arr[32];
37467         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
37468         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
37469         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37470         unsigned char countersignatory_revocation_base_secret_arr[32];
37471         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
37472         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
37473         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37474         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
37475         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
37476         return tag_ptr(ret_conv, true);
37477 }
37478
37479 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) {
37480         LDKPublicKey per_commitment_point_ref;
37481         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37482         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37483         LDKPublicKey countersignatory_revocation_base_point_ref;
37484         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
37485         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
37486         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
37487         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
37488         return tag_ptr(ret_conv, true);
37489 }
37490
37491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37492         LDKTxCreationKeys this_obj_conv;
37493         this_obj_conv.inner = untag_ptr(this_obj);
37494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37496         TxCreationKeys_free(this_obj_conv);
37497 }
37498
37499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37500         LDKTxCreationKeys this_ptr_conv;
37501         this_ptr_conv.inner = untag_ptr(this_ptr);
37502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37504         this_ptr_conv.is_owned = false;
37505         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37506         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
37507         return ret_arr;
37508 }
37509
37510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37511         LDKTxCreationKeys this_ptr_conv;
37512         this_ptr_conv.inner = untag_ptr(this_ptr);
37513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37515         this_ptr_conv.is_owned = false;
37516         LDKPublicKey val_ref;
37517         CHECK((*env)->GetArrayLength(env, val) == 33);
37518         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37519         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37520 }
37521
37522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37523         LDKTxCreationKeys this_ptr_conv;
37524         this_ptr_conv.inner = untag_ptr(this_ptr);
37525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37527         this_ptr_conv.is_owned = false;
37528         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37529         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
37530         return ret_arr;
37531 }
37532
37533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37534         LDKTxCreationKeys this_ptr_conv;
37535         this_ptr_conv.inner = untag_ptr(this_ptr);
37536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37538         this_ptr_conv.is_owned = false;
37539         LDKPublicKey val_ref;
37540         CHECK((*env)->GetArrayLength(env, val) == 33);
37541         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37542         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37543 }
37544
37545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37546         LDKTxCreationKeys this_ptr_conv;
37547         this_ptr_conv.inner = untag_ptr(this_ptr);
37548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37550         this_ptr_conv.is_owned = false;
37551         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37552         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
37553         return ret_arr;
37554 }
37555
37556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37557         LDKTxCreationKeys this_ptr_conv;
37558         this_ptr_conv.inner = untag_ptr(this_ptr);
37559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37561         this_ptr_conv.is_owned = false;
37562         LDKPublicKey val_ref;
37563         CHECK((*env)->GetArrayLength(env, val) == 33);
37564         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37565         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
37566 }
37567
37568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37569         LDKTxCreationKeys this_ptr_conv;
37570         this_ptr_conv.inner = untag_ptr(this_ptr);
37571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37573         this_ptr_conv.is_owned = false;
37574         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37575         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
37576         return ret_arr;
37577 }
37578
37579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37580         LDKTxCreationKeys this_ptr_conv;
37581         this_ptr_conv.inner = untag_ptr(this_ptr);
37582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37584         this_ptr_conv.is_owned = false;
37585         LDKPublicKey val_ref;
37586         CHECK((*env)->GetArrayLength(env, val) == 33);
37587         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37588         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
37589 }
37590
37591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
37592         LDKTxCreationKeys this_ptr_conv;
37593         this_ptr_conv.inner = untag_ptr(this_ptr);
37594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37596         this_ptr_conv.is_owned = false;
37597         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37598         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
37599         return ret_arr;
37600 }
37601
37602 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) {
37603         LDKTxCreationKeys this_ptr_conv;
37604         this_ptr_conv.inner = untag_ptr(this_ptr);
37605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37607         this_ptr_conv.is_owned = false;
37608         LDKPublicKey val_ref;
37609         CHECK((*env)->GetArrayLength(env, val) == 33);
37610         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37611         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
37612 }
37613
37614 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) {
37615         LDKPublicKey per_commitment_point_arg_ref;
37616         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
37617         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
37618         LDKPublicKey revocation_key_arg_ref;
37619         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
37620         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
37621         LDKPublicKey broadcaster_htlc_key_arg_ref;
37622         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
37623         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
37624         LDKPublicKey countersignatory_htlc_key_arg_ref;
37625         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
37626         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
37627         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
37628         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
37629         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
37630         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);
37631         int64_t ret_ref = 0;
37632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37634         return ret_ref;
37635 }
37636
37637 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
37638         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
37639         int64_t ret_ref = 0;
37640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37642         return ret_ref;
37643 }
37644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37645         LDKTxCreationKeys arg_conv;
37646         arg_conv.inner = untag_ptr(arg);
37647         arg_conv.is_owned = ptr_is_owned(arg);
37648         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37649         arg_conv.is_owned = false;
37650         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
37651         return ret_conv;
37652 }
37653
37654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37655         LDKTxCreationKeys orig_conv;
37656         orig_conv.inner = untag_ptr(orig);
37657         orig_conv.is_owned = ptr_is_owned(orig);
37658         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37659         orig_conv.is_owned = false;
37660         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
37661         int64_t ret_ref = 0;
37662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37664         return ret_ref;
37665 }
37666
37667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37668         LDKTxCreationKeys obj_conv;
37669         obj_conv.inner = untag_ptr(obj);
37670         obj_conv.is_owned = ptr_is_owned(obj);
37671         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37672         obj_conv.is_owned = false;
37673         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
37674         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37675         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37676         CVec_u8Z_free(ret_var);
37677         return ret_arr;
37678 }
37679
37680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37681         LDKu8slice ser_ref;
37682         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37683         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37684         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37685         *ret_conv = TxCreationKeys_read(ser_ref);
37686         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37687         return tag_ptr(ret_conv, true);
37688 }
37689
37690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37691         LDKChannelPublicKeys this_obj_conv;
37692         this_obj_conv.inner = untag_ptr(this_obj);
37693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37695         ChannelPublicKeys_free(this_obj_conv);
37696 }
37697
37698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37699         LDKChannelPublicKeys this_ptr_conv;
37700         this_ptr_conv.inner = untag_ptr(this_ptr);
37701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37703         this_ptr_conv.is_owned = false;
37704         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37705         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
37706         return ret_arr;
37707 }
37708
37709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37710         LDKChannelPublicKeys this_ptr_conv;
37711         this_ptr_conv.inner = untag_ptr(this_ptr);
37712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37714         this_ptr_conv.is_owned = false;
37715         LDKPublicKey val_ref;
37716         CHECK((*env)->GetArrayLength(env, val) == 33);
37717         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37718         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37719 }
37720
37721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37722         LDKChannelPublicKeys this_ptr_conv;
37723         this_ptr_conv.inner = untag_ptr(this_ptr);
37724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37726         this_ptr_conv.is_owned = false;
37727         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37728         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
37729         return ret_arr;
37730 }
37731
37732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37733         LDKChannelPublicKeys this_ptr_conv;
37734         this_ptr_conv.inner = untag_ptr(this_ptr);
37735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37737         this_ptr_conv.is_owned = false;
37738         LDKPublicKey val_ref;
37739         CHECK((*env)->GetArrayLength(env, val) == 33);
37740         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37741         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37742 }
37743
37744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37745         LDKChannelPublicKeys this_ptr_conv;
37746         this_ptr_conv.inner = untag_ptr(this_ptr);
37747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37749         this_ptr_conv.is_owned = false;
37750         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37751         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
37752         return ret_arr;
37753 }
37754
37755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37756         LDKChannelPublicKeys this_ptr_conv;
37757         this_ptr_conv.inner = untag_ptr(this_ptr);
37758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37760         this_ptr_conv.is_owned = false;
37761         LDKPublicKey val_ref;
37762         CHECK((*env)->GetArrayLength(env, val) == 33);
37763         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37764         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37765 }
37766
37767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37768         LDKChannelPublicKeys this_ptr_conv;
37769         this_ptr_conv.inner = untag_ptr(this_ptr);
37770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37772         this_ptr_conv.is_owned = false;
37773         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37774         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
37775         return ret_arr;
37776 }
37777
37778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37779         LDKChannelPublicKeys this_ptr_conv;
37780         this_ptr_conv.inner = untag_ptr(this_ptr);
37781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37783         this_ptr_conv.is_owned = false;
37784         LDKPublicKey val_ref;
37785         CHECK((*env)->GetArrayLength(env, val) == 33);
37786         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37787         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37788 }
37789
37790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37791         LDKChannelPublicKeys this_ptr_conv;
37792         this_ptr_conv.inner = untag_ptr(this_ptr);
37793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37795         this_ptr_conv.is_owned = false;
37796         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37797         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
37798         return ret_arr;
37799 }
37800
37801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37802         LDKChannelPublicKeys this_ptr_conv;
37803         this_ptr_conv.inner = untag_ptr(this_ptr);
37804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37806         this_ptr_conv.is_owned = false;
37807         LDKPublicKey val_ref;
37808         CHECK((*env)->GetArrayLength(env, val) == 33);
37809         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37810         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
37811 }
37812
37813 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) {
37814         LDKPublicKey funding_pubkey_arg_ref;
37815         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
37816         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
37817         LDKPublicKey revocation_basepoint_arg_ref;
37818         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
37819         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
37820         LDKPublicKey payment_point_arg_ref;
37821         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
37822         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
37823         LDKPublicKey delayed_payment_basepoint_arg_ref;
37824         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
37825         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
37826         LDKPublicKey htlc_basepoint_arg_ref;
37827         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
37828         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
37829         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);
37830         int64_t ret_ref = 0;
37831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37833         return ret_ref;
37834 }
37835
37836 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
37837         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
37838         int64_t ret_ref = 0;
37839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37841         return ret_ref;
37842 }
37843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37844         LDKChannelPublicKeys arg_conv;
37845         arg_conv.inner = untag_ptr(arg);
37846         arg_conv.is_owned = ptr_is_owned(arg);
37847         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37848         arg_conv.is_owned = false;
37849         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
37850         return ret_conv;
37851 }
37852
37853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37854         LDKChannelPublicKeys orig_conv;
37855         orig_conv.inner = untag_ptr(orig);
37856         orig_conv.is_owned = ptr_is_owned(orig);
37857         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37858         orig_conv.is_owned = false;
37859         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
37860         int64_t ret_ref = 0;
37861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37863         return ret_ref;
37864 }
37865
37866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37867         LDKChannelPublicKeys obj_conv;
37868         obj_conv.inner = untag_ptr(obj);
37869         obj_conv.is_owned = ptr_is_owned(obj);
37870         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37871         obj_conv.is_owned = false;
37872         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
37873         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37874         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37875         CVec_u8Z_free(ret_var);
37876         return ret_arr;
37877 }
37878
37879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37880         LDKu8slice ser_ref;
37881         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37882         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37883         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37884         *ret_conv = ChannelPublicKeys_read(ser_ref);
37885         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37886         return tag_ptr(ret_conv, true);
37887 }
37888
37889 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) {
37890         LDKPublicKey per_commitment_point_ref;
37891         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37892         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37893         LDKPublicKey broadcaster_delayed_payment_base_ref;
37894         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
37895         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
37896         LDKPublicKey broadcaster_htlc_base_ref;
37897         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
37898         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
37899         LDKPublicKey countersignatory_revocation_base_ref;
37900         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
37901         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
37902         LDKPublicKey countersignatory_htlc_base_ref;
37903         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
37904         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
37905         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37906         *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);
37907         return tag_ptr(ret_conv, true);
37908 }
37909
37910 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) {
37911         LDKPublicKey per_commitment_point_ref;
37912         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37913         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37914         LDKChannelPublicKeys broadcaster_keys_conv;
37915         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
37916         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
37917         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37918         broadcaster_keys_conv.is_owned = false;
37919         LDKChannelPublicKeys countersignatory_keys_conv;
37920         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
37921         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
37922         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37923         countersignatory_keys_conv.is_owned = false;
37924         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37925         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
37926         return tag_ptr(ret_conv, true);
37927 }
37928
37929 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) {
37930         LDKPublicKey revocation_key_ref;
37931         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37932         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37933         LDKPublicKey broadcaster_delayed_payment_key_ref;
37934         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37935         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37936         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
37937         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37938         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37939         CVec_u8Z_free(ret_var);
37940         return ret_arr;
37941 }
37942
37943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37944         LDKHTLCOutputInCommitment this_obj_conv;
37945         this_obj_conv.inner = untag_ptr(this_obj);
37946         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37948         HTLCOutputInCommitment_free(this_obj_conv);
37949 }
37950
37951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
37952         LDKHTLCOutputInCommitment this_ptr_conv;
37953         this_ptr_conv.inner = untag_ptr(this_ptr);
37954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37956         this_ptr_conv.is_owned = false;
37957         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
37958         return ret_conv;
37959 }
37960
37961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37962         LDKHTLCOutputInCommitment this_ptr_conv;
37963         this_ptr_conv.inner = untag_ptr(this_ptr);
37964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37966         this_ptr_conv.is_owned = false;
37967         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
37968 }
37969
37970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37971         LDKHTLCOutputInCommitment this_ptr_conv;
37972         this_ptr_conv.inner = untag_ptr(this_ptr);
37973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37975         this_ptr_conv.is_owned = false;
37976         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
37977         return ret_conv;
37978 }
37979
37980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37981         LDKHTLCOutputInCommitment this_ptr_conv;
37982         this_ptr_conv.inner = untag_ptr(this_ptr);
37983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37985         this_ptr_conv.is_owned = false;
37986         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
37987 }
37988
37989 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
37990         LDKHTLCOutputInCommitment this_ptr_conv;
37991         this_ptr_conv.inner = untag_ptr(this_ptr);
37992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37994         this_ptr_conv.is_owned = false;
37995         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
37996         return ret_conv;
37997 }
37998
37999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38000         LDKHTLCOutputInCommitment this_ptr_conv;
38001         this_ptr_conv.inner = untag_ptr(this_ptr);
38002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38004         this_ptr_conv.is_owned = false;
38005         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
38006 }
38007
38008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
38009         LDKHTLCOutputInCommitment this_ptr_conv;
38010         this_ptr_conv.inner = untag_ptr(this_ptr);
38011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38013         this_ptr_conv.is_owned = false;
38014         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38015         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
38016         return ret_arr;
38017 }
38018
38019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38020         LDKHTLCOutputInCommitment this_ptr_conv;
38021         this_ptr_conv.inner = untag_ptr(this_ptr);
38022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38024         this_ptr_conv.is_owned = false;
38025         LDKThirtyTwoBytes val_ref;
38026         CHECK((*env)->GetArrayLength(env, val) == 32);
38027         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38028         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
38029 }
38030
38031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
38032         LDKHTLCOutputInCommitment this_ptr_conv;
38033         this_ptr_conv.inner = untag_ptr(this_ptr);
38034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38036         this_ptr_conv.is_owned = false;
38037         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38038         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
38039         int64_t ret_ref = tag_ptr(ret_copy, true);
38040         return ret_ref;
38041 }
38042
38043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38044         LDKHTLCOutputInCommitment 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         void* val_ptr = untag_ptr(val);
38050         CHECK_ACCESS(val_ptr);
38051         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38052         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38053         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
38054 }
38055
38056 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) {
38057         LDKThirtyTwoBytes payment_hash_arg_ref;
38058         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
38059         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
38060         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
38061         CHECK_ACCESS(transaction_output_index_arg_ptr);
38062         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
38063         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
38064         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
38065         int64_t ret_ref = 0;
38066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38068         return ret_ref;
38069 }
38070
38071 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
38072         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
38073         int64_t ret_ref = 0;
38074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38076         return ret_ref;
38077 }
38078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38079         LDKHTLCOutputInCommitment arg_conv;
38080         arg_conv.inner = untag_ptr(arg);
38081         arg_conv.is_owned = ptr_is_owned(arg);
38082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38083         arg_conv.is_owned = false;
38084         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
38085         return ret_conv;
38086 }
38087
38088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38089         LDKHTLCOutputInCommitment orig_conv;
38090         orig_conv.inner = untag_ptr(orig);
38091         orig_conv.is_owned = ptr_is_owned(orig);
38092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38093         orig_conv.is_owned = false;
38094         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
38095         int64_t ret_ref = 0;
38096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38098         return ret_ref;
38099 }
38100
38101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
38102         LDKHTLCOutputInCommitment obj_conv;
38103         obj_conv.inner = untag_ptr(obj);
38104         obj_conv.is_owned = ptr_is_owned(obj);
38105         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38106         obj_conv.is_owned = false;
38107         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
38108         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38109         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38110         CVec_u8Z_free(ret_var);
38111         return ret_arr;
38112 }
38113
38114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38115         LDKu8slice ser_ref;
38116         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38117         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38118         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
38119         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
38120         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38121         return tag_ptr(ret_conv, true);
38122 }
38123
38124 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) {
38125         LDKHTLCOutputInCommitment htlc_conv;
38126         htlc_conv.inner = untag_ptr(htlc);
38127         htlc_conv.is_owned = ptr_is_owned(htlc);
38128         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38129         htlc_conv.is_owned = false;
38130         LDKTxCreationKeys keys_conv;
38131         keys_conv.inner = untag_ptr(keys);
38132         keys_conv.is_owned = ptr_is_owned(keys);
38133         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
38134         keys_conv.is_owned = false;
38135         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
38136         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38137         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38138         CVec_u8Z_free(ret_var);
38139         return ret_arr;
38140 }
38141
38142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
38143         LDKPublicKey broadcaster_ref;
38144         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
38145         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
38146         LDKPublicKey countersignatory_ref;
38147         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
38148         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
38149         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
38150         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38151         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38152         CVec_u8Z_free(ret_var);
38153         return ret_arr;
38154 }
38155
38156 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) {
38157         unsigned char commitment_txid_arr[32];
38158         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
38159         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
38160         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
38161         LDKHTLCOutputInCommitment htlc_conv;
38162         htlc_conv.inner = untag_ptr(htlc);
38163         htlc_conv.is_owned = ptr_is_owned(htlc);
38164         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
38165         htlc_conv.is_owned = false;
38166         LDKPublicKey broadcaster_delayed_payment_key_ref;
38167         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
38168         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
38169         LDKPublicKey revocation_key_ref;
38170         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
38171         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
38172         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);
38173         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38174         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38175         Transaction_free(ret_var);
38176         return ret_arr;
38177 }
38178
38179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
38180         LDKPublicKey funding_pubkey_ref;
38181         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
38182         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
38183         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38184         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38185         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38186         CVec_u8Z_free(ret_var);
38187         return ret_arr;
38188 }
38189
38190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38191         LDKChannelTransactionParameters 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         ChannelTransactionParameters_free(this_obj_conv);
38196 }
38197
38198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38199         LDKChannelTransactionParameters 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 = ChannelTransactionParameters_get_holder_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_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38212         LDKChannelTransactionParameters 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         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38223 }
38224
38225 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38226         LDKChannelTransactionParameters 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 = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38232         return ret_conv;
38233 }
38234
38235 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) {
38236         LDKChannelTransactionParameters 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         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38242 }
38243
38244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
38245         LDKChannelTransactionParameters this_ptr_conv;
38246         this_ptr_conv.inner = untag_ptr(this_ptr);
38247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38249         this_ptr_conv.is_owned = false;
38250         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38251         return ret_conv;
38252 }
38253
38254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
38255         LDKChannelTransactionParameters this_ptr_conv;
38256         this_ptr_conv.inner = untag_ptr(this_ptr);
38257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38259         this_ptr_conv.is_owned = false;
38260         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38261 }
38262
38263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
38264         LDKChannelTransactionParameters this_ptr_conv;
38265         this_ptr_conv.inner = untag_ptr(this_ptr);
38266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38268         this_ptr_conv.is_owned = false;
38269         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38270         int64_t ret_ref = 0;
38271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38273         return ret_ref;
38274 }
38275
38276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38277         LDKChannelTransactionParameters this_ptr_conv;
38278         this_ptr_conv.inner = untag_ptr(this_ptr);
38279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38281         this_ptr_conv.is_owned = false;
38282         LDKCounterpartyChannelTransactionParameters val_conv;
38283         val_conv.inner = untag_ptr(val);
38284         val_conv.is_owned = ptr_is_owned(val);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38286         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38287         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38288 }
38289
38290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
38291         LDKChannelTransactionParameters this_ptr_conv;
38292         this_ptr_conv.inner = untag_ptr(this_ptr);
38293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38295         this_ptr_conv.is_owned = false;
38296         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38297         int64_t ret_ref = 0;
38298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38300         return ret_ref;
38301 }
38302
38303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38304         LDKChannelTransactionParameters this_ptr_conv;
38305         this_ptr_conv.inner = untag_ptr(this_ptr);
38306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38308         this_ptr_conv.is_owned = false;
38309         LDKOutPoint val_conv;
38310         val_conv.inner = untag_ptr(val);
38311         val_conv.is_owned = ptr_is_owned(val);
38312         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38313         val_conv = OutPoint_clone(&val_conv);
38314         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38315 }
38316
38317 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
38318         LDKChannelTransactionParameters this_ptr_conv;
38319         this_ptr_conv.inner = untag_ptr(this_ptr);
38320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38322         this_ptr_conv.is_owned = false;
38323         jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38324         return ret_conv;
38325 }
38326
38327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
38328         LDKChannelTransactionParameters this_ptr_conv;
38329         this_ptr_conv.inner = untag_ptr(this_ptr);
38330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38332         this_ptr_conv.is_owned = false;
38333         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
38334         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38335 }
38336
38337 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) {
38338         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38339         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38340         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38341         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38342         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38343         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38344         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38345         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38346         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38347         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38348         LDKOutPoint funding_outpoint_arg_conv;
38349         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38350         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38351         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38352         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38353         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
38354         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);
38355         int64_t ret_ref = 0;
38356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38358         return ret_ref;
38359 }
38360
38361 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38362         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38363         int64_t ret_ref = 0;
38364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38366         return ret_ref;
38367 }
38368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38369         LDKChannelTransactionParameters arg_conv;
38370         arg_conv.inner = untag_ptr(arg);
38371         arg_conv.is_owned = ptr_is_owned(arg);
38372         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38373         arg_conv.is_owned = false;
38374         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38375         return ret_conv;
38376 }
38377
38378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38379         LDKChannelTransactionParameters orig_conv;
38380         orig_conv.inner = untag_ptr(orig);
38381         orig_conv.is_owned = ptr_is_owned(orig);
38382         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38383         orig_conv.is_owned = false;
38384         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38385         int64_t ret_ref = 0;
38386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38388         return ret_ref;
38389 }
38390
38391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38392         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38393         this_obj_conv.inner = untag_ptr(this_obj);
38394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38396         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38397 }
38398
38399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
38400         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38401         this_ptr_conv.inner = untag_ptr(this_ptr);
38402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38404         this_ptr_conv.is_owned = false;
38405         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38406         int64_t ret_ref = 0;
38407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38409         return ret_ref;
38410 }
38411
38412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38413         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38414         this_ptr_conv.inner = untag_ptr(this_ptr);
38415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38417         this_ptr_conv.is_owned = false;
38418         LDKChannelPublicKeys val_conv;
38419         val_conv.inner = untag_ptr(val);
38420         val_conv.is_owned = ptr_is_owned(val);
38421         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38422         val_conv = ChannelPublicKeys_clone(&val_conv);
38423         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
38424 }
38425
38426 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
38427         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38428         this_ptr_conv.inner = untag_ptr(this_ptr);
38429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38431         this_ptr_conv.is_owned = false;
38432         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
38433         return ret_conv;
38434 }
38435
38436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
38437         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38438         this_ptr_conv.inner = untag_ptr(this_ptr);
38439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38441         this_ptr_conv.is_owned = false;
38442         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
38443 }
38444
38445 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) {
38446         LDKChannelPublicKeys pubkeys_arg_conv;
38447         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
38448         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
38449         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
38450         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
38451         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
38452         int64_t ret_ref = 0;
38453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38455         return ret_ref;
38456 }
38457
38458 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
38459         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
38460         int64_t ret_ref = 0;
38461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38463         return ret_ref;
38464 }
38465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38466         LDKCounterpartyChannelTransactionParameters arg_conv;
38467         arg_conv.inner = untag_ptr(arg);
38468         arg_conv.is_owned = ptr_is_owned(arg);
38469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38470         arg_conv.is_owned = false;
38471         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
38472         return ret_conv;
38473 }
38474
38475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38476         LDKCounterpartyChannelTransactionParameters orig_conv;
38477         orig_conv.inner = untag_ptr(orig);
38478         orig_conv.is_owned = ptr_is_owned(orig);
38479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38480         orig_conv.is_owned = false;
38481         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
38482         int64_t ret_ref = 0;
38483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38485         return ret_ref;
38486 }
38487
38488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
38489         LDKChannelTransactionParameters this_arg_conv;
38490         this_arg_conv.inner = untag_ptr(this_arg);
38491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38493         this_arg_conv.is_owned = false;
38494         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
38495         return ret_conv;
38496 }
38497
38498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38499         LDKChannelTransactionParameters this_arg_conv;
38500         this_arg_conv.inner = untag_ptr(this_arg);
38501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38503         this_arg_conv.is_owned = false;
38504         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
38505         int64_t ret_ref = 0;
38506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38508         return ret_ref;
38509 }
38510
38511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
38512         LDKChannelTransactionParameters this_arg_conv;
38513         this_arg_conv.inner = untag_ptr(this_arg);
38514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38516         this_arg_conv.is_owned = false;
38517         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
38518         int64_t ret_ref = 0;
38519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38521         return ret_ref;
38522 }
38523
38524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38525         LDKCounterpartyChannelTransactionParameters obj_conv;
38526         obj_conv.inner = untag_ptr(obj);
38527         obj_conv.is_owned = ptr_is_owned(obj);
38528         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38529         obj_conv.is_owned = false;
38530         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
38531         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38532         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38533         CVec_u8Z_free(ret_var);
38534         return ret_arr;
38535 }
38536
38537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38538         LDKu8slice ser_ref;
38539         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38540         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38541         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
38542         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
38543         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38544         return tag_ptr(ret_conv, true);
38545 }
38546
38547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
38548         LDKChannelTransactionParameters obj_conv;
38549         obj_conv.inner = untag_ptr(obj);
38550         obj_conv.is_owned = ptr_is_owned(obj);
38551         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38552         obj_conv.is_owned = false;
38553         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
38554         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38555         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38556         CVec_u8Z_free(ret_var);
38557         return ret_arr;
38558 }
38559
38560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38561         LDKu8slice ser_ref;
38562         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38563         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38564         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
38565         *ret_conv = ChannelTransactionParameters_read(ser_ref);
38566         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38567         return tag_ptr(ret_conv, true);
38568 }
38569
38570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38571         LDKDirectedChannelTransactionParameters this_obj_conv;
38572         this_obj_conv.inner = untag_ptr(this_obj);
38573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38575         DirectedChannelTransactionParameters_free(this_obj_conv);
38576 }
38577
38578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38579         LDKDirectedChannelTransactionParameters this_arg_conv;
38580         this_arg_conv.inner = untag_ptr(this_arg);
38581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38583         this_arg_conv.is_owned = false;
38584         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
38585         int64_t ret_ref = 0;
38586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38588         return ret_ref;
38589 }
38590
38591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
38592         LDKDirectedChannelTransactionParameters this_arg_conv;
38593         this_arg_conv.inner = untag_ptr(this_arg);
38594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38596         this_arg_conv.is_owned = false;
38597         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
38598         int64_t ret_ref = 0;
38599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38601         return ret_ref;
38602 }
38603
38604 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
38605         LDKDirectedChannelTransactionParameters this_arg_conv;
38606         this_arg_conv.inner = untag_ptr(this_arg);
38607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38609         this_arg_conv.is_owned = false;
38610         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
38611         return ret_conv;
38612 }
38613
38614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
38615         LDKDirectedChannelTransactionParameters this_arg_conv;
38616         this_arg_conv.inner = untag_ptr(this_arg);
38617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38619         this_arg_conv.is_owned = false;
38620         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
38621         return ret_conv;
38622 }
38623
38624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
38625         LDKDirectedChannelTransactionParameters this_arg_conv;
38626         this_arg_conv.inner = untag_ptr(this_arg);
38627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38629         this_arg_conv.is_owned = false;
38630         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
38631         int64_t ret_ref = 0;
38632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38634         return ret_ref;
38635 }
38636
38637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38638         LDKDirectedChannelTransactionParameters this_arg_conv;
38639         this_arg_conv.inner = untag_ptr(this_arg);
38640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38642         this_arg_conv.is_owned = false;
38643         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
38644         return ret_conv;
38645 }
38646
38647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38648         LDKHolderCommitmentTransaction this_obj_conv;
38649         this_obj_conv.inner = untag_ptr(this_obj);
38650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38652         HolderCommitmentTransaction_free(this_obj_conv);
38653 }
38654
38655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
38656         LDKHolderCommitmentTransaction this_ptr_conv;
38657         this_ptr_conv.inner = untag_ptr(this_ptr);
38658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38660         this_ptr_conv.is_owned = false;
38661         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38662         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
38663         return ret_arr;
38664 }
38665
38666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38667         LDKHolderCommitmentTransaction this_ptr_conv;
38668         this_ptr_conv.inner = untag_ptr(this_ptr);
38669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38671         this_ptr_conv.is_owned = false;
38672         LDKSignature val_ref;
38673         CHECK((*env)->GetArrayLength(env, val) == 64);
38674         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38675         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38676 }
38677
38678 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
38679         LDKHolderCommitmentTransaction this_ptr_conv;
38680         this_ptr_conv.inner = untag_ptr(this_ptr);
38681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38683         this_ptr_conv.is_owned = false;
38684         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
38685         jobjectArray ret_arr = NULL;
38686         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
38687         ;
38688         for (size_t i = 0; i < ret_var.datalen; i++) {
38689                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
38690                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
38691                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
38692         }
38693         
38694         FREE(ret_var.data);
38695         return ret_arr;
38696 }
38697
38698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
38699         LDKHolderCommitmentTransaction this_ptr_conv;
38700         this_ptr_conv.inner = untag_ptr(this_ptr);
38701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38703         this_ptr_conv.is_owned = false;
38704         LDKCVec_SignatureZ val_constr;
38705         val_constr.datalen = (*env)->GetArrayLength(env, val);
38706         if (val_constr.datalen > 0)
38707                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38708         else
38709                 val_constr.data = NULL;
38710         for (size_t i = 0; i < val_constr.datalen; i++) {
38711                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
38712                 LDKSignature val_conv_8_ref;
38713                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
38714                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
38715                 val_constr.data[i] = val_conv_8_ref;
38716         }
38717         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38718 }
38719
38720 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38721         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38722         int64_t ret_ref = 0;
38723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38725         return ret_ref;
38726 }
38727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38728         LDKHolderCommitmentTransaction arg_conv;
38729         arg_conv.inner = untag_ptr(arg);
38730         arg_conv.is_owned = ptr_is_owned(arg);
38731         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38732         arg_conv.is_owned = false;
38733         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38734         return ret_conv;
38735 }
38736
38737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38738         LDKHolderCommitmentTransaction orig_conv;
38739         orig_conv.inner = untag_ptr(orig);
38740         orig_conv.is_owned = ptr_is_owned(orig);
38741         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38742         orig_conv.is_owned = false;
38743         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38744         int64_t ret_ref = 0;
38745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38747         return ret_ref;
38748 }
38749
38750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38751         LDKHolderCommitmentTransaction obj_conv;
38752         obj_conv.inner = untag_ptr(obj);
38753         obj_conv.is_owned = ptr_is_owned(obj);
38754         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38755         obj_conv.is_owned = false;
38756         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
38757         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38758         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38759         CVec_u8Z_free(ret_var);
38760         return ret_arr;
38761 }
38762
38763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38764         LDKu8slice ser_ref;
38765         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38766         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38767         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
38768         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
38769         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38770         return tag_ptr(ret_conv, true);
38771 }
38772
38773 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) {
38774         LDKCommitmentTransaction commitment_tx_conv;
38775         commitment_tx_conv.inner = untag_ptr(commitment_tx);
38776         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
38778         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
38779         LDKSignature counterparty_sig_ref;
38780         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
38781         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
38782         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
38783         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
38784         if (counterparty_htlc_sigs_constr.datalen > 0)
38785                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38786         else
38787                 counterparty_htlc_sigs_constr.data = NULL;
38788         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
38789                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
38790                 LDKSignature counterparty_htlc_sigs_conv_8_ref;
38791                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
38792                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
38793                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
38794         }
38795         LDKPublicKey holder_funding_key_ref;
38796         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
38797         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
38798         LDKPublicKey counterparty_funding_key_ref;
38799         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
38800         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
38801         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
38802         int64_t ret_ref = 0;
38803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38805         return ret_ref;
38806 }
38807
38808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38809         LDKBuiltCommitmentTransaction this_obj_conv;
38810         this_obj_conv.inner = untag_ptr(this_obj);
38811         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38813         BuiltCommitmentTransaction_free(this_obj_conv);
38814 }
38815
38816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
38817         LDKBuiltCommitmentTransaction this_ptr_conv;
38818         this_ptr_conv.inner = untag_ptr(this_ptr);
38819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38821         this_ptr_conv.is_owned = false;
38822         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
38823         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38824         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38825         Transaction_free(ret_var);
38826         return ret_arr;
38827 }
38828
38829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38830         LDKBuiltCommitmentTransaction this_ptr_conv;
38831         this_ptr_conv.inner = untag_ptr(this_ptr);
38832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38834         this_ptr_conv.is_owned = false;
38835         LDKTransaction val_ref;
38836         val_ref.datalen = (*env)->GetArrayLength(env, val);
38837         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
38838         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
38839         val_ref.data_is_owned = true;
38840         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
38841 }
38842
38843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38844         LDKBuiltCommitmentTransaction this_ptr_conv;
38845         this_ptr_conv.inner = untag_ptr(this_ptr);
38846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38848         this_ptr_conv.is_owned = false;
38849         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38850         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
38851         return ret_arr;
38852 }
38853
38854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38855         LDKBuiltCommitmentTransaction this_ptr_conv;
38856         this_ptr_conv.inner = untag_ptr(this_ptr);
38857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38859         this_ptr_conv.is_owned = false;
38860         LDKThirtyTwoBytes val_ref;
38861         CHECK((*env)->GetArrayLength(env, val) == 32);
38862         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38863         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
38864 }
38865
38866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
38867         LDKTransaction transaction_arg_ref;
38868         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
38869         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
38870         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
38871         transaction_arg_ref.data_is_owned = true;
38872         LDKThirtyTwoBytes txid_arg_ref;
38873         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38874         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38875         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
38876         int64_t ret_ref = 0;
38877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38879         return ret_ref;
38880 }
38881
38882 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
38883         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
38884         int64_t ret_ref = 0;
38885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38887         return ret_ref;
38888 }
38889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38890         LDKBuiltCommitmentTransaction arg_conv;
38891         arg_conv.inner = untag_ptr(arg);
38892         arg_conv.is_owned = ptr_is_owned(arg);
38893         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38894         arg_conv.is_owned = false;
38895         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
38896         return ret_conv;
38897 }
38898
38899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38900         LDKBuiltCommitmentTransaction orig_conv;
38901         orig_conv.inner = untag_ptr(orig);
38902         orig_conv.is_owned = ptr_is_owned(orig);
38903         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38904         orig_conv.is_owned = false;
38905         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
38906         int64_t ret_ref = 0;
38907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38909         return ret_ref;
38910 }
38911
38912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38913         LDKBuiltCommitmentTransaction obj_conv;
38914         obj_conv.inner = untag_ptr(obj);
38915         obj_conv.is_owned = ptr_is_owned(obj);
38916         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38917         obj_conv.is_owned = false;
38918         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
38919         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38920         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38921         CVec_u8Z_free(ret_var);
38922         return ret_arr;
38923 }
38924
38925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38926         LDKu8slice ser_ref;
38927         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38928         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38929         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
38930         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
38931         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38932         return tag_ptr(ret_conv, true);
38933 }
38934
38935 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) {
38936         LDKBuiltCommitmentTransaction this_arg_conv;
38937         this_arg_conv.inner = untag_ptr(this_arg);
38938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38940         this_arg_conv.is_owned = false;
38941         LDKu8slice funding_redeemscript_ref;
38942         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38943         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38944         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38945         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38946         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38947         return ret_arr;
38948 }
38949
38950 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) {
38951         LDKBuiltCommitmentTransaction this_arg_conv;
38952         this_arg_conv.inner = untag_ptr(this_arg);
38953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38955         this_arg_conv.is_owned = false;
38956         unsigned char funding_key_arr[32];
38957         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38958         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38959         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38960         LDKu8slice funding_redeemscript_ref;
38961         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38962         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38963         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38964         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38965         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38966         return ret_arr;
38967 }
38968
38969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38970         LDKClosingTransaction this_obj_conv;
38971         this_obj_conv.inner = untag_ptr(this_obj);
38972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38974         ClosingTransaction_free(this_obj_conv);
38975 }
38976
38977 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
38978         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
38979         int64_t ret_ref = 0;
38980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38982         return ret_ref;
38983 }
38984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38985         LDKClosingTransaction arg_conv;
38986         arg_conv.inner = untag_ptr(arg);
38987         arg_conv.is_owned = ptr_is_owned(arg);
38988         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38989         arg_conv.is_owned = false;
38990         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
38991         return ret_conv;
38992 }
38993
38994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38995         LDKClosingTransaction orig_conv;
38996         orig_conv.inner = untag_ptr(orig);
38997         orig_conv.is_owned = ptr_is_owned(orig);
38998         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38999         orig_conv.is_owned = false;
39000         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
39001         int64_t ret_ref = 0;
39002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39004         return ret_ref;
39005 }
39006
39007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
39008         LDKClosingTransaction o_conv;
39009         o_conv.inner = untag_ptr(o);
39010         o_conv.is_owned = ptr_is_owned(o);
39011         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39012         o_conv.is_owned = false;
39013         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
39014         return ret_conv;
39015 }
39016
39017 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) {
39018         LDKCVec_u8Z to_holder_script_ref;
39019         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
39020         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
39021         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
39022         LDKCVec_u8Z to_counterparty_script_ref;
39023         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
39024         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
39025         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
39026         LDKOutPoint funding_outpoint_conv;
39027         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39028         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39029         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39030         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39031         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
39032         int64_t ret_ref = 0;
39033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39035         return ret_ref;
39036 }
39037
39038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39039         LDKClosingTransaction this_arg_conv;
39040         this_arg_conv.inner = untag_ptr(this_arg);
39041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39043         this_arg_conv.is_owned = false;
39044         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
39045         int64_t ret_ref = 0;
39046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39048         return ret_ref;
39049 }
39050
39051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
39052         LDKClosingTransaction this_arg_conv;
39053         this_arg_conv.inner = untag_ptr(this_arg);
39054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39056         this_arg_conv.is_owned = false;
39057         LDKOutPoint funding_outpoint_conv;
39058         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
39059         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
39060         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
39061         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
39062         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
39063         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
39064         return tag_ptr(ret_conv, true);
39065 }
39066
39067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39068         LDKClosingTransaction this_arg_conv;
39069         this_arg_conv.inner = untag_ptr(this_arg);
39070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39072         this_arg_conv.is_owned = false;
39073         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
39074         return ret_conv;
39075 }
39076
39077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39078         LDKClosingTransaction this_arg_conv;
39079         this_arg_conv.inner = untag_ptr(this_arg);
39080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39082         this_arg_conv.is_owned = false;
39083         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
39084         return ret_conv;
39085 }
39086
39087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39088         LDKClosingTransaction this_arg_conv;
39089         this_arg_conv.inner = untag_ptr(this_arg);
39090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39092         this_arg_conv.is_owned = false;
39093         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
39094         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39095         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39096         return ret_arr;
39097 }
39098
39099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
39100         LDKClosingTransaction this_arg_conv;
39101         this_arg_conv.inner = untag_ptr(this_arg);
39102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39104         this_arg_conv.is_owned = false;
39105         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
39106         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39107         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39108         return ret_arr;
39109 }
39110
39111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39112         LDKTrustedClosingTransaction this_obj_conv;
39113         this_obj_conv.inner = untag_ptr(this_obj);
39114         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39116         TrustedClosingTransaction_free(this_obj_conv);
39117 }
39118
39119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39120         LDKTrustedClosingTransaction this_arg_conv;
39121         this_arg_conv.inner = untag_ptr(this_arg);
39122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39124         this_arg_conv.is_owned = false;
39125         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39126         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39127         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39128         Transaction_free(ret_var);
39129         return ret_arr;
39130 }
39131
39132 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) {
39133         LDKTrustedClosingTransaction this_arg_conv;
39134         this_arg_conv.inner = untag_ptr(this_arg);
39135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39137         this_arg_conv.is_owned = false;
39138         LDKu8slice funding_redeemscript_ref;
39139         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39140         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39141         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39142         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
39143         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39144         return ret_arr;
39145 }
39146
39147 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) {
39148         LDKTrustedClosingTransaction this_arg_conv;
39149         this_arg_conv.inner = untag_ptr(this_arg);
39150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39152         this_arg_conv.is_owned = false;
39153         unsigned char funding_key_arr[32];
39154         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
39155         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
39156         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39157         LDKu8slice funding_redeemscript_ref;
39158         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
39159         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
39160         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
39161         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
39162         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
39163         return ret_arr;
39164 }
39165
39166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39167         LDKCommitmentTransaction this_obj_conv;
39168         this_obj_conv.inner = untag_ptr(this_obj);
39169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39171         CommitmentTransaction_free(this_obj_conv);
39172 }
39173
39174 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39175         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39176         int64_t ret_ref = 0;
39177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39179         return ret_ref;
39180 }
39181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39182         LDKCommitmentTransaction arg_conv;
39183         arg_conv.inner = untag_ptr(arg);
39184         arg_conv.is_owned = ptr_is_owned(arg);
39185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39186         arg_conv.is_owned = false;
39187         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39188         return ret_conv;
39189 }
39190
39191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39192         LDKCommitmentTransaction orig_conv;
39193         orig_conv.inner = untag_ptr(orig);
39194         orig_conv.is_owned = ptr_is_owned(orig);
39195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39196         orig_conv.is_owned = false;
39197         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39198         int64_t ret_ref = 0;
39199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39201         return ret_ref;
39202 }
39203
39204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
39205         LDKCommitmentTransaction obj_conv;
39206         obj_conv.inner = untag_ptr(obj);
39207         obj_conv.is_owned = ptr_is_owned(obj);
39208         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39209         obj_conv.is_owned = false;
39210         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39211         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39212         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39213         CVec_u8Z_free(ret_var);
39214         return ret_arr;
39215 }
39216
39217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39218         LDKu8slice ser_ref;
39219         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39220         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39221         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39222         *ret_conv = CommitmentTransaction_read(ser_ref);
39223         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39224         return tag_ptr(ret_conv, true);
39225 }
39226
39227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
39228         LDKCommitmentTransaction this_arg_conv;
39229         this_arg_conv.inner = untag_ptr(this_arg);
39230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39232         this_arg_conv.is_owned = false;
39233         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39234         return ret_conv;
39235 }
39236
39237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39238         LDKCommitmentTransaction this_arg_conv;
39239         this_arg_conv.inner = untag_ptr(this_arg);
39240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39242         this_arg_conv.is_owned = false;
39243         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39244         return ret_conv;
39245 }
39246
39247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
39248         LDKCommitmentTransaction this_arg_conv;
39249         this_arg_conv.inner = untag_ptr(this_arg);
39250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39252         this_arg_conv.is_owned = false;
39253         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39254         return ret_conv;
39255 }
39256
39257 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
39258         LDKCommitmentTransaction this_arg_conv;
39259         this_arg_conv.inner = untag_ptr(this_arg);
39260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39262         this_arg_conv.is_owned = false;
39263         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39264         return ret_conv;
39265 }
39266
39267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
39268         LDKCommitmentTransaction this_arg_conv;
39269         this_arg_conv.inner = untag_ptr(this_arg);
39270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39272         this_arg_conv.is_owned = false;
39273         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39274         int64_t ret_ref = 0;
39275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39277         return ret_ref;
39278 }
39279
39280 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) {
39281         LDKCommitmentTransaction this_arg_conv;
39282         this_arg_conv.inner = untag_ptr(this_arg);
39283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39285         this_arg_conv.is_owned = false;
39286         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39287         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39288         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39289         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39290         channel_parameters_conv.is_owned = false;
39291         LDKChannelPublicKeys broadcaster_keys_conv;
39292         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39293         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39294         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39295         broadcaster_keys_conv.is_owned = false;
39296         LDKChannelPublicKeys countersignatory_keys_conv;
39297         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39298         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39299         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39300         countersignatory_keys_conv.is_owned = false;
39301         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39302         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39303         return tag_ptr(ret_conv, true);
39304 }
39305
39306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39307         LDKTrustedCommitmentTransaction this_obj_conv;
39308         this_obj_conv.inner = untag_ptr(this_obj);
39309         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39311         TrustedCommitmentTransaction_free(this_obj_conv);
39312 }
39313
39314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
39315         LDKTrustedCommitmentTransaction this_arg_conv;
39316         this_arg_conv.inner = untag_ptr(this_arg);
39317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39319         this_arg_conv.is_owned = false;
39320         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39321         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
39322         return ret_arr;
39323 }
39324
39325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
39326         LDKTrustedCommitmentTransaction this_arg_conv;
39327         this_arg_conv.inner = untag_ptr(this_arg);
39328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39330         this_arg_conv.is_owned = false;
39331         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39332         int64_t ret_ref = 0;
39333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39335         return ret_ref;
39336 }
39337
39338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
39339         LDKTrustedCommitmentTransaction this_arg_conv;
39340         this_arg_conv.inner = untag_ptr(this_arg);
39341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39343         this_arg_conv.is_owned = false;
39344         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39345         int64_t ret_ref = 0;
39346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39348         return ret_ref;
39349 }
39350
39351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
39352         LDKTrustedCommitmentTransaction this_arg_conv;
39353         this_arg_conv.inner = untag_ptr(this_arg);
39354         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39356         this_arg_conv.is_owned = false;
39357         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39358         return ret_conv;
39359 }
39360
39361 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) {
39362         LDKTrustedCommitmentTransaction this_arg_conv;
39363         this_arg_conv.inner = untag_ptr(this_arg);
39364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39366         this_arg_conv.is_owned = false;
39367         unsigned char htlc_base_key_arr[32];
39368         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
39369         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
39370         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
39371         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39372         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39373         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39374         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39375         channel_parameters_conv.is_owned = false;
39376         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
39377         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
39378         return tag_ptr(ret_conv, true);
39379 }
39380
39381 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) {
39382         LDKPublicKey broadcaster_payment_basepoint_ref;
39383         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
39384         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
39385         LDKPublicKey countersignatory_payment_basepoint_ref;
39386         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
39387         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
39388         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
39389         return ret_conv;
39390 }
39391
39392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39393         LDKInitFeatures a_conv;
39394         a_conv.inner = untag_ptr(a);
39395         a_conv.is_owned = ptr_is_owned(a);
39396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39397         a_conv.is_owned = false;
39398         LDKInitFeatures b_conv;
39399         b_conv.inner = untag_ptr(b);
39400         b_conv.is_owned = ptr_is_owned(b);
39401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39402         b_conv.is_owned = false;
39403         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
39404         return ret_conv;
39405 }
39406
39407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39408         LDKNodeFeatures a_conv;
39409         a_conv.inner = untag_ptr(a);
39410         a_conv.is_owned = ptr_is_owned(a);
39411         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39412         a_conv.is_owned = false;
39413         LDKNodeFeatures b_conv;
39414         b_conv.inner = untag_ptr(b);
39415         b_conv.is_owned = ptr_is_owned(b);
39416         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39417         b_conv.is_owned = false;
39418         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
39419         return ret_conv;
39420 }
39421
39422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39423         LDKChannelFeatures a_conv;
39424         a_conv.inner = untag_ptr(a);
39425         a_conv.is_owned = ptr_is_owned(a);
39426         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39427         a_conv.is_owned = false;
39428         LDKChannelFeatures b_conv;
39429         b_conv.inner = untag_ptr(b);
39430         b_conv.is_owned = ptr_is_owned(b);
39431         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39432         b_conv.is_owned = false;
39433         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
39434         return ret_conv;
39435 }
39436
39437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39438         LDKInvoiceFeatures a_conv;
39439         a_conv.inner = untag_ptr(a);
39440         a_conv.is_owned = ptr_is_owned(a);
39441         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39442         a_conv.is_owned = false;
39443         LDKInvoiceFeatures b_conv;
39444         b_conv.inner = untag_ptr(b);
39445         b_conv.is_owned = ptr_is_owned(b);
39446         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39447         b_conv.is_owned = false;
39448         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
39449         return ret_conv;
39450 }
39451
39452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39453         LDKChannelTypeFeatures a_conv;
39454         a_conv.inner = untag_ptr(a);
39455         a_conv.is_owned = ptr_is_owned(a);
39456         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39457         a_conv.is_owned = false;
39458         LDKChannelTypeFeatures b_conv;
39459         b_conv.inner = untag_ptr(b);
39460         b_conv.is_owned = ptr_is_owned(b);
39461         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39462         b_conv.is_owned = false;
39463         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
39464         return ret_conv;
39465 }
39466
39467 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
39468         LDKInitFeatures ret_var = InitFeatures_clone(arg);
39469         int64_t ret_ref = 0;
39470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39472         return ret_ref;
39473 }
39474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39475         LDKInitFeatures arg_conv;
39476         arg_conv.inner = untag_ptr(arg);
39477         arg_conv.is_owned = ptr_is_owned(arg);
39478         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39479         arg_conv.is_owned = false;
39480         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
39481         return ret_conv;
39482 }
39483
39484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39485         LDKInitFeatures orig_conv;
39486         orig_conv.inner = untag_ptr(orig);
39487         orig_conv.is_owned = ptr_is_owned(orig);
39488         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39489         orig_conv.is_owned = false;
39490         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
39491         int64_t ret_ref = 0;
39492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39494         return ret_ref;
39495 }
39496
39497 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
39498         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
39499         int64_t ret_ref = 0;
39500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39502         return ret_ref;
39503 }
39504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39505         LDKNodeFeatures arg_conv;
39506         arg_conv.inner = untag_ptr(arg);
39507         arg_conv.is_owned = ptr_is_owned(arg);
39508         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39509         arg_conv.is_owned = false;
39510         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
39511         return ret_conv;
39512 }
39513
39514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39515         LDKNodeFeatures orig_conv;
39516         orig_conv.inner = untag_ptr(orig);
39517         orig_conv.is_owned = ptr_is_owned(orig);
39518         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39519         orig_conv.is_owned = false;
39520         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
39521         int64_t ret_ref = 0;
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39524         return ret_ref;
39525 }
39526
39527 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
39528         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
39529         int64_t ret_ref = 0;
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39532         return ret_ref;
39533 }
39534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39535         LDKChannelFeatures arg_conv;
39536         arg_conv.inner = untag_ptr(arg);
39537         arg_conv.is_owned = ptr_is_owned(arg);
39538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39539         arg_conv.is_owned = false;
39540         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
39541         return ret_conv;
39542 }
39543
39544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39545         LDKChannelFeatures orig_conv;
39546         orig_conv.inner = untag_ptr(orig);
39547         orig_conv.is_owned = ptr_is_owned(orig);
39548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39549         orig_conv.is_owned = false;
39550         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
39551         int64_t ret_ref = 0;
39552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39554         return ret_ref;
39555 }
39556
39557 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
39558         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
39559         int64_t ret_ref = 0;
39560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39562         return ret_ref;
39563 }
39564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39565         LDKInvoiceFeatures arg_conv;
39566         arg_conv.inner = untag_ptr(arg);
39567         arg_conv.is_owned = ptr_is_owned(arg);
39568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39569         arg_conv.is_owned = false;
39570         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
39571         return ret_conv;
39572 }
39573
39574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39575         LDKInvoiceFeatures orig_conv;
39576         orig_conv.inner = untag_ptr(orig);
39577         orig_conv.is_owned = ptr_is_owned(orig);
39578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39579         orig_conv.is_owned = false;
39580         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
39581         int64_t ret_ref = 0;
39582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39584         return ret_ref;
39585 }
39586
39587 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
39588         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
39589         int64_t ret_ref = 0;
39590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39592         return ret_ref;
39593 }
39594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39595         LDKChannelTypeFeatures arg_conv;
39596         arg_conv.inner = untag_ptr(arg);
39597         arg_conv.is_owned = ptr_is_owned(arg);
39598         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39599         arg_conv.is_owned = false;
39600         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
39601         return ret_conv;
39602 }
39603
39604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39605         LDKChannelTypeFeatures orig_conv;
39606         orig_conv.inner = untag_ptr(orig);
39607         orig_conv.is_owned = ptr_is_owned(orig);
39608         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39609         orig_conv.is_owned = false;
39610         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
39611         int64_t ret_ref = 0;
39612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39614         return ret_ref;
39615 }
39616
39617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39618         LDKInitFeatures this_obj_conv;
39619         this_obj_conv.inner = untag_ptr(this_obj);
39620         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39622         InitFeatures_free(this_obj_conv);
39623 }
39624
39625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39626         LDKNodeFeatures this_obj_conv;
39627         this_obj_conv.inner = untag_ptr(this_obj);
39628         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39630         NodeFeatures_free(this_obj_conv);
39631 }
39632
39633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39634         LDKChannelFeatures this_obj_conv;
39635         this_obj_conv.inner = untag_ptr(this_obj);
39636         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39638         ChannelFeatures_free(this_obj_conv);
39639 }
39640
39641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39642         LDKInvoiceFeatures this_obj_conv;
39643         this_obj_conv.inner = untag_ptr(this_obj);
39644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39646         InvoiceFeatures_free(this_obj_conv);
39647 }
39648
39649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39650         LDKChannelTypeFeatures this_obj_conv;
39651         this_obj_conv.inner = untag_ptr(this_obj);
39652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39654         ChannelTypeFeatures_free(this_obj_conv);
39655 }
39656
39657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
39658         LDKInitFeatures ret_var = InitFeatures_empty();
39659         int64_t ret_ref = 0;
39660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39662         return ret_ref;
39663 }
39664
39665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
39666         LDKInitFeatures ret_var = InitFeatures_known();
39667         int64_t ret_ref = 0;
39668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39670         return ret_ref;
39671 }
39672
39673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39674         LDKInitFeatures this_arg_conv;
39675         this_arg_conv.inner = untag_ptr(this_arg);
39676         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39678         this_arg_conv.is_owned = false;
39679         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
39680         return ret_conv;
39681 }
39682
39683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
39684         LDKNodeFeatures ret_var = NodeFeatures_empty();
39685         int64_t ret_ref = 0;
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39688         return ret_ref;
39689 }
39690
39691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
39692         LDKNodeFeatures ret_var = NodeFeatures_known();
39693         int64_t ret_ref = 0;
39694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39696         return ret_ref;
39697 }
39698
39699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39700         LDKNodeFeatures this_arg_conv;
39701         this_arg_conv.inner = untag_ptr(this_arg);
39702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39704         this_arg_conv.is_owned = false;
39705         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
39706         return ret_conv;
39707 }
39708
39709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
39710         LDKChannelFeatures ret_var = ChannelFeatures_empty();
39711         int64_t ret_ref = 0;
39712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39714         return ret_ref;
39715 }
39716
39717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
39718         LDKChannelFeatures ret_var = ChannelFeatures_known();
39719         int64_t ret_ref = 0;
39720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39722         return ret_ref;
39723 }
39724
39725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39726         LDKChannelFeatures this_arg_conv;
39727         this_arg_conv.inner = untag_ptr(this_arg);
39728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39730         this_arg_conv.is_owned = false;
39731         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
39732         return ret_conv;
39733 }
39734
39735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
39736         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
39737         int64_t ret_ref = 0;
39738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39740         return ret_ref;
39741 }
39742
39743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
39744         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
39745         int64_t ret_ref = 0;
39746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39748         return ret_ref;
39749 }
39750
39751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39752         LDKInvoiceFeatures this_arg_conv;
39753         this_arg_conv.inner = untag_ptr(this_arg);
39754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39756         this_arg_conv.is_owned = false;
39757         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
39758         return ret_conv;
39759 }
39760
39761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
39762         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
39763         int64_t ret_ref = 0;
39764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39766         return ret_ref;
39767 }
39768
39769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
39770         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
39771         int64_t ret_ref = 0;
39772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39774         return ret_ref;
39775 }
39776
39777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39778         LDKChannelTypeFeatures 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         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
39784         return ret_conv;
39785 }
39786
39787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39788         LDKInitFeatures obj_conv;
39789         obj_conv.inner = untag_ptr(obj);
39790         obj_conv.is_owned = ptr_is_owned(obj);
39791         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39792         obj_conv.is_owned = false;
39793         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
39794         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39795         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39796         CVec_u8Z_free(ret_var);
39797         return ret_arr;
39798 }
39799
39800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39801         LDKu8slice ser_ref;
39802         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39803         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39804         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
39805         *ret_conv = InitFeatures_read(ser_ref);
39806         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39807         return tag_ptr(ret_conv, true);
39808 }
39809
39810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39811         LDKChannelFeatures obj_conv;
39812         obj_conv.inner = untag_ptr(obj);
39813         obj_conv.is_owned = ptr_is_owned(obj);
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39815         obj_conv.is_owned = false;
39816         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
39817         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39818         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39819         CVec_u8Z_free(ret_var);
39820         return ret_arr;
39821 }
39822
39823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39824         LDKu8slice ser_ref;
39825         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39826         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39827         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
39828         *ret_conv = ChannelFeatures_read(ser_ref);
39829         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39830         return tag_ptr(ret_conv, true);
39831 }
39832
39833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39834         LDKNodeFeatures obj_conv;
39835         obj_conv.inner = untag_ptr(obj);
39836         obj_conv.is_owned = ptr_is_owned(obj);
39837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39838         obj_conv.is_owned = false;
39839         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
39840         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39841         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39842         CVec_u8Z_free(ret_var);
39843         return ret_arr;
39844 }
39845
39846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39847         LDKu8slice ser_ref;
39848         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39849         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39850         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
39851         *ret_conv = NodeFeatures_read(ser_ref);
39852         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39853         return tag_ptr(ret_conv, true);
39854 }
39855
39856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39857         LDKInvoiceFeatures obj_conv;
39858         obj_conv.inner = untag_ptr(obj);
39859         obj_conv.is_owned = ptr_is_owned(obj);
39860         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39861         obj_conv.is_owned = false;
39862         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
39863         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39864         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39865         CVec_u8Z_free(ret_var);
39866         return ret_arr;
39867 }
39868
39869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39870         LDKu8slice ser_ref;
39871         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39872         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39873         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
39874         *ret_conv = InvoiceFeatures_read(ser_ref);
39875         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39876         return tag_ptr(ret_conv, true);
39877 }
39878
39879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39880         LDKChannelTypeFeatures obj_conv;
39881         obj_conv.inner = untag_ptr(obj);
39882         obj_conv.is_owned = ptr_is_owned(obj);
39883         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39884         obj_conv.is_owned = false;
39885         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
39886         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39887         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39888         CVec_u8Z_free(ret_var);
39889         return ret_arr;
39890 }
39891
39892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39893         LDKu8slice ser_ref;
39894         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39895         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39896         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
39897         *ret_conv = ChannelTypeFeatures_read(ser_ref);
39898         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39899         return tag_ptr(ret_conv, true);
39900 }
39901
39902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39903         LDKInitFeatures this_arg_conv;
39904         this_arg_conv.inner = untag_ptr(this_arg);
39905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39907         this_arg_conv.is_owned = false;
39908         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
39909 }
39910
39911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39912         LDKInitFeatures this_arg_conv;
39913         this_arg_conv.inner = untag_ptr(this_arg);
39914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39916         this_arg_conv.is_owned = false;
39917         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
39918 }
39919
39920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39921         LDKInitFeatures this_arg_conv;
39922         this_arg_conv.inner = untag_ptr(this_arg);
39923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39925         this_arg_conv.is_owned = false;
39926         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
39927         return ret_conv;
39928 }
39929
39930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39931         LDKNodeFeatures this_arg_conv;
39932         this_arg_conv.inner = untag_ptr(this_arg);
39933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39935         this_arg_conv.is_owned = false;
39936         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
39937 }
39938
39939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39940         LDKNodeFeatures this_arg_conv;
39941         this_arg_conv.inner = untag_ptr(this_arg);
39942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39944         this_arg_conv.is_owned = false;
39945         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
39946 }
39947
39948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39949         LDKNodeFeatures this_arg_conv;
39950         this_arg_conv.inner = untag_ptr(this_arg);
39951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39953         this_arg_conv.is_owned = false;
39954         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
39955         return ret_conv;
39956 }
39957
39958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39959         LDKInitFeatures this_arg_conv;
39960         this_arg_conv.inner = untag_ptr(this_arg);
39961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39963         this_arg_conv.is_owned = false;
39964         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
39965         return ret_conv;
39966 }
39967
39968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
39969         LDKNodeFeatures this_arg_conv;
39970         this_arg_conv.inner = untag_ptr(this_arg);
39971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39973         this_arg_conv.is_owned = false;
39974         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
39975         return ret_conv;
39976 }
39977
39978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
39979         LDKInitFeatures this_arg_conv;
39980         this_arg_conv.inner = untag_ptr(this_arg);
39981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39983         this_arg_conv.is_owned = false;
39984         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
39985 }
39986
39987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
39988         LDKInitFeatures this_arg_conv;
39989         this_arg_conv.inner = untag_ptr(this_arg);
39990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39992         this_arg_conv.is_owned = false;
39993         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
39994 }
39995
39996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
39997         LDKInitFeatures this_arg_conv;
39998         this_arg_conv.inner = untag_ptr(this_arg);
39999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40001         this_arg_conv.is_owned = false;
40002         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40003         return ret_conv;
40004 }
40005
40006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40007         LDKInitFeatures this_arg_conv;
40008         this_arg_conv.inner = untag_ptr(this_arg);
40009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40011         this_arg_conv.is_owned = false;
40012         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40013 }
40014
40015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40016         LDKInitFeatures this_arg_conv;
40017         this_arg_conv.inner = untag_ptr(this_arg);
40018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40020         this_arg_conv.is_owned = false;
40021         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40022 }
40023
40024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40025         LDKInitFeatures this_arg_conv;
40026         this_arg_conv.inner = untag_ptr(this_arg);
40027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40029         this_arg_conv.is_owned = false;
40030         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40031         return ret_conv;
40032 }
40033
40034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40035         LDKNodeFeatures this_arg_conv;
40036         this_arg_conv.inner = untag_ptr(this_arg);
40037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40039         this_arg_conv.is_owned = false;
40040         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40041 }
40042
40043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40044         LDKNodeFeatures this_arg_conv;
40045         this_arg_conv.inner = untag_ptr(this_arg);
40046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40048         this_arg_conv.is_owned = false;
40049         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40050 }
40051
40052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40053         LDKNodeFeatures this_arg_conv;
40054         this_arg_conv.inner = untag_ptr(this_arg);
40055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40057         this_arg_conv.is_owned = false;
40058         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40059         return ret_conv;
40060 }
40061
40062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40063         LDKInitFeatures this_arg_conv;
40064         this_arg_conv.inner = untag_ptr(this_arg);
40065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40067         this_arg_conv.is_owned = false;
40068         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40069         return ret_conv;
40070 }
40071
40072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
40073         LDKNodeFeatures this_arg_conv;
40074         this_arg_conv.inner = untag_ptr(this_arg);
40075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40077         this_arg_conv.is_owned = false;
40078         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40079         return ret_conv;
40080 }
40081
40082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40083         LDKInitFeatures this_arg_conv;
40084         this_arg_conv.inner = untag_ptr(this_arg);
40085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40087         this_arg_conv.is_owned = false;
40088         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40089 }
40090
40091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40092         LDKInitFeatures this_arg_conv;
40093         this_arg_conv.inner = untag_ptr(this_arg);
40094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40096         this_arg_conv.is_owned = false;
40097         InitFeatures_set_gossip_queries_required(&this_arg_conv);
40098 }
40099
40100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40101         LDKInitFeatures this_arg_conv;
40102         this_arg_conv.inner = untag_ptr(this_arg);
40103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40105         this_arg_conv.is_owned = false;
40106         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
40107         return ret_conv;
40108 }
40109
40110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40111         LDKNodeFeatures this_arg_conv;
40112         this_arg_conv.inner = untag_ptr(this_arg);
40113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40115         this_arg_conv.is_owned = false;
40116         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
40117 }
40118
40119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40120         LDKNodeFeatures this_arg_conv;
40121         this_arg_conv.inner = untag_ptr(this_arg);
40122         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40124         this_arg_conv.is_owned = false;
40125         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
40126 }
40127
40128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40129         LDKNodeFeatures this_arg_conv;
40130         this_arg_conv.inner = untag_ptr(this_arg);
40131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40133         this_arg_conv.is_owned = false;
40134         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
40135         return ret_conv;
40136 }
40137
40138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40139         LDKInitFeatures this_arg_conv;
40140         this_arg_conv.inner = untag_ptr(this_arg);
40141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40143         this_arg_conv.is_owned = false;
40144         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
40145         return ret_conv;
40146 }
40147
40148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
40149         LDKNodeFeatures this_arg_conv;
40150         this_arg_conv.inner = untag_ptr(this_arg);
40151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40153         this_arg_conv.is_owned = false;
40154         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
40155         return ret_conv;
40156 }
40157
40158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40159         LDKInitFeatures this_arg_conv;
40160         this_arg_conv.inner = untag_ptr(this_arg);
40161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40163         this_arg_conv.is_owned = false;
40164         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
40165 }
40166
40167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40168         LDKInitFeatures this_arg_conv;
40169         this_arg_conv.inner = untag_ptr(this_arg);
40170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40172         this_arg_conv.is_owned = false;
40173         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
40174 }
40175
40176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40177         LDKInitFeatures this_arg_conv;
40178         this_arg_conv.inner = untag_ptr(this_arg);
40179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40181         this_arg_conv.is_owned = false;
40182         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
40183         return ret_conv;
40184 }
40185
40186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40187         LDKNodeFeatures this_arg_conv;
40188         this_arg_conv.inner = untag_ptr(this_arg);
40189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40191         this_arg_conv.is_owned = false;
40192         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
40193 }
40194
40195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40196         LDKNodeFeatures this_arg_conv;
40197         this_arg_conv.inner = untag_ptr(this_arg);
40198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40200         this_arg_conv.is_owned = false;
40201         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
40202 }
40203
40204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40205         LDKNodeFeatures this_arg_conv;
40206         this_arg_conv.inner = untag_ptr(this_arg);
40207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40209         this_arg_conv.is_owned = false;
40210         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
40211         return ret_conv;
40212 }
40213
40214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40215         LDKInvoiceFeatures this_arg_conv;
40216         this_arg_conv.inner = untag_ptr(this_arg);
40217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40219         this_arg_conv.is_owned = false;
40220         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
40221 }
40222
40223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40224         LDKInvoiceFeatures this_arg_conv;
40225         this_arg_conv.inner = untag_ptr(this_arg);
40226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40228         this_arg_conv.is_owned = false;
40229         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
40230 }
40231
40232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40233         LDKInvoiceFeatures this_arg_conv;
40234         this_arg_conv.inner = untag_ptr(this_arg);
40235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40237         this_arg_conv.is_owned = false;
40238         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
40239         return ret_conv;
40240 }
40241
40242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40243         LDKInitFeatures this_arg_conv;
40244         this_arg_conv.inner = untag_ptr(this_arg);
40245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40247         this_arg_conv.is_owned = false;
40248         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
40249         return ret_conv;
40250 }
40251
40252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40253         LDKNodeFeatures this_arg_conv;
40254         this_arg_conv.inner = untag_ptr(this_arg);
40255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40257         this_arg_conv.is_owned = false;
40258         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
40259         return ret_conv;
40260 }
40261
40262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
40263         LDKInvoiceFeatures this_arg_conv;
40264         this_arg_conv.inner = untag_ptr(this_arg);
40265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40267         this_arg_conv.is_owned = false;
40268         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
40269         return ret_conv;
40270 }
40271
40272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40273         LDKInitFeatures this_arg_conv;
40274         this_arg_conv.inner = untag_ptr(this_arg);
40275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40277         this_arg_conv.is_owned = false;
40278         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
40279 }
40280
40281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40282         LDKInitFeatures this_arg_conv;
40283         this_arg_conv.inner = untag_ptr(this_arg);
40284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40286         this_arg_conv.is_owned = false;
40287         InitFeatures_set_static_remote_key_required(&this_arg_conv);
40288 }
40289
40290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40291         LDKInitFeatures this_arg_conv;
40292         this_arg_conv.inner = untag_ptr(this_arg);
40293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40295         this_arg_conv.is_owned = false;
40296         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
40297         return ret_conv;
40298 }
40299
40300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40301         LDKNodeFeatures this_arg_conv;
40302         this_arg_conv.inner = untag_ptr(this_arg);
40303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40305         this_arg_conv.is_owned = false;
40306         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
40307 }
40308
40309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40310         LDKNodeFeatures this_arg_conv;
40311         this_arg_conv.inner = untag_ptr(this_arg);
40312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40314         this_arg_conv.is_owned = false;
40315         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
40316 }
40317
40318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40319         LDKNodeFeatures this_arg_conv;
40320         this_arg_conv.inner = untag_ptr(this_arg);
40321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40323         this_arg_conv.is_owned = false;
40324         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
40325         return ret_conv;
40326 }
40327
40328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40329         LDKChannelTypeFeatures this_arg_conv;
40330         this_arg_conv.inner = untag_ptr(this_arg);
40331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40333         this_arg_conv.is_owned = false;
40334         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
40335 }
40336
40337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40338         LDKChannelTypeFeatures this_arg_conv;
40339         this_arg_conv.inner = untag_ptr(this_arg);
40340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40342         this_arg_conv.is_owned = false;
40343         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
40344 }
40345
40346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40347         LDKChannelTypeFeatures this_arg_conv;
40348         this_arg_conv.inner = untag_ptr(this_arg);
40349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40351         this_arg_conv.is_owned = false;
40352         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
40353         return ret_conv;
40354 }
40355
40356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40357         LDKInitFeatures this_arg_conv;
40358         this_arg_conv.inner = untag_ptr(this_arg);
40359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40361         this_arg_conv.is_owned = false;
40362         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
40363         return ret_conv;
40364 }
40365
40366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40367         LDKNodeFeatures this_arg_conv;
40368         this_arg_conv.inner = untag_ptr(this_arg);
40369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40371         this_arg_conv.is_owned = false;
40372         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
40373         return ret_conv;
40374 }
40375
40376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
40377         LDKChannelTypeFeatures this_arg_conv;
40378         this_arg_conv.inner = untag_ptr(this_arg);
40379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40381         this_arg_conv.is_owned = false;
40382         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
40383         return ret_conv;
40384 }
40385
40386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40387         LDKInitFeatures this_arg_conv;
40388         this_arg_conv.inner = untag_ptr(this_arg);
40389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40391         this_arg_conv.is_owned = false;
40392         InitFeatures_set_payment_secret_optional(&this_arg_conv);
40393 }
40394
40395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40396         LDKInitFeatures this_arg_conv;
40397         this_arg_conv.inner = untag_ptr(this_arg);
40398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40400         this_arg_conv.is_owned = false;
40401         InitFeatures_set_payment_secret_required(&this_arg_conv);
40402 }
40403
40404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40405         LDKInitFeatures this_arg_conv;
40406         this_arg_conv.inner = untag_ptr(this_arg);
40407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40409         this_arg_conv.is_owned = false;
40410         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
40411         return ret_conv;
40412 }
40413
40414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40415         LDKNodeFeatures this_arg_conv;
40416         this_arg_conv.inner = untag_ptr(this_arg);
40417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40419         this_arg_conv.is_owned = false;
40420         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
40421 }
40422
40423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40424         LDKNodeFeatures this_arg_conv;
40425         this_arg_conv.inner = untag_ptr(this_arg);
40426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40428         this_arg_conv.is_owned = false;
40429         NodeFeatures_set_payment_secret_required(&this_arg_conv);
40430 }
40431
40432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40433         LDKNodeFeatures this_arg_conv;
40434         this_arg_conv.inner = untag_ptr(this_arg);
40435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40437         this_arg_conv.is_owned = false;
40438         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
40439         return ret_conv;
40440 }
40441
40442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40443         LDKInvoiceFeatures this_arg_conv;
40444         this_arg_conv.inner = untag_ptr(this_arg);
40445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40447         this_arg_conv.is_owned = false;
40448         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
40449 }
40450
40451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40452         LDKInvoiceFeatures this_arg_conv;
40453         this_arg_conv.inner = untag_ptr(this_arg);
40454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40456         this_arg_conv.is_owned = false;
40457         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
40458 }
40459
40460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40461         LDKInvoiceFeatures this_arg_conv;
40462         this_arg_conv.inner = untag_ptr(this_arg);
40463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40465         this_arg_conv.is_owned = false;
40466         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
40467         return ret_conv;
40468 }
40469
40470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40471         LDKInitFeatures this_arg_conv;
40472         this_arg_conv.inner = untag_ptr(this_arg);
40473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40475         this_arg_conv.is_owned = false;
40476         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
40477         return ret_conv;
40478 }
40479
40480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40481         LDKNodeFeatures this_arg_conv;
40482         this_arg_conv.inner = untag_ptr(this_arg);
40483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40485         this_arg_conv.is_owned = false;
40486         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
40487         return ret_conv;
40488 }
40489
40490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
40491         LDKInvoiceFeatures this_arg_conv;
40492         this_arg_conv.inner = untag_ptr(this_arg);
40493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40495         this_arg_conv.is_owned = false;
40496         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
40497         return ret_conv;
40498 }
40499
40500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40501         LDKInitFeatures this_arg_conv;
40502         this_arg_conv.inner = untag_ptr(this_arg);
40503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40505         this_arg_conv.is_owned = false;
40506         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
40507 }
40508
40509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40510         LDKInitFeatures this_arg_conv;
40511         this_arg_conv.inner = untag_ptr(this_arg);
40512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40514         this_arg_conv.is_owned = false;
40515         InitFeatures_set_basic_mpp_required(&this_arg_conv);
40516 }
40517
40518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40519         LDKInitFeatures this_arg_conv;
40520         this_arg_conv.inner = untag_ptr(this_arg);
40521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40523         this_arg_conv.is_owned = false;
40524         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
40525         return ret_conv;
40526 }
40527
40528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40529         LDKNodeFeatures this_arg_conv;
40530         this_arg_conv.inner = untag_ptr(this_arg);
40531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40533         this_arg_conv.is_owned = false;
40534         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
40535 }
40536
40537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40538         LDKNodeFeatures this_arg_conv;
40539         this_arg_conv.inner = untag_ptr(this_arg);
40540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40542         this_arg_conv.is_owned = false;
40543         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
40544 }
40545
40546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40547         LDKNodeFeatures this_arg_conv;
40548         this_arg_conv.inner = untag_ptr(this_arg);
40549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40551         this_arg_conv.is_owned = false;
40552         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
40553         return ret_conv;
40554 }
40555
40556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40557         LDKInvoiceFeatures this_arg_conv;
40558         this_arg_conv.inner = untag_ptr(this_arg);
40559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40561         this_arg_conv.is_owned = false;
40562         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
40563 }
40564
40565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40566         LDKInvoiceFeatures 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         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
40572 }
40573
40574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40575         LDKInvoiceFeatures 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         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
40581         return ret_conv;
40582 }
40583
40584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40585         LDKInitFeatures this_arg_conv;
40586         this_arg_conv.inner = untag_ptr(this_arg);
40587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40589         this_arg_conv.is_owned = false;
40590         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
40591         return ret_conv;
40592 }
40593
40594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40595         LDKNodeFeatures this_arg_conv;
40596         this_arg_conv.inner = untag_ptr(this_arg);
40597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40599         this_arg_conv.is_owned = false;
40600         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
40601         return ret_conv;
40602 }
40603
40604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
40605         LDKInvoiceFeatures this_arg_conv;
40606         this_arg_conv.inner = untag_ptr(this_arg);
40607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40609         this_arg_conv.is_owned = false;
40610         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
40611         return ret_conv;
40612 }
40613
40614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40615         LDKInitFeatures this_arg_conv;
40616         this_arg_conv.inner = untag_ptr(this_arg);
40617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40619         this_arg_conv.is_owned = false;
40620         InitFeatures_set_wumbo_optional(&this_arg_conv);
40621 }
40622
40623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40624         LDKInitFeatures this_arg_conv;
40625         this_arg_conv.inner = untag_ptr(this_arg);
40626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40628         this_arg_conv.is_owned = false;
40629         InitFeatures_set_wumbo_required(&this_arg_conv);
40630 }
40631
40632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40633         LDKInitFeatures this_arg_conv;
40634         this_arg_conv.inner = untag_ptr(this_arg);
40635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40637         this_arg_conv.is_owned = false;
40638         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
40639         return ret_conv;
40640 }
40641
40642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40643         LDKNodeFeatures this_arg_conv;
40644         this_arg_conv.inner = untag_ptr(this_arg);
40645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40647         this_arg_conv.is_owned = false;
40648         NodeFeatures_set_wumbo_optional(&this_arg_conv);
40649 }
40650
40651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40652         LDKNodeFeatures this_arg_conv;
40653         this_arg_conv.inner = untag_ptr(this_arg);
40654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40656         this_arg_conv.is_owned = false;
40657         NodeFeatures_set_wumbo_required(&this_arg_conv);
40658 }
40659
40660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40661         LDKNodeFeatures this_arg_conv;
40662         this_arg_conv.inner = untag_ptr(this_arg);
40663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40665         this_arg_conv.is_owned = false;
40666         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
40667         return ret_conv;
40668 }
40669
40670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40671         LDKInitFeatures this_arg_conv;
40672         this_arg_conv.inner = untag_ptr(this_arg);
40673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40675         this_arg_conv.is_owned = false;
40676         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
40677         return ret_conv;
40678 }
40679
40680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
40681         LDKNodeFeatures this_arg_conv;
40682         this_arg_conv.inner = untag_ptr(this_arg);
40683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40685         this_arg_conv.is_owned = false;
40686         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
40687         return ret_conv;
40688 }
40689
40690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40691         LDKInitFeatures this_arg_conv;
40692         this_arg_conv.inner = untag_ptr(this_arg);
40693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40695         this_arg_conv.is_owned = false;
40696         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40697 }
40698
40699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40700         LDKInitFeatures this_arg_conv;
40701         this_arg_conv.inner = untag_ptr(this_arg);
40702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40704         this_arg_conv.is_owned = false;
40705         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40706 }
40707
40708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40709         LDKInitFeatures this_arg_conv;
40710         this_arg_conv.inner = untag_ptr(this_arg);
40711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40713         this_arg_conv.is_owned = false;
40714         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40715         return ret_conv;
40716 }
40717
40718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40719         LDKNodeFeatures this_arg_conv;
40720         this_arg_conv.inner = untag_ptr(this_arg);
40721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40723         this_arg_conv.is_owned = false;
40724         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40725 }
40726
40727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40728         LDKNodeFeatures this_arg_conv;
40729         this_arg_conv.inner = untag_ptr(this_arg);
40730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40732         this_arg_conv.is_owned = false;
40733         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40734 }
40735
40736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40737         LDKNodeFeatures this_arg_conv;
40738         this_arg_conv.inner = untag_ptr(this_arg);
40739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40741         this_arg_conv.is_owned = false;
40742         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40743         return ret_conv;
40744 }
40745
40746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40747         LDKInitFeatures this_arg_conv;
40748         this_arg_conv.inner = untag_ptr(this_arg);
40749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40751         this_arg_conv.is_owned = false;
40752         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40753         return ret_conv;
40754 }
40755
40756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
40757         LDKNodeFeatures this_arg_conv;
40758         this_arg_conv.inner = untag_ptr(this_arg);
40759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40761         this_arg_conv.is_owned = false;
40762         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40763         return ret_conv;
40764 }
40765
40766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40767         LDKInitFeatures this_arg_conv;
40768         this_arg_conv.inner = untag_ptr(this_arg);
40769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40771         this_arg_conv.is_owned = false;
40772         InitFeatures_set_channel_type_optional(&this_arg_conv);
40773 }
40774
40775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40776         LDKInitFeatures this_arg_conv;
40777         this_arg_conv.inner = untag_ptr(this_arg);
40778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40780         this_arg_conv.is_owned = false;
40781         InitFeatures_set_channel_type_required(&this_arg_conv);
40782 }
40783
40784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40785         LDKInitFeatures this_arg_conv;
40786         this_arg_conv.inner = untag_ptr(this_arg);
40787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40789         this_arg_conv.is_owned = false;
40790         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
40791         return ret_conv;
40792 }
40793
40794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40795         LDKNodeFeatures this_arg_conv;
40796         this_arg_conv.inner = untag_ptr(this_arg);
40797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40799         this_arg_conv.is_owned = false;
40800         NodeFeatures_set_channel_type_optional(&this_arg_conv);
40801 }
40802
40803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40804         LDKNodeFeatures this_arg_conv;
40805         this_arg_conv.inner = untag_ptr(this_arg);
40806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40808         this_arg_conv.is_owned = false;
40809         NodeFeatures_set_channel_type_required(&this_arg_conv);
40810 }
40811
40812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40813         LDKNodeFeatures this_arg_conv;
40814         this_arg_conv.inner = untag_ptr(this_arg);
40815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40817         this_arg_conv.is_owned = false;
40818         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
40819         return ret_conv;
40820 }
40821
40822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40823         LDKInitFeatures this_arg_conv;
40824         this_arg_conv.inner = untag_ptr(this_arg);
40825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40827         this_arg_conv.is_owned = false;
40828         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
40829         return ret_conv;
40830 }
40831
40832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
40833         LDKNodeFeatures this_arg_conv;
40834         this_arg_conv.inner = untag_ptr(this_arg);
40835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40837         this_arg_conv.is_owned = false;
40838         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
40839         return ret_conv;
40840 }
40841
40842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40843         LDKInitFeatures this_arg_conv;
40844         this_arg_conv.inner = untag_ptr(this_arg);
40845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40847         this_arg_conv.is_owned = false;
40848         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
40849 }
40850
40851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40852         LDKInitFeatures this_arg_conv;
40853         this_arg_conv.inner = untag_ptr(this_arg);
40854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40856         this_arg_conv.is_owned = false;
40857         InitFeatures_set_scid_privacy_required(&this_arg_conv);
40858 }
40859
40860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40861         LDKInitFeatures this_arg_conv;
40862         this_arg_conv.inner = untag_ptr(this_arg);
40863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40865         this_arg_conv.is_owned = false;
40866         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
40867         return ret_conv;
40868 }
40869
40870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40871         LDKNodeFeatures this_arg_conv;
40872         this_arg_conv.inner = untag_ptr(this_arg);
40873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40875         this_arg_conv.is_owned = false;
40876         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
40877 }
40878
40879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40880         LDKNodeFeatures this_arg_conv;
40881         this_arg_conv.inner = untag_ptr(this_arg);
40882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40884         this_arg_conv.is_owned = false;
40885         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
40886 }
40887
40888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40889         LDKNodeFeatures this_arg_conv;
40890         this_arg_conv.inner = untag_ptr(this_arg);
40891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40893         this_arg_conv.is_owned = false;
40894         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
40895         return ret_conv;
40896 }
40897
40898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40899         LDKChannelTypeFeatures this_arg_conv;
40900         this_arg_conv.inner = untag_ptr(this_arg);
40901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40903         this_arg_conv.is_owned = false;
40904         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
40905 }
40906
40907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40908         LDKChannelTypeFeatures this_arg_conv;
40909         this_arg_conv.inner = untag_ptr(this_arg);
40910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40912         this_arg_conv.is_owned = false;
40913         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
40914 }
40915
40916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40917         LDKChannelTypeFeatures this_arg_conv;
40918         this_arg_conv.inner = untag_ptr(this_arg);
40919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40921         this_arg_conv.is_owned = false;
40922         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
40923         return ret_conv;
40924 }
40925
40926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40927         LDKInitFeatures this_arg_conv;
40928         this_arg_conv.inner = untag_ptr(this_arg);
40929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40931         this_arg_conv.is_owned = false;
40932         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
40933         return ret_conv;
40934 }
40935
40936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40937         LDKNodeFeatures this_arg_conv;
40938         this_arg_conv.inner = untag_ptr(this_arg);
40939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40941         this_arg_conv.is_owned = false;
40942         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
40943         return ret_conv;
40944 }
40945
40946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
40947         LDKChannelTypeFeatures this_arg_conv;
40948         this_arg_conv.inner = untag_ptr(this_arg);
40949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40951         this_arg_conv.is_owned = false;
40952         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
40953         return ret_conv;
40954 }
40955
40956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40957         LDKInitFeatures this_arg_conv;
40958         this_arg_conv.inner = untag_ptr(this_arg);
40959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40961         this_arg_conv.is_owned = false;
40962         InitFeatures_set_zero_conf_optional(&this_arg_conv);
40963 }
40964
40965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40966         LDKInitFeatures this_arg_conv;
40967         this_arg_conv.inner = untag_ptr(this_arg);
40968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40970         this_arg_conv.is_owned = false;
40971         InitFeatures_set_zero_conf_required(&this_arg_conv);
40972 }
40973
40974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
40975         LDKInitFeatures this_arg_conv;
40976         this_arg_conv.inner = untag_ptr(this_arg);
40977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40979         this_arg_conv.is_owned = false;
40980         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
40981         return ret_conv;
40982 }
40983
40984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
40985         LDKNodeFeatures this_arg_conv;
40986         this_arg_conv.inner = untag_ptr(this_arg);
40987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40989         this_arg_conv.is_owned = false;
40990         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
40991 }
40992
40993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
40994         LDKNodeFeatures this_arg_conv;
40995         this_arg_conv.inner = untag_ptr(this_arg);
40996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40998         this_arg_conv.is_owned = false;
40999         NodeFeatures_set_zero_conf_required(&this_arg_conv);
41000 }
41001
41002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41003         LDKNodeFeatures this_arg_conv;
41004         this_arg_conv.inner = untag_ptr(this_arg);
41005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41007         this_arg_conv.is_owned = false;
41008         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
41009         return ret_conv;
41010 }
41011
41012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41013         LDKChannelTypeFeatures this_arg_conv;
41014         this_arg_conv.inner = untag_ptr(this_arg);
41015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41017         this_arg_conv.is_owned = false;
41018         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
41019 }
41020
41021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41022         LDKChannelTypeFeatures this_arg_conv;
41023         this_arg_conv.inner = untag_ptr(this_arg);
41024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41026         this_arg_conv.is_owned = false;
41027         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
41028 }
41029
41030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41031         LDKChannelTypeFeatures this_arg_conv;
41032         this_arg_conv.inner = untag_ptr(this_arg);
41033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41035         this_arg_conv.is_owned = false;
41036         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
41037         return ret_conv;
41038 }
41039
41040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41041         LDKInitFeatures this_arg_conv;
41042         this_arg_conv.inner = untag_ptr(this_arg);
41043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41045         this_arg_conv.is_owned = false;
41046         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
41047         return ret_conv;
41048 }
41049
41050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41051         LDKNodeFeatures this_arg_conv;
41052         this_arg_conv.inner = untag_ptr(this_arg);
41053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41055         this_arg_conv.is_owned = false;
41056         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
41057         return ret_conv;
41058 }
41059
41060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
41061         LDKChannelTypeFeatures this_arg_conv;
41062         this_arg_conv.inner = untag_ptr(this_arg);
41063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41065         this_arg_conv.is_owned = false;
41066         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
41067         return ret_conv;
41068 }
41069
41070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
41071         LDKNodeFeatures this_arg_conv;
41072         this_arg_conv.inner = untag_ptr(this_arg);
41073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41075         this_arg_conv.is_owned = false;
41076         NodeFeatures_set_keysend_optional(&this_arg_conv);
41077 }
41078
41079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
41080         LDKNodeFeatures this_arg_conv;
41081         this_arg_conv.inner = untag_ptr(this_arg);
41082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41084         this_arg_conv.is_owned = false;
41085         NodeFeatures_set_keysend_required(&this_arg_conv);
41086 }
41087
41088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41089         LDKNodeFeatures this_arg_conv;
41090         this_arg_conv.inner = untag_ptr(this_arg);
41091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41093         this_arg_conv.is_owned = false;
41094         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
41095         return ret_conv;
41096 }
41097
41098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
41099         LDKNodeFeatures this_arg_conv;
41100         this_arg_conv.inner = untag_ptr(this_arg);
41101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41103         this_arg_conv.is_owned = false;
41104         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
41105         return ret_conv;
41106 }
41107
41108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41109         LDKShutdownScript this_obj_conv;
41110         this_obj_conv.inner = untag_ptr(this_obj);
41111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41113         ShutdownScript_free(this_obj_conv);
41114 }
41115
41116 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
41117         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
41118         int64_t ret_ref = 0;
41119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41121         return ret_ref;
41122 }
41123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41124         LDKShutdownScript arg_conv;
41125         arg_conv.inner = untag_ptr(arg);
41126         arg_conv.is_owned = ptr_is_owned(arg);
41127         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41128         arg_conv.is_owned = false;
41129         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
41130         return ret_conv;
41131 }
41132
41133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41134         LDKShutdownScript orig_conv;
41135         orig_conv.inner = untag_ptr(orig);
41136         orig_conv.is_owned = ptr_is_owned(orig);
41137         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41138         orig_conv.is_owned = false;
41139         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
41140         int64_t ret_ref = 0;
41141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41143         return ret_ref;
41144 }
41145
41146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41147         LDKInvalidShutdownScript this_obj_conv;
41148         this_obj_conv.inner = untag_ptr(this_obj);
41149         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41151         InvalidShutdownScript_free(this_obj_conv);
41152 }
41153
41154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
41155         LDKInvalidShutdownScript this_ptr_conv;
41156         this_ptr_conv.inner = untag_ptr(this_ptr);
41157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41159         this_ptr_conv.is_owned = false;
41160         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
41161         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41162         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41163         return ret_arr;
41164 }
41165
41166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41167         LDKInvalidShutdownScript this_ptr_conv;
41168         this_ptr_conv.inner = untag_ptr(this_ptr);
41169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41171         this_ptr_conv.is_owned = false;
41172         LDKCVec_u8Z val_ref;
41173         val_ref.datalen = (*env)->GetArrayLength(env, val);
41174         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41175         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
41176         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
41177 }
41178
41179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
41180         LDKCVec_u8Z script_arg_ref;
41181         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
41182         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41183         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
41184         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
41185         int64_t ret_ref = 0;
41186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41188         return ret_ref;
41189 }
41190
41191 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
41192         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
41193         int64_t ret_ref = 0;
41194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41196         return ret_ref;
41197 }
41198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41199         LDKInvalidShutdownScript arg_conv;
41200         arg_conv.inner = untag_ptr(arg);
41201         arg_conv.is_owned = ptr_is_owned(arg);
41202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41203         arg_conv.is_owned = false;
41204         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
41205         return ret_conv;
41206 }
41207
41208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41209         LDKInvalidShutdownScript orig_conv;
41210         orig_conv.inner = untag_ptr(orig);
41211         orig_conv.is_owned = ptr_is_owned(orig);
41212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41213         orig_conv.is_owned = false;
41214         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
41215         int64_t ret_ref = 0;
41216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41218         return ret_ref;
41219 }
41220
41221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
41222         LDKShutdownScript obj_conv;
41223         obj_conv.inner = untag_ptr(obj);
41224         obj_conv.is_owned = ptr_is_owned(obj);
41225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41226         obj_conv.is_owned = false;
41227         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
41228         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41229         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41230         CVec_u8Z_free(ret_var);
41231         return ret_arr;
41232 }
41233
41234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41235         LDKu8slice ser_ref;
41236         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41237         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41238         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
41239         *ret_conv = ShutdownScript_read(ser_ref);
41240         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41241         return tag_ptr(ret_conv, true);
41242 }
41243
41244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
41245         unsigned char pubkey_hash_arr[20];
41246         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
41247         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
41248         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
41249         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
41250         int64_t ret_ref = 0;
41251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41253         return ret_ref;
41254 }
41255
41256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
41257         unsigned char script_hash_arr[32];
41258         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
41259         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
41260         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
41261         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
41262         int64_t ret_ref = 0;
41263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41265         return ret_ref;
41266 }
41267
41268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
41269         
41270         LDKu8slice program_ref;
41271         program_ref.datalen = (*env)->GetArrayLength(env, program);
41272         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
41273         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
41274         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
41275         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
41276         return tag_ptr(ret_conv, true);
41277 }
41278
41279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
41280         LDKShutdownScript this_arg_conv;
41281         this_arg_conv.inner = untag_ptr(this_arg);
41282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41284         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
41285         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
41286         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41287         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41288         CVec_u8Z_free(ret_var);
41289         return ret_arr;
41290 }
41291
41292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
41293         LDKShutdownScript this_arg_conv;
41294         this_arg_conv.inner = untag_ptr(this_arg);
41295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41297         this_arg_conv.is_owned = false;
41298         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41299         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
41300         return ret_arr;
41301 }
41302
41303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
41304         LDKShutdownScript this_arg_conv;
41305         this_arg_conv.inner = untag_ptr(this_arg);
41306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41308         this_arg_conv.is_owned = false;
41309         LDKInitFeatures features_conv;
41310         features_conv.inner = untag_ptr(features);
41311         features_conv.is_owned = ptr_is_owned(features);
41312         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41313         features_conv.is_owned = false;
41314         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
41315         return ret_conv;
41316 }
41317
41318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41319         if (!ptr_is_owned(this_ptr)) return;
41320         void* this_ptr_ptr = untag_ptr(this_ptr);
41321         CHECK_ACCESS(this_ptr_ptr);
41322         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
41323         FREE(untag_ptr(this_ptr));
41324         CustomMessageReader_free(this_ptr_conv);
41325 }
41326
41327 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
41328         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41329         *ret_ret = Type_clone(arg);
41330         return tag_ptr(ret_ret, true);
41331 }
41332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41333         void* arg_ptr = untag_ptr(arg);
41334         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
41335         LDKType* arg_conv = (LDKType*)arg_ptr;
41336         int64_t ret_conv = Type_clone_ptr(arg_conv);
41337         return ret_conv;
41338 }
41339
41340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41341         void* orig_ptr = untag_ptr(orig);
41342         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
41343         LDKType* orig_conv = (LDKType*)orig_ptr;
41344         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41345         *ret_ret = Type_clone(orig_conv);
41346         return tag_ptr(ret_ret, true);
41347 }
41348
41349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41350         if (!ptr_is_owned(this_ptr)) return;
41351         void* this_ptr_ptr = untag_ptr(this_ptr);
41352         CHECK_ACCESS(this_ptr_ptr);
41353         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
41354         FREE(untag_ptr(this_ptr));
41355         Type_free(this_ptr_conv);
41356 }
41357
41358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41359         LDKNodeId this_obj_conv;
41360         this_obj_conv.inner = untag_ptr(this_obj);
41361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41363         NodeId_free(this_obj_conv);
41364 }
41365
41366 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
41367         LDKNodeId ret_var = NodeId_clone(arg);
41368         int64_t ret_ref = 0;
41369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41371         return ret_ref;
41372 }
41373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41374         LDKNodeId arg_conv;
41375         arg_conv.inner = untag_ptr(arg);
41376         arg_conv.is_owned = ptr_is_owned(arg);
41377         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41378         arg_conv.is_owned = false;
41379         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
41380         return ret_conv;
41381 }
41382
41383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41384         LDKNodeId orig_conv;
41385         orig_conv.inner = untag_ptr(orig);
41386         orig_conv.is_owned = ptr_is_owned(orig);
41387         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41388         orig_conv.is_owned = false;
41389         LDKNodeId ret_var = NodeId_clone(&orig_conv);
41390         int64_t ret_ref = 0;
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41393         return ret_ref;
41394 }
41395
41396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
41397         LDKPublicKey pubkey_ref;
41398         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
41399         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
41400         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
41401         int64_t ret_ref = 0;
41402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41404         return ret_ref;
41405 }
41406
41407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
41408         LDKNodeId this_arg_conv;
41409         this_arg_conv.inner = untag_ptr(this_arg);
41410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41412         this_arg_conv.is_owned = false;
41413         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
41414         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41415         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41416         return ret_arr;
41417 }
41418
41419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
41420         LDKNodeId o_conv;
41421         o_conv.inner = untag_ptr(o);
41422         o_conv.is_owned = ptr_is_owned(o);
41423         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41424         o_conv.is_owned = false;
41425         int64_t ret_conv = NodeId_hash(&o_conv);
41426         return ret_conv;
41427 }
41428
41429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
41430         LDKNodeId obj_conv;
41431         obj_conv.inner = untag_ptr(obj);
41432         obj_conv.is_owned = ptr_is_owned(obj);
41433         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41434         obj_conv.is_owned = false;
41435         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
41436         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41437         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41438         CVec_u8Z_free(ret_var);
41439         return ret_arr;
41440 }
41441
41442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41443         LDKu8slice ser_ref;
41444         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41445         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41446         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
41447         *ret_conv = NodeId_read(ser_ref);
41448         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41449         return tag_ptr(ret_conv, true);
41450 }
41451
41452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41453         LDKNetworkGraph this_obj_conv;
41454         this_obj_conv.inner = untag_ptr(this_obj);
41455         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41457         NetworkGraph_free(this_obj_conv);
41458 }
41459
41460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41461         LDKReadOnlyNetworkGraph this_obj_conv;
41462         this_obj_conv.inner = untag_ptr(this_obj);
41463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41465         ReadOnlyNetworkGraph_free(this_obj_conv);
41466 }
41467
41468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41469         if (!ptr_is_owned(this_ptr)) return;
41470         void* this_ptr_ptr = untag_ptr(this_ptr);
41471         CHECK_ACCESS(this_ptr_ptr);
41472         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
41473         FREE(untag_ptr(this_ptr));
41474         NetworkUpdate_free(this_ptr_conv);
41475 }
41476
41477 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
41478         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41479         *ret_copy = NetworkUpdate_clone(arg);
41480         int64_t ret_ref = tag_ptr(ret_copy, true);
41481         return ret_ref;
41482 }
41483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41484         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
41485         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
41486         return ret_conv;
41487 }
41488
41489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41490         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
41491         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41492         *ret_copy = NetworkUpdate_clone(orig_conv);
41493         int64_t ret_ref = tag_ptr(ret_copy, true);
41494         return ret_ref;
41495 }
41496
41497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
41498         LDKChannelUpdate msg_conv;
41499         msg_conv.inner = untag_ptr(msg);
41500         msg_conv.is_owned = ptr_is_owned(msg);
41501         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41502         msg_conv = ChannelUpdate_clone(&msg_conv);
41503         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41504         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
41505         int64_t ret_ref = tag_ptr(ret_copy, true);
41506         return ret_ref;
41507 }
41508
41509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
41510         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41511         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
41512         int64_t ret_ref = tag_ptr(ret_copy, true);
41513         return ret_ref;
41514 }
41515
41516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
41517         LDKPublicKey node_id_ref;
41518         CHECK((*env)->GetArrayLength(env, node_id) == 33);
41519         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
41520         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41521         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
41522         int64_t ret_ref = tag_ptr(ret_copy, true);
41523         return ret_ref;
41524 }
41525
41526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
41527         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
41528         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
41529         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41530         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41531         CVec_u8Z_free(ret_var);
41532         return ret_arr;
41533 }
41534
41535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41536         LDKu8slice ser_ref;
41537         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41538         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41539         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
41540         *ret_conv = NetworkUpdate_read(ser_ref);
41541         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41542         return tag_ptr(ret_conv, true);
41543 }
41544
41545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41546         LDKP2PGossipSync this_obj_conv;
41547         this_obj_conv.inner = untag_ptr(this_obj);
41548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41550         P2PGossipSync_free(this_obj_conv);
41551 }
41552
41553 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) {
41554         LDKNetworkGraph network_graph_conv;
41555         network_graph_conv.inner = untag_ptr(network_graph);
41556         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41557         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41558         network_graph_conv.is_owned = false;
41559         void* chain_access_ptr = untag_ptr(chain_access);
41560         CHECK_ACCESS(chain_access_ptr);
41561         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41562         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41563         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41564                 // Manually implement clone for Java trait instances
41565                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41566                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41567                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41568                 }
41569         }
41570         void* logger_ptr = untag_ptr(logger);
41571         CHECK_ACCESS(logger_ptr);
41572         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41573         if (logger_conv.free == LDKLogger_JCalls_free) {
41574                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41575                 LDKLogger_JCalls_cloned(&logger_conv);
41576         }
41577         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
41578         int64_t ret_ref = 0;
41579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41581         return ret_ref;
41582 }
41583
41584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
41585         LDKP2PGossipSync this_arg_conv;
41586         this_arg_conv.inner = untag_ptr(this_arg);
41587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41589         this_arg_conv.is_owned = false;
41590         void* chain_access_ptr = untag_ptr(chain_access);
41591         CHECK_ACCESS(chain_access_ptr);
41592         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41593         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41594         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41595                 // Manually implement clone for Java trait instances
41596                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41597                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41598                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41599                 }
41600         }
41601         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
41602 }
41603
41604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41605         LDKNetworkGraph this_arg_conv;
41606         this_arg_conv.inner = untag_ptr(this_arg);
41607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41609         this_arg_conv.is_owned = false;
41610         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
41611         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
41612         return tag_ptr(ret_ret, true);
41613 }
41614
41615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
41616         LDKP2PGossipSync this_arg_conv;
41617         this_arg_conv.inner = untag_ptr(this_arg);
41618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41620         this_arg_conv.is_owned = false;
41621         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
41622         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
41623         return tag_ptr(ret_ret, true);
41624 }
41625
41626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
41627         LDKP2PGossipSync this_arg_conv;
41628         this_arg_conv.inner = untag_ptr(this_arg);
41629         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41631         this_arg_conv.is_owned = false;
41632         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41633         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
41634         return tag_ptr(ret_ret, true);
41635 }
41636
41637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41638         LDKChannelUpdateInfo this_obj_conv;
41639         this_obj_conv.inner = untag_ptr(this_obj);
41640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41642         ChannelUpdateInfo_free(this_obj_conv);
41643 }
41644
41645 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
41646         LDKChannelUpdateInfo this_ptr_conv;
41647         this_ptr_conv.inner = untag_ptr(this_ptr);
41648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41650         this_ptr_conv.is_owned = false;
41651         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
41652         return ret_conv;
41653 }
41654
41655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41656         LDKChannelUpdateInfo this_ptr_conv;
41657         this_ptr_conv.inner = untag_ptr(this_ptr);
41658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41660         this_ptr_conv.is_owned = false;
41661         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
41662 }
41663
41664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
41665         LDKChannelUpdateInfo this_ptr_conv;
41666         this_ptr_conv.inner = untag_ptr(this_ptr);
41667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41669         this_ptr_conv.is_owned = false;
41670         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
41671         return ret_conv;
41672 }
41673
41674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
41675         LDKChannelUpdateInfo this_ptr_conv;
41676         this_ptr_conv.inner = untag_ptr(this_ptr);
41677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41679         this_ptr_conv.is_owned = false;
41680         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
41681 }
41682
41683 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41684         LDKChannelUpdateInfo this_ptr_conv;
41685         this_ptr_conv.inner = untag_ptr(this_ptr);
41686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41688         this_ptr_conv.is_owned = false;
41689         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
41690         return ret_conv;
41691 }
41692
41693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41694         LDKChannelUpdateInfo this_ptr_conv;
41695         this_ptr_conv.inner = untag_ptr(this_ptr);
41696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41698         this_ptr_conv.is_owned = false;
41699         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
41700 }
41701
41702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41703         LDKChannelUpdateInfo this_ptr_conv;
41704         this_ptr_conv.inner = untag_ptr(this_ptr);
41705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41707         this_ptr_conv.is_owned = false;
41708         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
41709         return ret_conv;
41710 }
41711
41712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41713         LDKChannelUpdateInfo 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         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
41719 }
41720
41721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41722         LDKChannelUpdateInfo this_ptr_conv;
41723         this_ptr_conv.inner = untag_ptr(this_ptr);
41724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41726         this_ptr_conv.is_owned = false;
41727         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
41728         return ret_conv;
41729 }
41730
41731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41732         LDKChannelUpdateInfo this_ptr_conv;
41733         this_ptr_conv.inner = untag_ptr(this_ptr);
41734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41736         this_ptr_conv.is_owned = false;
41737         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
41738 }
41739
41740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
41741         LDKChannelUpdateInfo this_ptr_conv;
41742         this_ptr_conv.inner = untag_ptr(this_ptr);
41743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41745         this_ptr_conv.is_owned = false;
41746         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
41747         int64_t ret_ref = 0;
41748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41750         return ret_ref;
41751 }
41752
41753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41754         LDKChannelUpdateInfo 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         LDKRoutingFees val_conv;
41760         val_conv.inner = untag_ptr(val);
41761         val_conv.is_owned = ptr_is_owned(val);
41762         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41763         val_conv = RoutingFees_clone(&val_conv);
41764         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
41765 }
41766
41767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
41768         LDKChannelUpdateInfo this_ptr_conv;
41769         this_ptr_conv.inner = untag_ptr(this_ptr);
41770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41772         this_ptr_conv.is_owned = false;
41773         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
41774         int64_t ret_ref = 0;
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41777         return ret_ref;
41778 }
41779
41780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41781         LDKChannelUpdateInfo 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         LDKChannelUpdate val_conv;
41787         val_conv.inner = untag_ptr(val);
41788         val_conv.is_owned = ptr_is_owned(val);
41789         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41790         val_conv = ChannelUpdate_clone(&val_conv);
41791         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
41792 }
41793
41794 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) {
41795         LDKRoutingFees fees_arg_conv;
41796         fees_arg_conv.inner = untag_ptr(fees_arg);
41797         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
41798         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41799         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41800         LDKChannelUpdate last_update_message_arg_conv;
41801         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
41802         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
41803         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
41804         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
41805         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);
41806         int64_t ret_ref = 0;
41807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41809         return ret_ref;
41810 }
41811
41812 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
41813         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
41814         int64_t ret_ref = 0;
41815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41817         return ret_ref;
41818 }
41819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41820         LDKChannelUpdateInfo arg_conv;
41821         arg_conv.inner = untag_ptr(arg);
41822         arg_conv.is_owned = ptr_is_owned(arg);
41823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41824         arg_conv.is_owned = false;
41825         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
41826         return ret_conv;
41827 }
41828
41829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41830         LDKChannelUpdateInfo orig_conv;
41831         orig_conv.inner = untag_ptr(orig);
41832         orig_conv.is_owned = ptr_is_owned(orig);
41833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41834         orig_conv.is_owned = false;
41835         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
41836         int64_t ret_ref = 0;
41837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41839         return ret_ref;
41840 }
41841
41842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41843         LDKChannelUpdateInfo obj_conv;
41844         obj_conv.inner = untag_ptr(obj);
41845         obj_conv.is_owned = ptr_is_owned(obj);
41846         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41847         obj_conv.is_owned = false;
41848         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
41849         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41850         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41851         CVec_u8Z_free(ret_var);
41852         return ret_arr;
41853 }
41854
41855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41856         LDKu8slice ser_ref;
41857         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41858         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41859         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
41860         *ret_conv = ChannelUpdateInfo_read(ser_ref);
41861         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41862         return tag_ptr(ret_conv, true);
41863 }
41864
41865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41866         LDKChannelInfo this_obj_conv;
41867         this_obj_conv.inner = untag_ptr(this_obj);
41868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41870         ChannelInfo_free(this_obj_conv);
41871 }
41872
41873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41874         LDKChannelInfo this_ptr_conv;
41875         this_ptr_conv.inner = untag_ptr(this_ptr);
41876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41878         this_ptr_conv.is_owned = false;
41879         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
41880         int64_t ret_ref = 0;
41881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41883         return ret_ref;
41884 }
41885
41886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41887         LDKChannelInfo this_ptr_conv;
41888         this_ptr_conv.inner = untag_ptr(this_ptr);
41889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41891         this_ptr_conv.is_owned = false;
41892         LDKChannelFeatures val_conv;
41893         val_conv.inner = untag_ptr(val);
41894         val_conv.is_owned = ptr_is_owned(val);
41895         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41896         val_conv = ChannelFeatures_clone(&val_conv);
41897         ChannelInfo_set_features(&this_ptr_conv, val_conv);
41898 }
41899
41900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
41901         LDKChannelInfo this_ptr_conv;
41902         this_ptr_conv.inner = untag_ptr(this_ptr);
41903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41905         this_ptr_conv.is_owned = false;
41906         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
41907         int64_t ret_ref = 0;
41908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41910         return ret_ref;
41911 }
41912
41913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41914         LDKChannelInfo this_ptr_conv;
41915         this_ptr_conv.inner = untag_ptr(this_ptr);
41916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41918         this_ptr_conv.is_owned = false;
41919         LDKNodeId val_conv;
41920         val_conv.inner = untag_ptr(val);
41921         val_conv.is_owned = ptr_is_owned(val);
41922         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41923         val_conv = NodeId_clone(&val_conv);
41924         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
41925 }
41926
41927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
41928         LDKChannelInfo this_ptr_conv;
41929         this_ptr_conv.inner = untag_ptr(this_ptr);
41930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41932         this_ptr_conv.is_owned = false;
41933         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
41934         int64_t ret_ref = 0;
41935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41937         return ret_ref;
41938 }
41939
41940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41941         LDKChannelInfo this_ptr_conv;
41942         this_ptr_conv.inner = untag_ptr(this_ptr);
41943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41945         this_ptr_conv.is_owned = false;
41946         LDKChannelUpdateInfo val_conv;
41947         val_conv.inner = untag_ptr(val);
41948         val_conv.is_owned = ptr_is_owned(val);
41949         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41950         val_conv = ChannelUpdateInfo_clone(&val_conv);
41951         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
41952 }
41953
41954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
41955         LDKChannelInfo this_ptr_conv;
41956         this_ptr_conv.inner = untag_ptr(this_ptr);
41957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41959         this_ptr_conv.is_owned = false;
41960         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
41961         int64_t ret_ref = 0;
41962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41964         return ret_ref;
41965 }
41966
41967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41968         LDKChannelInfo this_ptr_conv;
41969         this_ptr_conv.inner = untag_ptr(this_ptr);
41970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41972         this_ptr_conv.is_owned = false;
41973         LDKNodeId val_conv;
41974         val_conv.inner = untag_ptr(val);
41975         val_conv.is_owned = ptr_is_owned(val);
41976         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41977         val_conv = NodeId_clone(&val_conv);
41978         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
41979 }
41980
41981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
41982         LDKChannelInfo this_ptr_conv;
41983         this_ptr_conv.inner = untag_ptr(this_ptr);
41984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41986         this_ptr_conv.is_owned = false;
41987         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
41988         int64_t ret_ref = 0;
41989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41991         return ret_ref;
41992 }
41993
41994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41995         LDKChannelInfo this_ptr_conv;
41996         this_ptr_conv.inner = untag_ptr(this_ptr);
41997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41999         this_ptr_conv.is_owned = false;
42000         LDKChannelUpdateInfo val_conv;
42001         val_conv.inner = untag_ptr(val);
42002         val_conv.is_owned = ptr_is_owned(val);
42003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42004         val_conv = ChannelUpdateInfo_clone(&val_conv);
42005         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
42006 }
42007
42008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
42009         LDKChannelInfo this_ptr_conv;
42010         this_ptr_conv.inner = untag_ptr(this_ptr);
42011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42013         this_ptr_conv.is_owned = false;
42014         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42015         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
42016         int64_t ret_ref = tag_ptr(ret_copy, true);
42017         return ret_ref;
42018 }
42019
42020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42021         LDKChannelInfo this_ptr_conv;
42022         this_ptr_conv.inner = untag_ptr(this_ptr);
42023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42025         this_ptr_conv.is_owned = false;
42026         void* val_ptr = untag_ptr(val);
42027         CHECK_ACCESS(val_ptr);
42028         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42029         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42030         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
42031 }
42032
42033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42034         LDKChannelInfo this_ptr_conv;
42035         this_ptr_conv.inner = untag_ptr(this_ptr);
42036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42038         this_ptr_conv.is_owned = false;
42039         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
42040         int64_t ret_ref = 0;
42041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42043         return ret_ref;
42044 }
42045
42046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42047         LDKChannelInfo this_ptr_conv;
42048         this_ptr_conv.inner = untag_ptr(this_ptr);
42049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42051         this_ptr_conv.is_owned = false;
42052         LDKChannelAnnouncement val_conv;
42053         val_conv.inner = untag_ptr(val);
42054         val_conv.is_owned = ptr_is_owned(val);
42055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42056         val_conv = ChannelAnnouncement_clone(&val_conv);
42057         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
42058 }
42059
42060 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
42061         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
42062         int64_t ret_ref = 0;
42063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42065         return ret_ref;
42066 }
42067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42068         LDKChannelInfo arg_conv;
42069         arg_conv.inner = untag_ptr(arg);
42070         arg_conv.is_owned = ptr_is_owned(arg);
42071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42072         arg_conv.is_owned = false;
42073         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
42074         return ret_conv;
42075 }
42076
42077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42078         LDKChannelInfo orig_conv;
42079         orig_conv.inner = untag_ptr(orig);
42080         orig_conv.is_owned = ptr_is_owned(orig);
42081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42082         orig_conv.is_owned = false;
42083         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
42084         int64_t ret_ref = 0;
42085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42087         return ret_ref;
42088 }
42089
42090 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) {
42091         LDKChannelInfo this_arg_conv;
42092         this_arg_conv.inner = untag_ptr(this_arg);
42093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42095         this_arg_conv.is_owned = false;
42096         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
42097         int64_t ret_ref = 0;
42098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42100         return ret_ref;
42101 }
42102
42103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42104         LDKChannelInfo obj_conv;
42105         obj_conv.inner = untag_ptr(obj);
42106         obj_conv.is_owned = ptr_is_owned(obj);
42107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42108         obj_conv.is_owned = false;
42109         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
42110         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42111         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42112         CVec_u8Z_free(ret_var);
42113         return ret_arr;
42114 }
42115
42116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42117         LDKu8slice ser_ref;
42118         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42119         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42120         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
42121         *ret_conv = ChannelInfo_read(ser_ref);
42122         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42123         return tag_ptr(ret_conv, true);
42124 }
42125
42126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42127         LDKDirectedChannelInfo this_obj_conv;
42128         this_obj_conv.inner = untag_ptr(this_obj);
42129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42131         DirectedChannelInfo_free(this_obj_conv);
42132 }
42133
42134 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
42135         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
42136         int64_t ret_ref = 0;
42137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42139         return ret_ref;
42140 }
42141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42142         LDKDirectedChannelInfo arg_conv;
42143         arg_conv.inner = untag_ptr(arg);
42144         arg_conv.is_owned = ptr_is_owned(arg);
42145         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42146         arg_conv.is_owned = false;
42147         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
42148         return ret_conv;
42149 }
42150
42151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42152         LDKDirectedChannelInfo orig_conv;
42153         orig_conv.inner = untag_ptr(orig);
42154         orig_conv.is_owned = ptr_is_owned(orig);
42155         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42156         orig_conv.is_owned = false;
42157         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
42158         int64_t ret_ref = 0;
42159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42161         return ret_ref;
42162 }
42163
42164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
42165         LDKDirectedChannelInfo this_arg_conv;
42166         this_arg_conv.inner = untag_ptr(this_arg);
42167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42169         this_arg_conv.is_owned = false;
42170         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
42171         int64_t ret_ref = 0;
42172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42174         return ret_ref;
42175 }
42176
42177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
42178         LDKDirectedChannelInfo this_arg_conv;
42179         this_arg_conv.inner = untag_ptr(this_arg);
42180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42182         this_arg_conv.is_owned = false;
42183         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
42184         int64_t ret_ref = 0;
42185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42187         return ret_ref;
42188 }
42189
42190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42191         LDKDirectedChannelInfo this_arg_conv;
42192         this_arg_conv.inner = untag_ptr(this_arg);
42193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42195         this_arg_conv.is_owned = false;
42196         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
42197         return ret_conv;
42198 }
42199
42200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
42201         LDKDirectedChannelInfo this_arg_conv;
42202         this_arg_conv.inner = untag_ptr(this_arg);
42203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42205         this_arg_conv.is_owned = false;
42206         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42207         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
42208         int64_t ret_ref = tag_ptr(ret_copy, true);
42209         return ret_ref;
42210 }
42211
42212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42213         if (!ptr_is_owned(this_ptr)) return;
42214         void* this_ptr_ptr = untag_ptr(this_ptr);
42215         CHECK_ACCESS(this_ptr_ptr);
42216         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
42217         FREE(untag_ptr(this_ptr));
42218         EffectiveCapacity_free(this_ptr_conv);
42219 }
42220
42221 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
42222         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42223         *ret_copy = EffectiveCapacity_clone(arg);
42224         int64_t ret_ref = tag_ptr(ret_copy, true);
42225         return ret_ref;
42226 }
42227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42228         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
42229         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
42230         return ret_conv;
42231 }
42232
42233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42234         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
42235         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42236         *ret_copy = EffectiveCapacity_clone(orig_conv);
42237         int64_t ret_ref = tag_ptr(ret_copy, true);
42238         return ret_ref;
42239 }
42240
42241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
42242         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42243         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
42244         int64_t ret_ref = tag_ptr(ret_copy, true);
42245         return ret_ref;
42246 }
42247
42248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
42249         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42250         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
42251         int64_t ret_ref = tag_ptr(ret_copy, true);
42252         return ret_ref;
42253 }
42254
42255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
42256         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
42257         CHECK_ACCESS(htlc_maximum_msat_ptr);
42258         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
42259         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
42260         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42261         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
42262         int64_t ret_ref = tag_ptr(ret_copy, true);
42263         return ret_ref;
42264 }
42265
42266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
42267         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42268         *ret_copy = EffectiveCapacity_infinite();
42269         int64_t ret_ref = tag_ptr(ret_copy, true);
42270         return ret_ref;
42271 }
42272
42273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
42274         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42275         *ret_copy = EffectiveCapacity_unknown();
42276         int64_t ret_ref = tag_ptr(ret_copy, true);
42277         return ret_ref;
42278 }
42279
42280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
42281         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
42282         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
42283         return ret_conv;
42284 }
42285
42286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42287         LDKRoutingFees this_obj_conv;
42288         this_obj_conv.inner = untag_ptr(this_obj);
42289         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42291         RoutingFees_free(this_obj_conv);
42292 }
42293
42294 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42295         LDKRoutingFees 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         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
42301         return ret_conv;
42302 }
42303
42304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42305         LDKRoutingFees this_ptr_conv;
42306         this_ptr_conv.inner = untag_ptr(this_ptr);
42307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42309         this_ptr_conv.is_owned = false;
42310         RoutingFees_set_base_msat(&this_ptr_conv, val);
42311 }
42312
42313 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42314         LDKRoutingFees this_ptr_conv;
42315         this_ptr_conv.inner = untag_ptr(this_ptr);
42316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42318         this_ptr_conv.is_owned = false;
42319         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
42320         return ret_conv;
42321 }
42322
42323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42324         LDKRoutingFees this_ptr_conv;
42325         this_ptr_conv.inner = untag_ptr(this_ptr);
42326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42328         this_ptr_conv.is_owned = false;
42329         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
42330 }
42331
42332 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) {
42333         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
42334         int64_t ret_ref = 0;
42335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42337         return ret_ref;
42338 }
42339
42340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42341         LDKRoutingFees a_conv;
42342         a_conv.inner = untag_ptr(a);
42343         a_conv.is_owned = ptr_is_owned(a);
42344         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42345         a_conv.is_owned = false;
42346         LDKRoutingFees b_conv;
42347         b_conv.inner = untag_ptr(b);
42348         b_conv.is_owned = ptr_is_owned(b);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42350         b_conv.is_owned = false;
42351         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
42352         return ret_conv;
42353 }
42354
42355 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
42356         LDKRoutingFees ret_var = RoutingFees_clone(arg);
42357         int64_t ret_ref = 0;
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42360         return ret_ref;
42361 }
42362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42363         LDKRoutingFees arg_conv;
42364         arg_conv.inner = untag_ptr(arg);
42365         arg_conv.is_owned = ptr_is_owned(arg);
42366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42367         arg_conv.is_owned = false;
42368         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
42369         return ret_conv;
42370 }
42371
42372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42373         LDKRoutingFees orig_conv;
42374         orig_conv.inner = untag_ptr(orig);
42375         orig_conv.is_owned = ptr_is_owned(orig);
42376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42377         orig_conv.is_owned = false;
42378         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
42379         int64_t ret_ref = 0;
42380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42382         return ret_ref;
42383 }
42384
42385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
42386         LDKRoutingFees o_conv;
42387         o_conv.inner = untag_ptr(o);
42388         o_conv.is_owned = ptr_is_owned(o);
42389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42390         o_conv.is_owned = false;
42391         int64_t ret_conv = RoutingFees_hash(&o_conv);
42392         return ret_conv;
42393 }
42394
42395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
42396         LDKRoutingFees obj_conv;
42397         obj_conv.inner = untag_ptr(obj);
42398         obj_conv.is_owned = ptr_is_owned(obj);
42399         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42400         obj_conv.is_owned = false;
42401         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
42402         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42403         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42404         CVec_u8Z_free(ret_var);
42405         return ret_arr;
42406 }
42407
42408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42409         LDKu8slice ser_ref;
42410         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42411         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42412         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
42413         *ret_conv = RoutingFees_read(ser_ref);
42414         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42415         return tag_ptr(ret_conv, true);
42416 }
42417
42418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42419         LDKNodeAnnouncementInfo this_obj_conv;
42420         this_obj_conv.inner = untag_ptr(this_obj);
42421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42423         NodeAnnouncementInfo_free(this_obj_conv);
42424 }
42425
42426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42427         LDKNodeAnnouncementInfo this_ptr_conv;
42428         this_ptr_conv.inner = untag_ptr(this_ptr);
42429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42431         this_ptr_conv.is_owned = false;
42432         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
42433         int64_t ret_ref = 0;
42434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42436         return ret_ref;
42437 }
42438
42439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42440         LDKNodeAnnouncementInfo this_ptr_conv;
42441         this_ptr_conv.inner = untag_ptr(this_ptr);
42442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42444         this_ptr_conv.is_owned = false;
42445         LDKNodeFeatures val_conv;
42446         val_conv.inner = untag_ptr(val);
42447         val_conv.is_owned = ptr_is_owned(val);
42448         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42449         val_conv = NodeFeatures_clone(&val_conv);
42450         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
42451 }
42452
42453 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
42454         LDKNodeAnnouncementInfo this_ptr_conv;
42455         this_ptr_conv.inner = untag_ptr(this_ptr);
42456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42458         this_ptr_conv.is_owned = false;
42459         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
42460         return ret_conv;
42461 }
42462
42463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42464         LDKNodeAnnouncementInfo this_ptr_conv;
42465         this_ptr_conv.inner = untag_ptr(this_ptr);
42466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42468         this_ptr_conv.is_owned = false;
42469         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
42470 }
42471
42472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
42473         LDKNodeAnnouncementInfo this_ptr_conv;
42474         this_ptr_conv.inner = untag_ptr(this_ptr);
42475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42477         this_ptr_conv.is_owned = false;
42478         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
42479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
42480         return ret_arr;
42481 }
42482
42483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42484         LDKNodeAnnouncementInfo this_ptr_conv;
42485         this_ptr_conv.inner = untag_ptr(this_ptr);
42486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42488         this_ptr_conv.is_owned = false;
42489         LDKThreeBytes val_ref;
42490         CHECK((*env)->GetArrayLength(env, val) == 3);
42491         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
42492         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
42493 }
42494
42495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42496         LDKNodeAnnouncementInfo this_ptr_conv;
42497         this_ptr_conv.inner = untag_ptr(this_ptr);
42498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42500         this_ptr_conv.is_owned = false;
42501         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
42502         int64_t ret_ref = 0;
42503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42505         return ret_ref;
42506 }
42507
42508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42509         LDKNodeAnnouncementInfo this_ptr_conv;
42510         this_ptr_conv.inner = untag_ptr(this_ptr);
42511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42513         this_ptr_conv.is_owned = false;
42514         LDKNodeAlias val_conv;
42515         val_conv.inner = untag_ptr(val);
42516         val_conv.is_owned = ptr_is_owned(val);
42517         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42518         val_conv = NodeAlias_clone(&val_conv);
42519         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
42520 }
42521
42522 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
42523         LDKNodeAnnouncementInfo this_ptr_conv;
42524         this_ptr_conv.inner = untag_ptr(this_ptr);
42525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42527         this_ptr_conv.is_owned = false;
42528         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
42529         int64_tArray ret_arr = NULL;
42530         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42531         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42532         for (size_t m = 0; m < ret_var.datalen; m++) {
42533                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
42534                 *ret_conv_12_copy = ret_var.data[m];
42535                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
42536                 ret_arr_ptr[m] = ret_conv_12_ref;
42537         }
42538         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42539         FREE(ret_var.data);
42540         return ret_arr;
42541 }
42542
42543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42544         LDKNodeAnnouncementInfo this_ptr_conv;
42545         this_ptr_conv.inner = untag_ptr(this_ptr);
42546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42548         this_ptr_conv.is_owned = false;
42549         LDKCVec_NetAddressZ val_constr;
42550         val_constr.datalen = (*env)->GetArrayLength(env, val);
42551         if (val_constr.datalen > 0)
42552                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42553         else
42554                 val_constr.data = NULL;
42555         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42556         for (size_t m = 0; m < val_constr.datalen; m++) {
42557                 int64_t val_conv_12 = val_vals[m];
42558                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
42559                 CHECK_ACCESS(val_conv_12_ptr);
42560                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
42561                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
42562                 val_constr.data[m] = val_conv_12_conv;
42563         }
42564         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42565         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
42566 }
42567
42568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
42569         LDKNodeAnnouncementInfo this_ptr_conv;
42570         this_ptr_conv.inner = untag_ptr(this_ptr);
42571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42573         this_ptr_conv.is_owned = false;
42574         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
42575         int64_t ret_ref = 0;
42576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42578         return ret_ref;
42579 }
42580
42581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42582         LDKNodeAnnouncementInfo this_ptr_conv;
42583         this_ptr_conv.inner = untag_ptr(this_ptr);
42584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42586         this_ptr_conv.is_owned = false;
42587         LDKNodeAnnouncement val_conv;
42588         val_conv.inner = untag_ptr(val);
42589         val_conv.is_owned = ptr_is_owned(val);
42590         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42591         val_conv = NodeAnnouncement_clone(&val_conv);
42592         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
42593 }
42594
42595 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) {
42596         LDKNodeFeatures features_arg_conv;
42597         features_arg_conv.inner = untag_ptr(features_arg);
42598         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42599         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42600         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
42601         LDKThreeBytes rgb_arg_ref;
42602         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
42603         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
42604         LDKNodeAlias alias_arg_conv;
42605         alias_arg_conv.inner = untag_ptr(alias_arg);
42606         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
42607         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
42608         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
42609         LDKCVec_NetAddressZ addresses_arg_constr;
42610         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
42611         if (addresses_arg_constr.datalen > 0)
42612                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42613         else
42614                 addresses_arg_constr.data = NULL;
42615         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
42616         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
42617                 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
42618                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
42619                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
42620                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
42621                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
42622         }
42623         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
42624         LDKNodeAnnouncement announcement_message_arg_conv;
42625         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
42626         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
42627         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
42628         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
42629         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
42630         int64_t ret_ref = 0;
42631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42633         return ret_ref;
42634 }
42635
42636 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
42637         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42644         LDKNodeAnnouncementInfo arg_conv;
42645         arg_conv.inner = untag_ptr(arg);
42646         arg_conv.is_owned = ptr_is_owned(arg);
42647         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42648         arg_conv.is_owned = false;
42649         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
42650         return ret_conv;
42651 }
42652
42653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42654         LDKNodeAnnouncementInfo orig_conv;
42655         orig_conv.inner = untag_ptr(orig);
42656         orig_conv.is_owned = ptr_is_owned(orig);
42657         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42658         orig_conv.is_owned = false;
42659         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
42660         int64_t ret_ref = 0;
42661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42663         return ret_ref;
42664 }
42665
42666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42667         LDKNodeAnnouncementInfo obj_conv;
42668         obj_conv.inner = untag_ptr(obj);
42669         obj_conv.is_owned = ptr_is_owned(obj);
42670         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42671         obj_conv.is_owned = false;
42672         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
42673         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42674         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42675         CVec_u8Z_free(ret_var);
42676         return ret_arr;
42677 }
42678
42679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42680         LDKu8slice ser_ref;
42681         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42682         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42683         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
42684         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
42685         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42686         return tag_ptr(ret_conv, true);
42687 }
42688
42689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42690         LDKNodeAlias this_obj_conv;
42691         this_obj_conv.inner = untag_ptr(this_obj);
42692         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42694         NodeAlias_free(this_obj_conv);
42695 }
42696
42697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
42698         LDKNodeAlias this_ptr_conv;
42699         this_ptr_conv.inner = untag_ptr(this_ptr);
42700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42702         this_ptr_conv.is_owned = false;
42703         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42704         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
42705         return ret_arr;
42706 }
42707
42708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42709         LDKNodeAlias this_ptr_conv;
42710         this_ptr_conv.inner = untag_ptr(this_ptr);
42711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42713         this_ptr_conv.is_owned = false;
42714         LDKThirtyTwoBytes val_ref;
42715         CHECK((*env)->GetArrayLength(env, val) == 32);
42716         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42717         NodeAlias_set_a(&this_ptr_conv, val_ref);
42718 }
42719
42720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
42721         LDKThirtyTwoBytes a_arg_ref;
42722         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
42723         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
42724         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
42725         int64_t ret_ref = 0;
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42728         return ret_ref;
42729 }
42730
42731 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
42732         LDKNodeAlias ret_var = NodeAlias_clone(arg);
42733         int64_t ret_ref = 0;
42734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42736         return ret_ref;
42737 }
42738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42739         LDKNodeAlias arg_conv;
42740         arg_conv.inner = untag_ptr(arg);
42741         arg_conv.is_owned = ptr_is_owned(arg);
42742         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42743         arg_conv.is_owned = false;
42744         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
42745         return ret_conv;
42746 }
42747
42748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42749         LDKNodeAlias orig_conv;
42750         orig_conv.inner = untag_ptr(orig);
42751         orig_conv.is_owned = ptr_is_owned(orig);
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42753         orig_conv.is_owned = false;
42754         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
42755         int64_t ret_ref = 0;
42756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42758         return ret_ref;
42759 }
42760
42761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
42762         LDKNodeAlias obj_conv;
42763         obj_conv.inner = untag_ptr(obj);
42764         obj_conv.is_owned = ptr_is_owned(obj);
42765         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42766         obj_conv.is_owned = false;
42767         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
42768         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42769         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42770         CVec_u8Z_free(ret_var);
42771         return ret_arr;
42772 }
42773
42774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42775         LDKu8slice ser_ref;
42776         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42777         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42778         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
42779         *ret_conv = NodeAlias_read(ser_ref);
42780         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42781         return tag_ptr(ret_conv, true);
42782 }
42783
42784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42785         LDKNodeInfo this_obj_conv;
42786         this_obj_conv.inner = untag_ptr(this_obj);
42787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42789         NodeInfo_free(this_obj_conv);
42790 }
42791
42792 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
42793         LDKNodeInfo this_ptr_conv;
42794         this_ptr_conv.inner = untag_ptr(this_ptr);
42795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42797         this_ptr_conv.is_owned = false;
42798         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
42799         int64_tArray ret_arr = NULL;
42800         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42801         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42802         for (size_t g = 0; g < ret_var.datalen; g++) {
42803                 int64_t ret_conv_6_conv = ret_var.data[g];
42804                 ret_arr_ptr[g] = ret_conv_6_conv;
42805         }
42806         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42807         FREE(ret_var.data);
42808         return ret_arr;
42809 }
42810
42811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42812         LDKNodeInfo this_ptr_conv;
42813         this_ptr_conv.inner = untag_ptr(this_ptr);
42814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42816         this_ptr_conv.is_owned = false;
42817         LDKCVec_u64Z val_constr;
42818         val_constr.datalen = (*env)->GetArrayLength(env, val);
42819         if (val_constr.datalen > 0)
42820                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42821         else
42822                 val_constr.data = NULL;
42823         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42824         for (size_t g = 0; g < val_constr.datalen; g++) {
42825                 int64_t val_conv_6 = val_vals[g];
42826                 val_constr.data[g] = val_conv_6;
42827         }
42828         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42829         NodeInfo_set_channels(&this_ptr_conv, val_constr);
42830 }
42831
42832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
42833         LDKNodeInfo this_ptr_conv;
42834         this_ptr_conv.inner = untag_ptr(this_ptr);
42835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42837         this_ptr_conv.is_owned = false;
42838         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
42839         int64_t ret_ref = 0;
42840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42842         return ret_ref;
42843 }
42844
42845 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) {
42846         LDKNodeInfo this_ptr_conv;
42847         this_ptr_conv.inner = untag_ptr(this_ptr);
42848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42850         this_ptr_conv.is_owned = false;
42851         LDKRoutingFees val_conv;
42852         val_conv.inner = untag_ptr(val);
42853         val_conv.is_owned = ptr_is_owned(val);
42854         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42855         val_conv = RoutingFees_clone(&val_conv);
42856         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
42857 }
42858
42859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
42860         LDKNodeInfo this_ptr_conv;
42861         this_ptr_conv.inner = untag_ptr(this_ptr);
42862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42864         this_ptr_conv.is_owned = false;
42865         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
42866         int64_t ret_ref = 0;
42867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42869         return ret_ref;
42870 }
42871
42872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42873         LDKNodeInfo this_ptr_conv;
42874         this_ptr_conv.inner = untag_ptr(this_ptr);
42875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42877         this_ptr_conv.is_owned = false;
42878         LDKNodeAnnouncementInfo val_conv;
42879         val_conv.inner = untag_ptr(val);
42880         val_conv.is_owned = ptr_is_owned(val);
42881         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42882         val_conv = NodeAnnouncementInfo_clone(&val_conv);
42883         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
42884 }
42885
42886 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) {
42887         LDKCVec_u64Z channels_arg_constr;
42888         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
42889         if (channels_arg_constr.datalen > 0)
42890                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42891         else
42892                 channels_arg_constr.data = NULL;
42893         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
42894         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
42895                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
42896                 channels_arg_constr.data[g] = channels_arg_conv_6;
42897         }
42898         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
42899         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
42900         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
42901         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
42902         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
42903         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
42904         LDKNodeAnnouncementInfo announcement_info_arg_conv;
42905         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
42906         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
42907         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
42908         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
42909         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
42910         int64_t ret_ref = 0;
42911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42913         return ret_ref;
42914 }
42915
42916 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
42917         LDKNodeInfo ret_var = NodeInfo_clone(arg);
42918         int64_t ret_ref = 0;
42919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42921         return ret_ref;
42922 }
42923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42924         LDKNodeInfo arg_conv;
42925         arg_conv.inner = untag_ptr(arg);
42926         arg_conv.is_owned = ptr_is_owned(arg);
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42928         arg_conv.is_owned = false;
42929         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
42930         return ret_conv;
42931 }
42932
42933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42934         LDKNodeInfo orig_conv;
42935         orig_conv.inner = untag_ptr(orig);
42936         orig_conv.is_owned = ptr_is_owned(orig);
42937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42938         orig_conv.is_owned = false;
42939         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
42940         int64_t ret_ref = 0;
42941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42943         return ret_ref;
42944 }
42945
42946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
42947         LDKNodeInfo obj_conv;
42948         obj_conv.inner = untag_ptr(obj);
42949         obj_conv.is_owned = ptr_is_owned(obj);
42950         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42951         obj_conv.is_owned = false;
42952         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
42953         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42954         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42955         CVec_u8Z_free(ret_var);
42956         return ret_arr;
42957 }
42958
42959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42960         LDKu8slice ser_ref;
42961         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42962         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42963         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
42964         *ret_conv = NodeInfo_read(ser_ref);
42965         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42966         return tag_ptr(ret_conv, true);
42967 }
42968
42969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
42970         LDKNetworkGraph obj_conv;
42971         obj_conv.inner = untag_ptr(obj);
42972         obj_conv.is_owned = ptr_is_owned(obj);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42974         obj_conv.is_owned = false;
42975         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
42976         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42977         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42978         CVec_u8Z_free(ret_var);
42979         return ret_arr;
42980 }
42981
42982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
42983         LDKu8slice ser_ref;
42984         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42985         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42986         void* arg_ptr = untag_ptr(arg);
42987         CHECK_ACCESS(arg_ptr);
42988         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
42989         if (arg_conv.free == LDKLogger_JCalls_free) {
42990                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42991                 LDKLogger_JCalls_cloned(&arg_conv);
42992         }
42993         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
42994         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
42995         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42996         return tag_ptr(ret_conv, true);
42997 }
42998
42999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t logger) {
43000         LDKThirtyTwoBytes genesis_hash_ref;
43001         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
43002         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
43003         void* logger_ptr = untag_ptr(logger);
43004         CHECK_ACCESS(logger_ptr);
43005         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43006         if (logger_conv.free == LDKLogger_JCalls_free) {
43007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43008                 LDKLogger_JCalls_cloned(&logger_conv);
43009         }
43010         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
43011         int64_t ret_ref = 0;
43012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43014         return ret_ref;
43015 }
43016
43017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
43018         LDKNetworkGraph this_arg_conv;
43019         this_arg_conv.inner = untag_ptr(this_arg);
43020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43022         this_arg_conv.is_owned = false;
43023         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
43024         int64_t ret_ref = 0;
43025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43027         return ret_ref;
43028 }
43029
43030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
43031         LDKNetworkGraph this_arg_conv;
43032         this_arg_conv.inner = untag_ptr(this_arg);
43033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43035         this_arg_conv.is_owned = false;
43036         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43037         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
43038         int64_t ret_ref = tag_ptr(ret_copy, true);
43039         return ret_ref;
43040 }
43041
43042 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) {
43043         LDKNetworkGraph 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         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
43049 }
43050
43051 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) {
43052         LDKNetworkGraph this_arg_conv;
43053         this_arg_conv.inner = untag_ptr(this_arg);
43054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43056         this_arg_conv.is_owned = false;
43057         LDKNodeAnnouncement msg_conv;
43058         msg_conv.inner = untag_ptr(msg);
43059         msg_conv.is_owned = ptr_is_owned(msg);
43060         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43061         msg_conv.is_owned = false;
43062         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43063         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
43064         return tag_ptr(ret_conv, true);
43065 }
43066
43067 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) {
43068         LDKNetworkGraph this_arg_conv;
43069         this_arg_conv.inner = untag_ptr(this_arg);
43070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43072         this_arg_conv.is_owned = false;
43073         LDKUnsignedNodeAnnouncement msg_conv;
43074         msg_conv.inner = untag_ptr(msg);
43075         msg_conv.is_owned = ptr_is_owned(msg);
43076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43077         msg_conv.is_owned = false;
43078         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43079         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
43080         return tag_ptr(ret_conv, true);
43081 }
43082
43083 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) {
43084         LDKNetworkGraph this_arg_conv;
43085         this_arg_conv.inner = untag_ptr(this_arg);
43086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43088         this_arg_conv.is_owned = false;
43089         LDKChannelAnnouncement msg_conv;
43090         msg_conv.inner = untag_ptr(msg);
43091         msg_conv.is_owned = ptr_is_owned(msg);
43092         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43093         msg_conv.is_owned = false;
43094         void* chain_access_ptr = untag_ptr(chain_access);
43095         CHECK_ACCESS(chain_access_ptr);
43096         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43097         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43098         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43099                 // Manually implement clone for Java trait instances
43100                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43101                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43102                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43103                 }
43104         }
43105         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43106         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43107         return tag_ptr(ret_conv, true);
43108 }
43109
43110 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) {
43111         LDKNetworkGraph this_arg_conv;
43112         this_arg_conv.inner = untag_ptr(this_arg);
43113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43115         this_arg_conv.is_owned = false;
43116         LDKUnsignedChannelAnnouncement msg_conv;
43117         msg_conv.inner = untag_ptr(msg);
43118         msg_conv.is_owned = ptr_is_owned(msg);
43119         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43120         msg_conv.is_owned = false;
43121         void* chain_access_ptr = untag_ptr(chain_access);
43122         CHECK_ACCESS(chain_access_ptr);
43123         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43124         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43125         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43126                 // Manually implement clone for Java trait instances
43127                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43128                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43129                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43130                 }
43131         }
43132         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43133         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43134         return tag_ptr(ret_conv, true);
43135 }
43136
43137 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) {
43138         LDKNetworkGraph this_arg_conv;
43139         this_arg_conv.inner = untag_ptr(this_arg);
43140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43142         this_arg_conv.is_owned = false;
43143         LDKChannelFeatures features_conv;
43144         features_conv.inner = untag_ptr(features);
43145         features_conv.is_owned = ptr_is_owned(features);
43146         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
43147         features_conv = ChannelFeatures_clone(&features_conv);
43148         LDKPublicKey node_id_1_ref;
43149         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
43150         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
43151         LDKPublicKey node_id_2_ref;
43152         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
43153         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
43154         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43155         *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);
43156         return tag_ptr(ret_conv, true);
43157 }
43158
43159 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) {
43160         LDKNetworkGraph this_arg_conv;
43161         this_arg_conv.inner = untag_ptr(this_arg);
43162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43164         this_arg_conv.is_owned = false;
43165         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
43166 }
43167
43168 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) {
43169         LDKNetworkGraph this_arg_conv;
43170         this_arg_conv.inner = untag_ptr(this_arg);
43171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43173         this_arg_conv.is_owned = false;
43174         LDKPublicKey _node_id_ref;
43175         CHECK((*env)->GetArrayLength(env, _node_id) == 33);
43176         (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
43177         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
43178 }
43179
43180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43181         LDKNetworkGraph this_arg_conv;
43182         this_arg_conv.inner = untag_ptr(this_arg);
43183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43185         this_arg_conv.is_owned = false;
43186         NetworkGraph_remove_stale_channels(&this_arg_conv);
43187 }
43188
43189 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) {
43190         LDKNetworkGraph this_arg_conv;
43191         this_arg_conv.inner = untag_ptr(this_arg);
43192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43194         this_arg_conv.is_owned = false;
43195         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
43196 }
43197
43198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43199         LDKNetworkGraph this_arg_conv;
43200         this_arg_conv.inner = untag_ptr(this_arg);
43201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43203         this_arg_conv.is_owned = false;
43204         LDKChannelUpdate msg_conv;
43205         msg_conv.inner = untag_ptr(msg);
43206         msg_conv.is_owned = ptr_is_owned(msg);
43207         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43208         msg_conv.is_owned = false;
43209         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43210         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
43211         return tag_ptr(ret_conv, true);
43212 }
43213
43214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
43215         LDKNetworkGraph this_arg_conv;
43216         this_arg_conv.inner = untag_ptr(this_arg);
43217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43219         this_arg_conv.is_owned = false;
43220         LDKUnsignedChannelUpdate msg_conv;
43221         msg_conv.inner = untag_ptr(msg);
43222         msg_conv.is_owned = ptr_is_owned(msg);
43223         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43224         msg_conv.is_owned = false;
43225         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43226         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
43227         return tag_ptr(ret_conv, true);
43228 }
43229
43230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
43231         LDKReadOnlyNetworkGraph this_arg_conv;
43232         this_arg_conv.inner = untag_ptr(this_arg);
43233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43235         this_arg_conv.is_owned = false;
43236         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
43237         int64_t ret_ref = 0;
43238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43240         return ret_ref;
43241 }
43242
43243 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
43244         LDKReadOnlyNetworkGraph this_arg_conv;
43245         this_arg_conv.inner = untag_ptr(this_arg);
43246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43248         this_arg_conv.is_owned = false;
43249         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
43250         int64_tArray ret_arr = NULL;
43251         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43252         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43253         for (size_t g = 0; g < ret_var.datalen; g++) {
43254                 int64_t ret_conv_6_conv = ret_var.data[g];
43255                 ret_arr_ptr[g] = ret_conv_6_conv;
43256         }
43257         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43258         FREE(ret_var.data);
43259         return ret_arr;
43260 }
43261
43262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
43263         LDKReadOnlyNetworkGraph this_arg_conv;
43264         this_arg_conv.inner = untag_ptr(this_arg);
43265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43267         this_arg_conv.is_owned = false;
43268         LDKNodeId node_id_conv;
43269         node_id_conv.inner = untag_ptr(node_id);
43270         node_id_conv.is_owned = ptr_is_owned(node_id);
43271         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43272         node_id_conv.is_owned = false;
43273         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
43274         int64_t ret_ref = 0;
43275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43277         return ret_ref;
43278 }
43279
43280 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
43281         LDKReadOnlyNetworkGraph this_arg_conv;
43282         this_arg_conv.inner = untag_ptr(this_arg);
43283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43285         this_arg_conv.is_owned = false;
43286         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
43287         int64_tArray ret_arr = NULL;
43288         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
43289         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
43290         for (size_t i = 0; i < ret_var.datalen; i++) {
43291                 LDKNodeId ret_conv_8_var = ret_var.data[i];
43292                 int64_t ret_conv_8_ref = 0;
43293                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
43294                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
43295                 ret_arr_ptr[i] = ret_conv_8_ref;
43296         }
43297         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
43298         FREE(ret_var.data);
43299         return ret_arr;
43300 }
43301
43302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
43303         LDKReadOnlyNetworkGraph this_arg_conv;
43304         this_arg_conv.inner = untag_ptr(this_arg);
43305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43307         this_arg_conv.is_owned = false;
43308         LDKPublicKey pubkey_ref;
43309         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
43310         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
43311         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
43312         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
43313         int64_t ret_ref = tag_ptr(ret_copy, true);
43314         return ret_ref;
43315 }
43316
43317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43318         LDKRouteHop this_obj_conv;
43319         this_obj_conv.inner = untag_ptr(this_obj);
43320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43322         RouteHop_free(this_obj_conv);
43323 }
43324
43325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43326         LDKRouteHop this_ptr_conv;
43327         this_ptr_conv.inner = untag_ptr(this_ptr);
43328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43330         this_ptr_conv.is_owned = false;
43331         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
43333         return ret_arr;
43334 }
43335
43336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43337         LDKRouteHop this_ptr_conv;
43338         this_ptr_conv.inner = untag_ptr(this_ptr);
43339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43341         this_ptr_conv.is_owned = false;
43342         LDKPublicKey val_ref;
43343         CHECK((*env)->GetArrayLength(env, val) == 33);
43344         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43345         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
43346 }
43347
43348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43349         LDKRouteHop this_ptr_conv;
43350         this_ptr_conv.inner = untag_ptr(this_ptr);
43351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43353         this_ptr_conv.is_owned = false;
43354         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
43355         int64_t ret_ref = 0;
43356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43358         return ret_ref;
43359 }
43360
43361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43362         LDKRouteHop this_ptr_conv;
43363         this_ptr_conv.inner = untag_ptr(this_ptr);
43364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43366         this_ptr_conv.is_owned = false;
43367         LDKNodeFeatures val_conv;
43368         val_conv.inner = untag_ptr(val);
43369         val_conv.is_owned = ptr_is_owned(val);
43370         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43371         val_conv = NodeFeatures_clone(&val_conv);
43372         RouteHop_set_node_features(&this_ptr_conv, val_conv);
43373 }
43374
43375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43376         LDKRouteHop this_ptr_conv;
43377         this_ptr_conv.inner = untag_ptr(this_ptr);
43378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43380         this_ptr_conv.is_owned = false;
43381         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
43382         return ret_conv;
43383 }
43384
43385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43386         LDKRouteHop this_ptr_conv;
43387         this_ptr_conv.inner = untag_ptr(this_ptr);
43388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43390         this_ptr_conv.is_owned = false;
43391         RouteHop_set_short_channel_id(&this_ptr_conv, val);
43392 }
43393
43394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43395         LDKRouteHop this_ptr_conv;
43396         this_ptr_conv.inner = untag_ptr(this_ptr);
43397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43399         this_ptr_conv.is_owned = false;
43400         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
43401         int64_t ret_ref = 0;
43402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43404         return ret_ref;
43405 }
43406
43407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43408         LDKRouteHop this_ptr_conv;
43409         this_ptr_conv.inner = untag_ptr(this_ptr);
43410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43412         this_ptr_conv.is_owned = false;
43413         LDKChannelFeatures val_conv;
43414         val_conv.inner = untag_ptr(val);
43415         val_conv.is_owned = ptr_is_owned(val);
43416         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43417         val_conv = ChannelFeatures_clone(&val_conv);
43418         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
43419 }
43420
43421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43422         LDKRouteHop this_ptr_conv;
43423         this_ptr_conv.inner = untag_ptr(this_ptr);
43424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43426         this_ptr_conv.is_owned = false;
43427         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
43428         return ret_conv;
43429 }
43430
43431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43432         LDKRouteHop this_ptr_conv;
43433         this_ptr_conv.inner = untag_ptr(this_ptr);
43434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43436         this_ptr_conv.is_owned = false;
43437         RouteHop_set_fee_msat(&this_ptr_conv, val);
43438 }
43439
43440 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43441         LDKRouteHop this_ptr_conv;
43442         this_ptr_conv.inner = untag_ptr(this_ptr);
43443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43445         this_ptr_conv.is_owned = false;
43446         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
43447         return ret_conv;
43448 }
43449
43450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43451         LDKRouteHop this_ptr_conv;
43452         this_ptr_conv.inner = untag_ptr(this_ptr);
43453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43455         this_ptr_conv.is_owned = false;
43456         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43457 }
43458
43459 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) {
43460         LDKPublicKey pubkey_arg_ref;
43461         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
43462         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
43463         LDKNodeFeatures node_features_arg_conv;
43464         node_features_arg_conv.inner = untag_ptr(node_features_arg);
43465         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
43467         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
43468         LDKChannelFeatures channel_features_arg_conv;
43469         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
43470         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
43471         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
43472         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
43473         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);
43474         int64_t ret_ref = 0;
43475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43477         return ret_ref;
43478 }
43479
43480 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
43481         LDKRouteHop ret_var = RouteHop_clone(arg);
43482         int64_t ret_ref = 0;
43483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43485         return ret_ref;
43486 }
43487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43488         LDKRouteHop arg_conv;
43489         arg_conv.inner = untag_ptr(arg);
43490         arg_conv.is_owned = ptr_is_owned(arg);
43491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43492         arg_conv.is_owned = false;
43493         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
43494         return ret_conv;
43495 }
43496
43497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43498         LDKRouteHop orig_conv;
43499         orig_conv.inner = untag_ptr(orig);
43500         orig_conv.is_owned = ptr_is_owned(orig);
43501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43502         orig_conv.is_owned = false;
43503         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
43504         int64_t ret_ref = 0;
43505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43507         return ret_ref;
43508 }
43509
43510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
43511         LDKRouteHop o_conv;
43512         o_conv.inner = untag_ptr(o);
43513         o_conv.is_owned = ptr_is_owned(o);
43514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43515         o_conv.is_owned = false;
43516         int64_t ret_conv = RouteHop_hash(&o_conv);
43517         return ret_conv;
43518 }
43519
43520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43521         LDKRouteHop a_conv;
43522         a_conv.inner = untag_ptr(a);
43523         a_conv.is_owned = ptr_is_owned(a);
43524         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43525         a_conv.is_owned = false;
43526         LDKRouteHop b_conv;
43527         b_conv.inner = untag_ptr(b);
43528         b_conv.is_owned = ptr_is_owned(b);
43529         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43530         b_conv.is_owned = false;
43531         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
43532         return ret_conv;
43533 }
43534
43535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
43536         LDKRouteHop obj_conv;
43537         obj_conv.inner = untag_ptr(obj);
43538         obj_conv.is_owned = ptr_is_owned(obj);
43539         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43540         obj_conv.is_owned = false;
43541         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
43542         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43543         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43544         CVec_u8Z_free(ret_var);
43545         return ret_arr;
43546 }
43547
43548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43549         LDKu8slice ser_ref;
43550         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43551         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43552         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
43553         *ret_conv = RouteHop_read(ser_ref);
43554         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43555         return tag_ptr(ret_conv, true);
43556 }
43557
43558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43559         LDKRoute this_obj_conv;
43560         this_obj_conv.inner = untag_ptr(this_obj);
43561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43563         Route_free(this_obj_conv);
43564 }
43565
43566 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43567         LDKRoute this_ptr_conv;
43568         this_ptr_conv.inner = untag_ptr(this_ptr);
43569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43571         this_ptr_conv.is_owned = false;
43572         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
43573         jobjectArray ret_arr = NULL;
43574         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
43575         ;
43576         for (size_t m = 0; m < ret_var.datalen; m++) {
43577                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
43578                 int64_tArray ret_conv_12_arr = NULL;
43579                 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
43580                 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
43581                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
43582                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
43583                         int64_t ret_conv_12_conv_10_ref = 0;
43584                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
43585                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
43586                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
43587                 }
43588                 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
43589                 FREE(ret_conv_12_var.data);
43590                 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
43591         }
43592         
43593         FREE(ret_var.data);
43594         return ret_arr;
43595 }
43596
43597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
43598         LDKRoute this_ptr_conv;
43599         this_ptr_conv.inner = untag_ptr(this_ptr);
43600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43602         this_ptr_conv.is_owned = false;
43603         LDKCVec_CVec_RouteHopZZ val_constr;
43604         val_constr.datalen = (*env)->GetArrayLength(env, val);
43605         if (val_constr.datalen > 0)
43606                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43607         else
43608                 val_constr.data = NULL;
43609         for (size_t m = 0; m < val_constr.datalen; m++) {
43610                 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
43611                 LDKCVec_RouteHopZ val_conv_12_constr;
43612                 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
43613                 if (val_conv_12_constr.datalen > 0)
43614                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43615                 else
43616                         val_conv_12_constr.data = NULL;
43617                 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
43618                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
43619                         int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
43620                         LDKRouteHop val_conv_12_conv_10_conv;
43621                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
43622                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
43623                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
43624                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
43625                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
43626                 }
43627                 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
43628                 val_constr.data[m] = val_conv_12_constr;
43629         }
43630         Route_set_paths(&this_ptr_conv, val_constr);
43631 }
43632
43633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43634         LDKRoute this_ptr_conv;
43635         this_ptr_conv.inner = untag_ptr(this_ptr);
43636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43638         this_ptr_conv.is_owned = false;
43639         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
43640         int64_t ret_ref = 0;
43641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43643         return ret_ref;
43644 }
43645
43646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43647         LDKRoute this_ptr_conv;
43648         this_ptr_conv.inner = untag_ptr(this_ptr);
43649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43651         this_ptr_conv.is_owned = false;
43652         LDKPaymentParameters val_conv;
43653         val_conv.inner = untag_ptr(val);
43654         val_conv.is_owned = ptr_is_owned(val);
43655         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43656         val_conv = PaymentParameters_clone(&val_conv);
43657         Route_set_payment_params(&this_ptr_conv, val_conv);
43658 }
43659
43660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
43661         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
43662         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
43663         if (paths_arg_constr.datalen > 0)
43664                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43665         else
43666                 paths_arg_constr.data = NULL;
43667         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
43668                 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
43669                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
43670                 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
43671                 if (paths_arg_conv_12_constr.datalen > 0)
43672                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43673                 else
43674                         paths_arg_conv_12_constr.data = NULL;
43675                 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
43676                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
43677                         int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
43678                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
43679                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
43680                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
43681                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
43682                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
43683                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
43684                 }
43685                 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
43686                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
43687         }
43688         LDKPaymentParameters payment_params_arg_conv;
43689         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
43690         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
43691         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
43692         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
43693         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
43694         int64_t ret_ref = 0;
43695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43697         return ret_ref;
43698 }
43699
43700 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
43701         LDKRoute ret_var = Route_clone(arg);
43702         int64_t ret_ref = 0;
43703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43705         return ret_ref;
43706 }
43707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43708         LDKRoute arg_conv;
43709         arg_conv.inner = untag_ptr(arg);
43710         arg_conv.is_owned = ptr_is_owned(arg);
43711         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43712         arg_conv.is_owned = false;
43713         int64_t ret_conv = Route_clone_ptr(&arg_conv);
43714         return ret_conv;
43715 }
43716
43717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43718         LDKRoute orig_conv;
43719         orig_conv.inner = untag_ptr(orig);
43720         orig_conv.is_owned = ptr_is_owned(orig);
43721         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43722         orig_conv.is_owned = false;
43723         LDKRoute ret_var = Route_clone(&orig_conv);
43724         int64_t ret_ref = 0;
43725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43727         return ret_ref;
43728 }
43729
43730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
43731         LDKRoute o_conv;
43732         o_conv.inner = untag_ptr(o);
43733         o_conv.is_owned = ptr_is_owned(o);
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43735         o_conv.is_owned = false;
43736         int64_t ret_conv = Route_hash(&o_conv);
43737         return ret_conv;
43738 }
43739
43740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43741         LDKRoute a_conv;
43742         a_conv.inner = untag_ptr(a);
43743         a_conv.is_owned = ptr_is_owned(a);
43744         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43745         a_conv.is_owned = false;
43746         LDKRoute b_conv;
43747         b_conv.inner = untag_ptr(b);
43748         b_conv.is_owned = ptr_is_owned(b);
43749         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43750         b_conv.is_owned = false;
43751         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
43752         return ret_conv;
43753 }
43754
43755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
43756         LDKRoute this_arg_conv;
43757         this_arg_conv.inner = untag_ptr(this_arg);
43758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43760         this_arg_conv.is_owned = false;
43761         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
43762         return ret_conv;
43763 }
43764
43765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
43766         LDKRoute this_arg_conv;
43767         this_arg_conv.inner = untag_ptr(this_arg);
43768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43770         this_arg_conv.is_owned = false;
43771         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
43772         return ret_conv;
43773 }
43774
43775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
43776         LDKRoute obj_conv;
43777         obj_conv.inner = untag_ptr(obj);
43778         obj_conv.is_owned = ptr_is_owned(obj);
43779         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43780         obj_conv.is_owned = false;
43781         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
43782         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43783         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43784         CVec_u8Z_free(ret_var);
43785         return ret_arr;
43786 }
43787
43788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43789         LDKu8slice ser_ref;
43790         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43791         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43792         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
43793         *ret_conv = Route_read(ser_ref);
43794         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43795         return tag_ptr(ret_conv, true);
43796 }
43797
43798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43799         LDKRouteParameters this_obj_conv;
43800         this_obj_conv.inner = untag_ptr(this_obj);
43801         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43803         RouteParameters_free(this_obj_conv);
43804 }
43805
43806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
43807         LDKRouteParameters this_ptr_conv;
43808         this_ptr_conv.inner = untag_ptr(this_ptr);
43809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43811         this_ptr_conv.is_owned = false;
43812         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
43813         int64_t ret_ref = 0;
43814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43816         return ret_ref;
43817 }
43818
43819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43820         LDKRouteParameters this_ptr_conv;
43821         this_ptr_conv.inner = untag_ptr(this_ptr);
43822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43824         this_ptr_conv.is_owned = false;
43825         LDKPaymentParameters val_conv;
43826         val_conv.inner = untag_ptr(val);
43827         val_conv.is_owned = ptr_is_owned(val);
43828         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43829         val_conv = PaymentParameters_clone(&val_conv);
43830         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
43831 }
43832
43833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43834         LDKRouteParameters this_ptr_conv;
43835         this_ptr_conv.inner = untag_ptr(this_ptr);
43836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43838         this_ptr_conv.is_owned = false;
43839         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
43840         return ret_conv;
43841 }
43842
43843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43844         LDKRouteParameters this_ptr_conv;
43845         this_ptr_conv.inner = untag_ptr(this_ptr);
43846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43848         this_ptr_conv.is_owned = false;
43849         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
43850 }
43851
43852 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43853         LDKRouteParameters this_ptr_conv;
43854         this_ptr_conv.inner = untag_ptr(this_ptr);
43855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43857         this_ptr_conv.is_owned = false;
43858         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
43859         return ret_conv;
43860 }
43861
43862 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) {
43863         LDKRouteParameters this_ptr_conv;
43864         this_ptr_conv.inner = untag_ptr(this_ptr);
43865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43867         this_ptr_conv.is_owned = false;
43868         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
43869 }
43870
43871 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) {
43872         LDKPaymentParameters payment_params_arg_conv;
43873         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
43874         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
43875         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
43876         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
43877         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
43878         int64_t ret_ref = 0;
43879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43881         return ret_ref;
43882 }
43883
43884 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
43885         LDKRouteParameters ret_var = RouteParameters_clone(arg);
43886         int64_t ret_ref = 0;
43887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43889         return ret_ref;
43890 }
43891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43892         LDKRouteParameters arg_conv;
43893         arg_conv.inner = untag_ptr(arg);
43894         arg_conv.is_owned = ptr_is_owned(arg);
43895         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43896         arg_conv.is_owned = false;
43897         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
43898         return ret_conv;
43899 }
43900
43901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43902         LDKRouteParameters orig_conv;
43903         orig_conv.inner = untag_ptr(orig);
43904         orig_conv.is_owned = ptr_is_owned(orig);
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43906         orig_conv.is_owned = false;
43907         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
43908         int64_t ret_ref = 0;
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43911         return ret_ref;
43912 }
43913
43914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
43915         LDKRouteParameters obj_conv;
43916         obj_conv.inner = untag_ptr(obj);
43917         obj_conv.is_owned = ptr_is_owned(obj);
43918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43919         obj_conv.is_owned = false;
43920         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
43921         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43922         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43923         CVec_u8Z_free(ret_var);
43924         return ret_arr;
43925 }
43926
43927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43928         LDKu8slice ser_ref;
43929         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43930         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43931         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
43932         *ret_conv = RouteParameters_read(ser_ref);
43933         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43934         return tag_ptr(ret_conv, true);
43935 }
43936
43937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43938         LDKPaymentParameters this_obj_conv;
43939         this_obj_conv.inner = untag_ptr(this_obj);
43940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43942         PaymentParameters_free(this_obj_conv);
43943 }
43944
43945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43946         LDKPaymentParameters this_ptr_conv;
43947         this_ptr_conv.inner = untag_ptr(this_ptr);
43948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43950         this_ptr_conv.is_owned = false;
43951         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43952         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
43953         return ret_arr;
43954 }
43955
43956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43957         LDKPaymentParameters this_ptr_conv;
43958         this_ptr_conv.inner = untag_ptr(this_ptr);
43959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43961         this_ptr_conv.is_owned = false;
43962         LDKPublicKey val_ref;
43963         CHECK((*env)->GetArrayLength(env, val) == 33);
43964         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43965         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
43966 }
43967
43968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
43969         LDKPaymentParameters this_ptr_conv;
43970         this_ptr_conv.inner = untag_ptr(this_ptr);
43971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43973         this_ptr_conv.is_owned = false;
43974         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
43975         int64_t ret_ref = 0;
43976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43978         return ret_ref;
43979 }
43980
43981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43982         LDKPaymentParameters this_ptr_conv;
43983         this_ptr_conv.inner = untag_ptr(this_ptr);
43984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43986         this_ptr_conv.is_owned = false;
43987         LDKInvoiceFeatures val_conv;
43988         val_conv.inner = untag_ptr(val);
43989         val_conv.is_owned = ptr_is_owned(val);
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43991         val_conv = InvoiceFeatures_clone(&val_conv);
43992         PaymentParameters_set_features(&this_ptr_conv, val_conv);
43993 }
43994
43995 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
43996         LDKPaymentParameters this_ptr_conv;
43997         this_ptr_conv.inner = untag_ptr(this_ptr);
43998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44000         this_ptr_conv.is_owned = false;
44001         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
44002         int64_tArray ret_arr = NULL;
44003         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44004         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44005         for (size_t l = 0; l < ret_var.datalen; l++) {
44006                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44007                 int64_t ret_conv_11_ref = 0;
44008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44009                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
44010                 ret_arr_ptr[l] = ret_conv_11_ref;
44011         }
44012         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44013         FREE(ret_var.data);
44014         return ret_arr;
44015 }
44016
44017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44018         LDKPaymentParameters this_ptr_conv;
44019         this_ptr_conv.inner = untag_ptr(this_ptr);
44020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44022         this_ptr_conv.is_owned = false;
44023         LDKCVec_RouteHintZ val_constr;
44024         val_constr.datalen = (*env)->GetArrayLength(env, val);
44025         if (val_constr.datalen > 0)
44026                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44027         else
44028                 val_constr.data = NULL;
44029         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44030         for (size_t l = 0; l < val_constr.datalen; l++) {
44031                 int64_t val_conv_11 = val_vals[l];
44032                 LDKRouteHint val_conv_11_conv;
44033                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
44034                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
44035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
44036                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
44037                 val_constr.data[l] = val_conv_11_conv;
44038         }
44039         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44040         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
44041 }
44042
44043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
44044         LDKPaymentParameters this_ptr_conv;
44045         this_ptr_conv.inner = untag_ptr(this_ptr);
44046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44048         this_ptr_conv.is_owned = false;
44049         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44050         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
44051         int64_t ret_ref = tag_ptr(ret_copy, true);
44052         return ret_ref;
44053 }
44054
44055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44056         LDKPaymentParameters this_ptr_conv;
44057         this_ptr_conv.inner = untag_ptr(this_ptr);
44058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44060         this_ptr_conv.is_owned = false;
44061         void* val_ptr = untag_ptr(val);
44062         CHECK_ACCESS(val_ptr);
44063         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44064         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44065         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
44066 }
44067
44068 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44069         LDKPaymentParameters this_ptr_conv;
44070         this_ptr_conv.inner = untag_ptr(this_ptr);
44071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44073         this_ptr_conv.is_owned = false;
44074         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
44075         return ret_conv;
44076 }
44077
44078 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) {
44079         LDKPaymentParameters this_ptr_conv;
44080         this_ptr_conv.inner = untag_ptr(this_ptr);
44081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44083         this_ptr_conv.is_owned = false;
44084         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
44085 }
44086
44087 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
44088         LDKPaymentParameters this_ptr_conv;
44089         this_ptr_conv.inner = untag_ptr(this_ptr);
44090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44092         this_ptr_conv.is_owned = false;
44093         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
44094         return ret_conv;
44095 }
44096
44097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
44098         LDKPaymentParameters this_ptr_conv;
44099         this_ptr_conv.inner = untag_ptr(this_ptr);
44100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44102         this_ptr_conv.is_owned = false;
44103         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
44104 }
44105
44106 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) {
44107         LDKPaymentParameters this_ptr_conv;
44108         this_ptr_conv.inner = untag_ptr(this_ptr);
44109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44111         this_ptr_conv.is_owned = false;
44112         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
44113         return ret_conv;
44114 }
44115
44116 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) {
44117         LDKPaymentParameters this_ptr_conv;
44118         this_ptr_conv.inner = untag_ptr(this_ptr);
44119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44121         this_ptr_conv.is_owned = false;
44122         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
44123 }
44124
44125 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
44126         LDKPaymentParameters this_ptr_conv;
44127         this_ptr_conv.inner = untag_ptr(this_ptr);
44128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44130         this_ptr_conv.is_owned = false;
44131         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
44132         int64_tArray ret_arr = NULL;
44133         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44134         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44135         for (size_t g = 0; g < ret_var.datalen; g++) {
44136                 int64_t ret_conv_6_conv = ret_var.data[g];
44137                 ret_arr_ptr[g] = ret_conv_6_conv;
44138         }
44139         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44140         FREE(ret_var.data);
44141         return ret_arr;
44142 }
44143
44144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44145         LDKPaymentParameters this_ptr_conv;
44146         this_ptr_conv.inner = untag_ptr(this_ptr);
44147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44149         this_ptr_conv.is_owned = false;
44150         LDKCVec_u64Z val_constr;
44151         val_constr.datalen = (*env)->GetArrayLength(env, val);
44152         if (val_constr.datalen > 0)
44153                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44154         else
44155                 val_constr.data = NULL;
44156         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44157         for (size_t g = 0; g < val_constr.datalen; g++) {
44158                 int64_t val_conv_6 = val_vals[g];
44159                 val_constr.data[g] = val_conv_6;
44160         }
44161         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44162         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
44163 }
44164
44165 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) {
44166         LDKPublicKey payee_pubkey_arg_ref;
44167         CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
44168         (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
44169         LDKInvoiceFeatures features_arg_conv;
44170         features_arg_conv.inner = untag_ptr(features_arg);
44171         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44172         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44173         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
44174         LDKCVec_RouteHintZ route_hints_arg_constr;
44175         route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
44176         if (route_hints_arg_constr.datalen > 0)
44177                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44178         else
44179                 route_hints_arg_constr.data = NULL;
44180         int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
44181         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
44182                 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
44183                 LDKRouteHint route_hints_arg_conv_11_conv;
44184                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
44185                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
44186                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
44187                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
44188                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
44189         }
44190         (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
44191         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
44192         CHECK_ACCESS(expiry_time_arg_ptr);
44193         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
44194         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
44195         LDKCVec_u64Z previously_failed_channels_arg_constr;
44196         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
44197         if (previously_failed_channels_arg_constr.datalen > 0)
44198                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44199         else
44200                 previously_failed_channels_arg_constr.data = NULL;
44201         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
44202         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
44203                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
44204                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
44205         }
44206         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
44207         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);
44208         int64_t ret_ref = 0;
44209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44211         return ret_ref;
44212 }
44213
44214 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
44215         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
44216         int64_t ret_ref = 0;
44217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44219         return ret_ref;
44220 }
44221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44222         LDKPaymentParameters arg_conv;
44223         arg_conv.inner = untag_ptr(arg);
44224         arg_conv.is_owned = ptr_is_owned(arg);
44225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44226         arg_conv.is_owned = false;
44227         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
44228         return ret_conv;
44229 }
44230
44231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44232         LDKPaymentParameters orig_conv;
44233         orig_conv.inner = untag_ptr(orig);
44234         orig_conv.is_owned = ptr_is_owned(orig);
44235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44236         orig_conv.is_owned = false;
44237         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
44238         int64_t ret_ref = 0;
44239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44241         return ret_ref;
44242 }
44243
44244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
44245         LDKPaymentParameters o_conv;
44246         o_conv.inner = untag_ptr(o);
44247         o_conv.is_owned = ptr_is_owned(o);
44248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44249         o_conv.is_owned = false;
44250         int64_t ret_conv = PaymentParameters_hash(&o_conv);
44251         return ret_conv;
44252 }
44253
44254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44255         LDKPaymentParameters a_conv;
44256         a_conv.inner = untag_ptr(a);
44257         a_conv.is_owned = ptr_is_owned(a);
44258         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44259         a_conv.is_owned = false;
44260         LDKPaymentParameters b_conv;
44261         b_conv.inner = untag_ptr(b);
44262         b_conv.is_owned = ptr_is_owned(b);
44263         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44264         b_conv.is_owned = false;
44265         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
44266         return ret_conv;
44267 }
44268
44269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
44270         LDKPaymentParameters obj_conv;
44271         obj_conv.inner = untag_ptr(obj);
44272         obj_conv.is_owned = ptr_is_owned(obj);
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44274         obj_conv.is_owned = false;
44275         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
44276         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44277         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44278         CVec_u8Z_free(ret_var);
44279         return ret_arr;
44280 }
44281
44282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44283         LDKu8slice ser_ref;
44284         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44285         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44286         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
44287         *ret_conv = PaymentParameters_read(ser_ref);
44288         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44289         return tag_ptr(ret_conv, true);
44290 }
44291
44292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44293         LDKPublicKey payee_pubkey_ref;
44294         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44295         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44296         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
44297         int64_t ret_ref = 0;
44298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44300         return ret_ref;
44301 }
44302
44303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
44304         LDKPublicKey payee_pubkey_ref;
44305         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
44306         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
44307         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
44308         int64_t ret_ref = 0;
44309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44311         return ret_ref;
44312 }
44313
44314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44315         LDKRouteHint this_obj_conv;
44316         this_obj_conv.inner = untag_ptr(this_obj);
44317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44319         RouteHint_free(this_obj_conv);
44320 }
44321
44322 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44323         LDKRouteHint 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         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
44329         int64_tArray ret_arr = NULL;
44330         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44331         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44332         for (size_t o = 0; o < ret_var.datalen; o++) {
44333                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
44334                 int64_t ret_conv_14_ref = 0;
44335                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44336                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
44337                 ret_arr_ptr[o] = ret_conv_14_ref;
44338         }
44339         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44340         FREE(ret_var.data);
44341         return ret_arr;
44342 }
44343
44344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
44345         LDKRouteHint this_ptr_conv;
44346         this_ptr_conv.inner = untag_ptr(this_ptr);
44347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44349         this_ptr_conv.is_owned = false;
44350         LDKCVec_RouteHintHopZ val_constr;
44351         val_constr.datalen = (*env)->GetArrayLength(env, val);
44352         if (val_constr.datalen > 0)
44353                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44354         else
44355                 val_constr.data = NULL;
44356         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
44357         for (size_t o = 0; o < val_constr.datalen; o++) {
44358                 int64_t val_conv_14 = val_vals[o];
44359                 LDKRouteHintHop val_conv_14_conv;
44360                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
44361                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
44362                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
44363                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
44364                 val_constr.data[o] = val_conv_14_conv;
44365         }
44366         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
44367         RouteHint_set_a(&this_ptr_conv, val_constr);
44368 }
44369
44370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
44371         LDKCVec_RouteHintHopZ a_arg_constr;
44372         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
44373         if (a_arg_constr.datalen > 0)
44374                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44375         else
44376                 a_arg_constr.data = NULL;
44377         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
44378         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
44379                 int64_t a_arg_conv_14 = a_arg_vals[o];
44380                 LDKRouteHintHop a_arg_conv_14_conv;
44381                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
44382                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
44383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
44384                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
44385                 a_arg_constr.data[o] = a_arg_conv_14_conv;
44386         }
44387         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
44388         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
44389         int64_t ret_ref = 0;
44390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44392         return ret_ref;
44393 }
44394
44395 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
44396         LDKRouteHint ret_var = RouteHint_clone(arg);
44397         int64_t ret_ref = 0;
44398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44400         return ret_ref;
44401 }
44402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44403         LDKRouteHint arg_conv;
44404         arg_conv.inner = untag_ptr(arg);
44405         arg_conv.is_owned = ptr_is_owned(arg);
44406         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44407         arg_conv.is_owned = false;
44408         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
44409         return ret_conv;
44410 }
44411
44412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44413         LDKRouteHint orig_conv;
44414         orig_conv.inner = untag_ptr(orig);
44415         orig_conv.is_owned = ptr_is_owned(orig);
44416         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44417         orig_conv.is_owned = false;
44418         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
44419         int64_t ret_ref = 0;
44420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44422         return ret_ref;
44423 }
44424
44425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
44426         LDKRouteHint o_conv;
44427         o_conv.inner = untag_ptr(o);
44428         o_conv.is_owned = ptr_is_owned(o);
44429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44430         o_conv.is_owned = false;
44431         int64_t ret_conv = RouteHint_hash(&o_conv);
44432         return ret_conv;
44433 }
44434
44435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44436         LDKRouteHint a_conv;
44437         a_conv.inner = untag_ptr(a);
44438         a_conv.is_owned = ptr_is_owned(a);
44439         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44440         a_conv.is_owned = false;
44441         LDKRouteHint b_conv;
44442         b_conv.inner = untag_ptr(b);
44443         b_conv.is_owned = ptr_is_owned(b);
44444         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44445         b_conv.is_owned = false;
44446         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
44447         return ret_conv;
44448 }
44449
44450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
44451         LDKRouteHint obj_conv;
44452         obj_conv.inner = untag_ptr(obj);
44453         obj_conv.is_owned = ptr_is_owned(obj);
44454         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44455         obj_conv.is_owned = false;
44456         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
44457         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44458         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44459         CVec_u8Z_free(ret_var);
44460         return ret_arr;
44461 }
44462
44463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44464         LDKu8slice ser_ref;
44465         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44466         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44467         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
44468         *ret_conv = RouteHint_read(ser_ref);
44469         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44470         return tag_ptr(ret_conv, true);
44471 }
44472
44473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44474         LDKRouteHintHop this_obj_conv;
44475         this_obj_conv.inner = untag_ptr(this_obj);
44476         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44478         RouteHintHop_free(this_obj_conv);
44479 }
44480
44481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44482         LDKRouteHintHop this_ptr_conv;
44483         this_ptr_conv.inner = untag_ptr(this_ptr);
44484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44486         this_ptr_conv.is_owned = false;
44487         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44488         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
44489         return ret_arr;
44490 }
44491
44492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44493         LDKRouteHintHop this_ptr_conv;
44494         this_ptr_conv.inner = untag_ptr(this_ptr);
44495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44497         this_ptr_conv.is_owned = false;
44498         LDKPublicKey val_ref;
44499         CHECK((*env)->GetArrayLength(env, val) == 33);
44500         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44501         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
44502 }
44503
44504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44505         LDKRouteHintHop this_ptr_conv;
44506         this_ptr_conv.inner = untag_ptr(this_ptr);
44507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44509         this_ptr_conv.is_owned = false;
44510         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
44511         return ret_conv;
44512 }
44513
44514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44515         LDKRouteHintHop this_ptr_conv;
44516         this_ptr_conv.inner = untag_ptr(this_ptr);
44517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44519         this_ptr_conv.is_owned = false;
44520         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
44521 }
44522
44523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
44524         LDKRouteHintHop this_ptr_conv;
44525         this_ptr_conv.inner = untag_ptr(this_ptr);
44526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44528         this_ptr_conv.is_owned = false;
44529         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
44530         int64_t ret_ref = 0;
44531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44533         return ret_ref;
44534 }
44535
44536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44537         LDKRouteHintHop this_ptr_conv;
44538         this_ptr_conv.inner = untag_ptr(this_ptr);
44539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44541         this_ptr_conv.is_owned = false;
44542         LDKRoutingFees val_conv;
44543         val_conv.inner = untag_ptr(val);
44544         val_conv.is_owned = ptr_is_owned(val);
44545         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44546         val_conv = RoutingFees_clone(&val_conv);
44547         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
44548 }
44549
44550 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
44551         LDKRouteHintHop this_ptr_conv;
44552         this_ptr_conv.inner = untag_ptr(this_ptr);
44553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44555         this_ptr_conv.is_owned = false;
44556         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
44557         return ret_conv;
44558 }
44559
44560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44561         LDKRouteHintHop this_ptr_conv;
44562         this_ptr_conv.inner = untag_ptr(this_ptr);
44563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44565         this_ptr_conv.is_owned = false;
44566         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
44567 }
44568
44569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44570         LDKRouteHintHop this_ptr_conv;
44571         this_ptr_conv.inner = untag_ptr(this_ptr);
44572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44574         this_ptr_conv.is_owned = false;
44575         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44576         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
44577         int64_t ret_ref = tag_ptr(ret_copy, true);
44578         return ret_ref;
44579 }
44580
44581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44582         LDKRouteHintHop this_ptr_conv;
44583         this_ptr_conv.inner = untag_ptr(this_ptr);
44584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44586         this_ptr_conv.is_owned = false;
44587         void* val_ptr = untag_ptr(val);
44588         CHECK_ACCESS(val_ptr);
44589         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44590         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44591         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
44592 }
44593
44594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44595         LDKRouteHintHop this_ptr_conv;
44596         this_ptr_conv.inner = untag_ptr(this_ptr);
44597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44599         this_ptr_conv.is_owned = false;
44600         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44601         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
44602         int64_t ret_ref = tag_ptr(ret_copy, true);
44603         return ret_ref;
44604 }
44605
44606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44607         LDKRouteHintHop this_ptr_conv;
44608         this_ptr_conv.inner = untag_ptr(this_ptr);
44609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44611         this_ptr_conv.is_owned = false;
44612         void* val_ptr = untag_ptr(val);
44613         CHECK_ACCESS(val_ptr);
44614         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44615         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44616         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
44617 }
44618
44619 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) {
44620         LDKPublicKey src_node_id_arg_ref;
44621         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
44622         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
44623         LDKRoutingFees fees_arg_conv;
44624         fees_arg_conv.inner = untag_ptr(fees_arg);
44625         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
44626         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
44627         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
44628         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
44629         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
44630         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
44631         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
44632         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
44633         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
44634         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
44635         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
44636         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);
44637         int64_t ret_ref = 0;
44638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44640         return ret_ref;
44641 }
44642
44643 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
44644         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
44645         int64_t ret_ref = 0;
44646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44648         return ret_ref;
44649 }
44650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44651         LDKRouteHintHop arg_conv;
44652         arg_conv.inner = untag_ptr(arg);
44653         arg_conv.is_owned = ptr_is_owned(arg);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44655         arg_conv.is_owned = false;
44656         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
44657         return ret_conv;
44658 }
44659
44660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44661         LDKRouteHintHop orig_conv;
44662         orig_conv.inner = untag_ptr(orig);
44663         orig_conv.is_owned = ptr_is_owned(orig);
44664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44665         orig_conv.is_owned = false;
44666         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
44667         int64_t ret_ref = 0;
44668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44670         return ret_ref;
44671 }
44672
44673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
44674         LDKRouteHintHop o_conv;
44675         o_conv.inner = untag_ptr(o);
44676         o_conv.is_owned = ptr_is_owned(o);
44677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44678         o_conv.is_owned = false;
44679         int64_t ret_conv = RouteHintHop_hash(&o_conv);
44680         return ret_conv;
44681 }
44682
44683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44684         LDKRouteHintHop a_conv;
44685         a_conv.inner = untag_ptr(a);
44686         a_conv.is_owned = ptr_is_owned(a);
44687         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44688         a_conv.is_owned = false;
44689         LDKRouteHintHop b_conv;
44690         b_conv.inner = untag_ptr(b);
44691         b_conv.is_owned = ptr_is_owned(b);
44692         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44693         b_conv.is_owned = false;
44694         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
44695         return ret_conv;
44696 }
44697
44698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
44699         LDKRouteHintHop obj_conv;
44700         obj_conv.inner = untag_ptr(obj);
44701         obj_conv.is_owned = ptr_is_owned(obj);
44702         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44703         obj_conv.is_owned = false;
44704         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
44705         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44706         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44707         CVec_u8Z_free(ret_var);
44708         return ret_arr;
44709 }
44710
44711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44712         LDKu8slice ser_ref;
44713         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44714         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44715         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
44716         *ret_conv = RouteHintHop_read(ser_ref);
44717         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44718         return tag_ptr(ret_conv, true);
44719 }
44720
44721 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) {
44722         LDKPublicKey our_node_pubkey_ref;
44723         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44724         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44725         LDKRouteParameters route_params_conv;
44726         route_params_conv.inner = untag_ptr(route_params);
44727         route_params_conv.is_owned = ptr_is_owned(route_params);
44728         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44729         route_params_conv.is_owned = false;
44730         LDKNetworkGraph network_graph_conv;
44731         network_graph_conv.inner = untag_ptr(network_graph);
44732         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44733         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44734         network_graph_conv.is_owned = false;
44735         LDKCVec_ChannelDetailsZ first_hops_constr;
44736         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
44737         if (first_hops != NULL) {
44738                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
44739                 if (first_hops_constr.datalen > 0)
44740                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
44741                 else
44742                         first_hops_constr.data = NULL;
44743                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
44744                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
44745                         int64_t first_hops_conv_16 = first_hops_vals[q];
44746                         LDKChannelDetails first_hops_conv_16_conv;
44747                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
44748                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
44749                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
44750                         first_hops_conv_16_conv.is_owned = false;
44751                         first_hops_constr.data[q] = first_hops_conv_16_conv;
44752                 }
44753                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
44754                 first_hops_ptr = &first_hops_constr;
44755         }
44756         void* logger_ptr = untag_ptr(logger);
44757         CHECK_ACCESS(logger_ptr);
44758         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44759         if (logger_conv.free == LDKLogger_JCalls_free) {
44760                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44761                 LDKLogger_JCalls_cloned(&logger_conv);
44762         }
44763         void* scorer_ptr = untag_ptr(scorer);
44764         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
44765         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
44766         unsigned char random_seed_bytes_arr[32];
44767         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44768         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44769         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44770         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44771         *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);
44772         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
44773         return tag_ptr(ret_conv, true);
44774 }
44775
44776 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) {
44777         LDKPublicKey our_node_pubkey_ref;
44778         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
44779         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
44780         LDKCVec_PublicKeyZ hops_constr;
44781         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
44782         if (hops_constr.datalen > 0)
44783                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
44784         else
44785                 hops_constr.data = NULL;
44786         for (size_t i = 0; i < hops_constr.datalen; i++) {
44787                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
44788                 LDKPublicKey hops_conv_8_ref;
44789                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
44790                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
44791                 hops_constr.data[i] = hops_conv_8_ref;
44792         }
44793         LDKRouteParameters route_params_conv;
44794         route_params_conv.inner = untag_ptr(route_params);
44795         route_params_conv.is_owned = ptr_is_owned(route_params);
44796         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
44797         route_params_conv.is_owned = false;
44798         LDKNetworkGraph network_graph_conv;
44799         network_graph_conv.inner = untag_ptr(network_graph);
44800         network_graph_conv.is_owned = ptr_is_owned(network_graph);
44801         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
44802         network_graph_conv.is_owned = false;
44803         void* logger_ptr = untag_ptr(logger);
44804         CHECK_ACCESS(logger_ptr);
44805         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44806         if (logger_conv.free == LDKLogger_JCalls_free) {
44807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44808                 LDKLogger_JCalls_cloned(&logger_conv);
44809         }
44810         unsigned char random_seed_bytes_arr[32];
44811         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
44812         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
44813         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
44814         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
44815         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
44816         return tag_ptr(ret_conv, true);
44817 }
44818
44819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44820         if (!ptr_is_owned(this_ptr)) return;
44821         void* this_ptr_ptr = untag_ptr(this_ptr);
44822         CHECK_ACCESS(this_ptr_ptr);
44823         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
44824         FREE(untag_ptr(this_ptr));
44825         Score_free(this_ptr_conv);
44826 }
44827
44828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44829         if (!ptr_is_owned(this_ptr)) return;
44830         void* this_ptr_ptr = untag_ptr(this_ptr);
44831         CHECK_ACCESS(this_ptr_ptr);
44832         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
44833         FREE(untag_ptr(this_ptr));
44834         LockableScore_free(this_ptr_conv);
44835 }
44836
44837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44838         LDKMultiThreadedLockableScore this_obj_conv;
44839         this_obj_conv.inner = untag_ptr(this_obj);
44840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44842         MultiThreadedLockableScore_free(this_obj_conv);
44843 }
44844
44845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
44846         LDKMultiThreadedLockableScore obj_conv;
44847         obj_conv.inner = untag_ptr(obj);
44848         obj_conv.is_owned = ptr_is_owned(obj);
44849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44850         obj_conv.is_owned = false;
44851         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
44852         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44853         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44854         CVec_u8Z_free(ret_var);
44855         return ret_arr;
44856 }
44857
44858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
44859         void* score_ptr = untag_ptr(score);
44860         CHECK_ACCESS(score_ptr);
44861         LDKScore score_conv = *(LDKScore*)(score_ptr);
44862         if (score_conv.free == LDKScore_JCalls_free) {
44863                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44864                 LDKScore_JCalls_cloned(&score_conv);
44865         }
44866         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
44867         int64_t ret_ref = 0;
44868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44870         return ret_ref;
44871 }
44872
44873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44874         LDKChannelUsage 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         ChannelUsage_free(this_obj_conv);
44879 }
44880
44881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44882         LDKChannelUsage 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 = ChannelUsage_get_amount_msat(&this_ptr_conv);
44888         return ret_conv;
44889 }
44890
44891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44892         LDKChannelUsage 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         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
44898 }
44899
44900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44901         LDKChannelUsage 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 = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
44907         return ret_conv;
44908 }
44909
44910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44911         LDKChannelUsage 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         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
44917 }
44918
44919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
44920         LDKChannelUsage 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         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
44926         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
44927         int64_t ret_ref = tag_ptr(ret_copy, true);
44928         return ret_ref;
44929 }
44930
44931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44932         LDKChannelUsage this_ptr_conv;
44933         this_ptr_conv.inner = untag_ptr(this_ptr);
44934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44936         this_ptr_conv.is_owned = false;
44937         void* val_ptr = untag_ptr(val);
44938         CHECK_ACCESS(val_ptr);
44939         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
44940         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
44941         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
44942 }
44943
44944 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) {
44945         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
44946         CHECK_ACCESS(effective_capacity_arg_ptr);
44947         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
44948         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
44949         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
44950         int64_t ret_ref = 0;
44951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44953         return ret_ref;
44954 }
44955
44956 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
44957         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
44958         int64_t ret_ref = 0;
44959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44961         return ret_ref;
44962 }
44963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44964         LDKChannelUsage arg_conv;
44965         arg_conv.inner = untag_ptr(arg);
44966         arg_conv.is_owned = ptr_is_owned(arg);
44967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44968         arg_conv.is_owned = false;
44969         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
44970         return ret_conv;
44971 }
44972
44973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44974         LDKChannelUsage orig_conv;
44975         orig_conv.inner = untag_ptr(orig);
44976         orig_conv.is_owned = ptr_is_owned(orig);
44977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44978         orig_conv.is_owned = false;
44979         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
44980         int64_t ret_ref = 0;
44981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44983         return ret_ref;
44984 }
44985
44986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44987         LDKFixedPenaltyScorer this_obj_conv;
44988         this_obj_conv.inner = untag_ptr(this_obj);
44989         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44991         FixedPenaltyScorer_free(this_obj_conv);
44992 }
44993
44994 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
44995         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
44996         int64_t ret_ref = 0;
44997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44999         return ret_ref;
45000 }
45001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45002         LDKFixedPenaltyScorer arg_conv;
45003         arg_conv.inner = untag_ptr(arg);
45004         arg_conv.is_owned = ptr_is_owned(arg);
45005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45006         arg_conv.is_owned = false;
45007         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
45008         return ret_conv;
45009 }
45010
45011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45012         LDKFixedPenaltyScorer orig_conv;
45013         orig_conv.inner = untag_ptr(orig);
45014         orig_conv.is_owned = ptr_is_owned(orig);
45015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45016         orig_conv.is_owned = false;
45017         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
45018         int64_t ret_ref = 0;
45019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45021         return ret_ref;
45022 }
45023
45024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
45025         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
45026         int64_t ret_ref = 0;
45027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45029         return ret_ref;
45030 }
45031
45032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45033         LDKFixedPenaltyScorer this_arg_conv;
45034         this_arg_conv.inner = untag_ptr(this_arg);
45035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45037         this_arg_conv.is_owned = false;
45038         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45039         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
45040         return tag_ptr(ret_ret, true);
45041 }
45042
45043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45044         LDKFixedPenaltyScorer obj_conv;
45045         obj_conv.inner = untag_ptr(obj);
45046         obj_conv.is_owned = ptr_is_owned(obj);
45047         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45048         obj_conv.is_owned = false;
45049         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
45050         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45051         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45052         CVec_u8Z_free(ret_var);
45053         return ret_arr;
45054 }
45055
45056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
45057         LDKu8slice ser_ref;
45058         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45059         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45060         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
45061         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
45062         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45063         return tag_ptr(ret_conv, true);
45064 }
45065
45066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45067         LDKProbabilisticScorer this_obj_conv;
45068         this_obj_conv.inner = untag_ptr(this_obj);
45069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45071         ProbabilisticScorer_free(this_obj_conv);
45072 }
45073
45074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45075         LDKProbabilisticScoringParameters this_obj_conv;
45076         this_obj_conv.inner = untag_ptr(this_obj);
45077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45079         ProbabilisticScoringParameters_free(this_obj_conv);
45080 }
45081
45082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45083         LDKProbabilisticScoringParameters this_ptr_conv;
45084         this_ptr_conv.inner = untag_ptr(this_ptr);
45085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45087         this_ptr_conv.is_owned = false;
45088         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
45089         return ret_conv;
45090 }
45091
45092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45093         LDKProbabilisticScoringParameters this_ptr_conv;
45094         this_ptr_conv.inner = untag_ptr(this_ptr);
45095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45097         this_ptr_conv.is_owned = false;
45098         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
45099 }
45100
45101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45102         LDKProbabilisticScoringParameters this_ptr_conv;
45103         this_ptr_conv.inner = untag_ptr(this_ptr);
45104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45106         this_ptr_conv.is_owned = false;
45107         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
45108         return ret_conv;
45109 }
45110
45111 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) {
45112         LDKProbabilisticScoringParameters this_ptr_conv;
45113         this_ptr_conv.inner = untag_ptr(this_ptr);
45114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45116         this_ptr_conv.is_owned = false;
45117         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45118 }
45119
45120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45121         LDKProbabilisticScoringParameters this_ptr_conv;
45122         this_ptr_conv.inner = untag_ptr(this_ptr);
45123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45125         this_ptr_conv.is_owned = false;
45126         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45127         return ret_conv;
45128 }
45129
45130 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) {
45131         LDKProbabilisticScoringParameters this_ptr_conv;
45132         this_ptr_conv.inner = untag_ptr(this_ptr);
45133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45135         this_ptr_conv.is_owned = false;
45136         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45137 }
45138
45139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
45140         LDKProbabilisticScoringParameters this_ptr_conv;
45141         this_ptr_conv.inner = untag_ptr(this_ptr);
45142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45144         this_ptr_conv.is_owned = false;
45145         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
45146         return ret_conv;
45147 }
45148
45149 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) {
45150         LDKProbabilisticScoringParameters this_ptr_conv;
45151         this_ptr_conv.inner = untag_ptr(this_ptr);
45152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45154         this_ptr_conv.is_owned = false;
45155         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
45156 }
45157
45158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45159         LDKProbabilisticScoringParameters this_ptr_conv;
45160         this_ptr_conv.inner = untag_ptr(this_ptr);
45161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45163         this_ptr_conv.is_owned = false;
45164         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
45165         return ret_conv;
45166 }
45167
45168 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) {
45169         LDKProbabilisticScoringParameters this_ptr_conv;
45170         this_ptr_conv.inner = untag_ptr(this_ptr);
45171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45173         this_ptr_conv.is_owned = false;
45174         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45175 }
45176
45177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45178         LDKProbabilisticScoringParameters this_ptr_conv;
45179         this_ptr_conv.inner = untag_ptr(this_ptr);
45180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45182         this_ptr_conv.is_owned = false;
45183         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
45184         return ret_conv;
45185 }
45186
45187 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) {
45188         LDKProbabilisticScoringParameters this_ptr_conv;
45189         this_ptr_conv.inner = untag_ptr(this_ptr);
45190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45192         this_ptr_conv.is_owned = false;
45193         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
45194 }
45195
45196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
45197         LDKProbabilisticScoringParameters this_ptr_conv;
45198         this_ptr_conv.inner = untag_ptr(this_ptr);
45199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45201         this_ptr_conv.is_owned = false;
45202         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
45203         return ret_conv;
45204 }
45205
45206 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) {
45207         LDKProbabilisticScoringParameters this_ptr_conv;
45208         this_ptr_conv.inner = untag_ptr(this_ptr);
45209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45211         this_ptr_conv.is_owned = false;
45212         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
45213 }
45214
45215 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
45216         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
45217         int64_t ret_ref = 0;
45218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45220         return ret_ref;
45221 }
45222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45223         LDKProbabilisticScoringParameters arg_conv;
45224         arg_conv.inner = untag_ptr(arg);
45225         arg_conv.is_owned = ptr_is_owned(arg);
45226         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45227         arg_conv.is_owned = false;
45228         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
45229         return ret_conv;
45230 }
45231
45232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45233         LDKProbabilisticScoringParameters orig_conv;
45234         orig_conv.inner = untag_ptr(orig);
45235         orig_conv.is_owned = ptr_is_owned(orig);
45236         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45237         orig_conv.is_owned = false;
45238         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
45239         int64_t ret_ref = 0;
45240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45242         return ret_ref;
45243 }
45244
45245 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) {
45246         LDKProbabilisticScoringParameters params_conv;
45247         params_conv.inner = untag_ptr(params);
45248         params_conv.is_owned = ptr_is_owned(params);
45249         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
45250         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
45251         LDKNetworkGraph network_graph_conv;
45252         network_graph_conv.inner = untag_ptr(network_graph);
45253         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45254         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45255         network_graph_conv.is_owned = false;
45256         void* logger_ptr = untag_ptr(logger);
45257         CHECK_ACCESS(logger_ptr);
45258         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45259         if (logger_conv.free == LDKLogger_JCalls_free) {
45260                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45261                 LDKLogger_JCalls_cloned(&logger_conv);
45262         }
45263         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
45264         int64_t ret_ref = 0;
45265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45267         return ret_ref;
45268 }
45269
45270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
45271         LDKProbabilisticScorer this_arg_conv;
45272         this_arg_conv.inner = untag_ptr(this_arg);
45273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45275         this_arg_conv.is_owned = false;
45276         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
45277 }
45278
45279 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) {
45280         LDKProbabilisticScorer this_arg_conv;
45281         this_arg_conv.inner = untag_ptr(this_arg);
45282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45284         this_arg_conv.is_owned = false;
45285         LDKNodeId target_conv;
45286         target_conv.inner = untag_ptr(target);
45287         target_conv.is_owned = ptr_is_owned(target);
45288         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45289         target_conv.is_owned = false;
45290         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
45291         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
45292         int64_t ret_ref = tag_ptr(ret_copy, true);
45293         return ret_ref;
45294 }
45295
45296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45297         LDKProbabilisticScorer this_arg_conv;
45298         this_arg_conv.inner = untag_ptr(this_arg);
45299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45301         this_arg_conv.is_owned = false;
45302         LDKNodeId node_id_conv;
45303         node_id_conv.inner = untag_ptr(node_id);
45304         node_id_conv.is_owned = ptr_is_owned(node_id);
45305         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45306         node_id_conv.is_owned = false;
45307         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
45308 }
45309
45310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45311         LDKProbabilisticScorer this_arg_conv;
45312         this_arg_conv.inner = untag_ptr(this_arg);
45313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45315         this_arg_conv.is_owned = false;
45316         LDKNodeId node_id_conv;
45317         node_id_conv.inner = untag_ptr(node_id);
45318         node_id_conv.is_owned = ptr_is_owned(node_id);
45319         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45320         node_id_conv.is_owned = false;
45321         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
45322 }
45323
45324 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) {
45325         LDKProbabilisticScorer this_arg_conv;
45326         this_arg_conv.inner = untag_ptr(this_arg);
45327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45329         this_arg_conv.is_owned = false;
45330         LDKNodeId node_id_conv;
45331         node_id_conv.inner = untag_ptr(node_id);
45332         node_id_conv.is_owned = ptr_is_owned(node_id);
45333         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45334         node_id_conv.is_owned = false;
45335         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
45336 }
45337
45338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
45339         LDKProbabilisticScorer this_arg_conv;
45340         this_arg_conv.inner = untag_ptr(this_arg);
45341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45343         this_arg_conv.is_owned = false;
45344         LDKNodeId node_id_conv;
45345         node_id_conv.inner = untag_ptr(node_id);
45346         node_id_conv.is_owned = ptr_is_owned(node_id);
45347         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45348         node_id_conv.is_owned = false;
45349         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
45350 }
45351
45352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
45353         LDKProbabilisticScorer this_arg_conv;
45354         this_arg_conv.inner = untag_ptr(this_arg);
45355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45357         this_arg_conv.is_owned = false;
45358         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
45359 }
45360
45361 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) {
45362         LDKProbabilisticScoringParameters this_arg_conv;
45363         this_arg_conv.inner = untag_ptr(this_arg);
45364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45366         this_arg_conv.is_owned = false;
45367         LDKCVec_NodeIdZ node_ids_constr;
45368         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
45369         if (node_ids_constr.datalen > 0)
45370                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
45371         else
45372                 node_ids_constr.data = NULL;
45373         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
45374         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
45375                 int64_t node_ids_conv_8 = node_ids_vals[i];
45376                 LDKNodeId node_ids_conv_8_conv;
45377                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
45378                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
45379                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
45380                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
45381                 node_ids_constr.data[i] = node_ids_conv_8_conv;
45382         }
45383         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
45384         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
45385 }
45386
45387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
45388         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
45389         int64_t ret_ref = 0;
45390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45392         return ret_ref;
45393 }
45394
45395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
45396         LDKProbabilisticScorer this_arg_conv;
45397         this_arg_conv.inner = untag_ptr(this_arg);
45398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45400         this_arg_conv.is_owned = false;
45401         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45402         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
45403         return tag_ptr(ret_ret, true);
45404 }
45405
45406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
45407         LDKProbabilisticScorer obj_conv;
45408         obj_conv.inner = untag_ptr(obj);
45409         obj_conv.is_owned = ptr_is_owned(obj);
45410         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45411         obj_conv.is_owned = false;
45412         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
45413         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45414         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45415         CVec_u8Z_free(ret_var);
45416         return ret_arr;
45417 }
45418
45419 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) {
45420         LDKu8slice ser_ref;
45421         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45422         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45423         LDKProbabilisticScoringParameters arg_a_conv;
45424         arg_a_conv.inner = untag_ptr(arg_a);
45425         arg_a_conv.is_owned = ptr_is_owned(arg_a);
45426         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
45427         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
45428         LDKNetworkGraph arg_b_conv;
45429         arg_b_conv.inner = untag_ptr(arg_b);
45430         arg_b_conv.is_owned = ptr_is_owned(arg_b);
45431         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
45432         arg_b_conv.is_owned = false;
45433         void* arg_c_ptr = untag_ptr(arg_c);
45434         CHECK_ACCESS(arg_c_ptr);
45435         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
45436         if (arg_c_conv.free == LDKLogger_JCalls_free) {
45437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45438                 LDKLogger_JCalls_cloned(&arg_c_conv);
45439         }
45440         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
45441         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
45442         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45443         return tag_ptr(ret_conv, true);
45444 }
45445
45446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45447         LDKFilesystemPersister this_obj_conv;
45448         this_obj_conv.inner = untag_ptr(this_obj);
45449         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45451         FilesystemPersister_free(this_obj_conv);
45452 }
45453
45454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
45455         LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
45456         LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
45457         int64_t ret_ref = 0;
45458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45460         return ret_ref;
45461 }
45462
45463 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
45464         LDKFilesystemPersister this_arg_conv;
45465         this_arg_conv.inner = untag_ptr(this_arg);
45466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45468         this_arg_conv.is_owned = false;
45469         LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
45470         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45471         Str_free(ret_str);
45472         return ret_conv;
45473 }
45474
45475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
45476         LDKFilesystemPersister this_arg_conv;
45477         this_arg_conv.inner = untag_ptr(this_arg);
45478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45480         this_arg_conv.is_owned = false;
45481         void* keys_manager_ptr = untag_ptr(keys_manager);
45482         CHECK_ACCESS(keys_manager_ptr);
45483         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45484         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45485                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45486                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45487         }
45488         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
45489         *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
45490         return tag_ptr(ret_conv, true);
45491 }
45492
45493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45494         LDKBackgroundProcessor this_obj_conv;
45495         this_obj_conv.inner = untag_ptr(this_obj);
45496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45498         BackgroundProcessor_free(this_obj_conv);
45499 }
45500
45501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45502         if (!ptr_is_owned(this_ptr)) return;
45503         void* this_ptr_ptr = untag_ptr(this_ptr);
45504         CHECK_ACCESS(this_ptr_ptr);
45505         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
45506         FREE(untag_ptr(this_ptr));
45507         GossipSync_free(this_ptr_conv);
45508 }
45509
45510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
45511         LDKP2PGossipSync a_conv;
45512         a_conv.inner = untag_ptr(a);
45513         a_conv.is_owned = ptr_is_owned(a);
45514         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45515         a_conv.is_owned = false;
45516         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45517         *ret_copy = GossipSync_p2_p(&a_conv);
45518         int64_t ret_ref = tag_ptr(ret_copy, true);
45519         return ret_ref;
45520 }
45521
45522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
45523         LDKRapidGossipSync a_conv;
45524         a_conv.inner = untag_ptr(a);
45525         a_conv.is_owned = ptr_is_owned(a);
45526         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45527         a_conv.is_owned = false;
45528         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45529         *ret_copy = GossipSync_rapid(&a_conv);
45530         int64_t ret_ref = tag_ptr(ret_copy, true);
45531         return ret_ref;
45532 }
45533
45534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
45535         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
45536         *ret_copy = GossipSync_none();
45537         int64_t ret_ref = tag_ptr(ret_copy, true);
45538         return ret_ref;
45539 }
45540
45541 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) {
45542         void* persister_ptr = untag_ptr(persister);
45543         CHECK_ACCESS(persister_ptr);
45544         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
45545         if (persister_conv.free == LDKPersister_JCalls_free) {
45546                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45547                 LDKPersister_JCalls_cloned(&persister_conv);
45548         }
45549         void* event_handler_ptr = untag_ptr(event_handler);
45550         CHECK_ACCESS(event_handler_ptr);
45551         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45552         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45553                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45554                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45555         }
45556         LDKChainMonitor chain_monitor_conv;
45557         chain_monitor_conv.inner = untag_ptr(chain_monitor);
45558         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
45559         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
45560         chain_monitor_conv.is_owned = false;
45561         LDKChannelManager channel_manager_conv;
45562         channel_manager_conv.inner = untag_ptr(channel_manager);
45563         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
45564         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
45565         channel_manager_conv.is_owned = false;
45566         void* gossip_sync_ptr = untag_ptr(gossip_sync);
45567         CHECK_ACCESS(gossip_sync_ptr);
45568         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
45569         // WARNING: we may need a move here but no clone is available for LDKGossipSync
45570         LDKPeerManager peer_manager_conv;
45571         peer_manager_conv.inner = untag_ptr(peer_manager);
45572         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
45574         peer_manager_conv.is_owned = false;
45575         void* logger_ptr = untag_ptr(logger);
45576         CHECK_ACCESS(logger_ptr);
45577         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45578         if (logger_conv.free == LDKLogger_JCalls_free) {
45579                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45580                 LDKLogger_JCalls_cloned(&logger_conv);
45581         }
45582         LDKMultiThreadedLockableScore scorer_conv;
45583         scorer_conv.inner = untag_ptr(scorer);
45584         scorer_conv.is_owned = ptr_is_owned(scorer);
45585         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45586         scorer_conv.is_owned = false;
45587         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);
45588         int64_t ret_ref = 0;
45589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45591         return ret_ref;
45592 }
45593
45594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
45595         LDKBackgroundProcessor this_arg_conv;
45596         this_arg_conv.inner = untag_ptr(this_arg);
45597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45599         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45600         
45601         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45602         *ret_conv = BackgroundProcessor_join(this_arg_conv);
45603         return tag_ptr(ret_conv, true);
45604 }
45605
45606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
45607         LDKBackgroundProcessor this_arg_conv;
45608         this_arg_conv.inner = untag_ptr(this_arg);
45609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45611         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
45612         
45613         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
45614         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
45615         return tag_ptr(ret_conv, true);
45616 }
45617
45618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45619         if (!ptr_is_owned(this_ptr)) return;
45620         void* this_ptr_ptr = untag_ptr(this_ptr);
45621         CHECK_ACCESS(this_ptr_ptr);
45622         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
45623         FREE(untag_ptr(this_ptr));
45624         ParseError_free(this_ptr_conv);
45625 }
45626
45627 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
45628         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45629         *ret_copy = ParseError_clone(arg);
45630         int64_t ret_ref = tag_ptr(ret_copy, true);
45631         return ret_ref;
45632 }
45633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45634         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
45635         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
45636         return ret_conv;
45637 }
45638
45639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45640         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
45641         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45642         *ret_copy = ParseError_clone(orig_conv);
45643         int64_t ret_ref = tag_ptr(ret_copy, true);
45644         return ret_ref;
45645 }
45646
45647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
45648         void* a_ptr = untag_ptr(a);
45649         CHECK_ACCESS(a_ptr);
45650         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
45651         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
45652         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45653         *ret_copy = ParseError_bech32_error(a_conv);
45654         int64_t ret_ref = tag_ptr(ret_copy, true);
45655         return ret_ref;
45656 }
45657
45658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
45659         
45660         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45661         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
45662         int64_t ret_ref = tag_ptr(ret_copy, true);
45663         return ret_ref;
45664 }
45665
45666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
45667         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
45668         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45669         *ret_copy = ParseError_malformed_signature(a_conv);
45670         int64_t ret_ref = tag_ptr(ret_copy, true);
45671         return ret_ref;
45672 }
45673
45674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
45675         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45676         *ret_copy = ParseError_bad_prefix();
45677         int64_t ret_ref = tag_ptr(ret_copy, true);
45678         return ret_ref;
45679 }
45680
45681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
45682         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45683         *ret_copy = ParseError_unknown_currency();
45684         int64_t ret_ref = tag_ptr(ret_copy, true);
45685         return ret_ref;
45686 }
45687
45688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
45689         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45690         *ret_copy = ParseError_unknown_si_prefix();
45691         int64_t ret_ref = tag_ptr(ret_copy, true);
45692         return ret_ref;
45693 }
45694
45695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
45696         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45697         *ret_copy = ParseError_malformed_hrp();
45698         int64_t ret_ref = tag_ptr(ret_copy, true);
45699         return ret_ref;
45700 }
45701
45702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
45703         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45704         *ret_copy = ParseError_too_short_data_part();
45705         int64_t ret_ref = tag_ptr(ret_copy, true);
45706         return ret_ref;
45707 }
45708
45709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
45710         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45711         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
45712         int64_t ret_ref = tag_ptr(ret_copy, true);
45713         return ret_ref;
45714 }
45715
45716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
45717         
45718         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45719         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
45720         int64_t ret_ref = tag_ptr(ret_copy, true);
45721         return ret_ref;
45722 }
45723
45724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
45725         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45726         *ret_copy = ParseError_padding_error();
45727         int64_t ret_ref = tag_ptr(ret_copy, true);
45728         return ret_ref;
45729 }
45730
45731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
45732         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45733         *ret_copy = ParseError_integer_overflow_error();
45734         int64_t ret_ref = tag_ptr(ret_copy, true);
45735         return ret_ref;
45736 }
45737
45738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
45739         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45740         *ret_copy = ParseError_invalid_seg_wit_program_length();
45741         int64_t ret_ref = tag_ptr(ret_copy, true);
45742         return ret_ref;
45743 }
45744
45745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
45746         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45747         *ret_copy = ParseError_invalid_pub_key_hash_length();
45748         int64_t ret_ref = tag_ptr(ret_copy, true);
45749         return ret_ref;
45750 }
45751
45752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
45753         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45754         *ret_copy = ParseError_invalid_script_hash_length();
45755         int64_t ret_ref = tag_ptr(ret_copy, true);
45756         return ret_ref;
45757 }
45758
45759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
45760         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45761         *ret_copy = ParseError_invalid_recovery_id();
45762         int64_t ret_ref = tag_ptr(ret_copy, true);
45763         return ret_ref;
45764 }
45765
45766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
45767         LDKStr a_conv = java_to_owned_str(env, a);
45768         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45769         *ret_copy = ParseError_invalid_slice_length(a_conv);
45770         int64_t ret_ref = tag_ptr(ret_copy, true);
45771         return ret_ref;
45772 }
45773
45774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
45775         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
45776         *ret_copy = ParseError_skip();
45777         int64_t ret_ref = tag_ptr(ret_copy, true);
45778         return ret_ref;
45779 }
45780
45781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45782         if (!ptr_is_owned(this_ptr)) return;
45783         void* this_ptr_ptr = untag_ptr(this_ptr);
45784         CHECK_ACCESS(this_ptr_ptr);
45785         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
45786         FREE(untag_ptr(this_ptr));
45787         ParseOrSemanticError_free(this_ptr_conv);
45788 }
45789
45790 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
45791         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45792         *ret_copy = ParseOrSemanticError_clone(arg);
45793         int64_t ret_ref = tag_ptr(ret_copy, true);
45794         return ret_ref;
45795 }
45796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45797         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
45798         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
45799         return ret_conv;
45800 }
45801
45802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45803         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
45804         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45805         *ret_copy = ParseOrSemanticError_clone(orig_conv);
45806         int64_t ret_ref = tag_ptr(ret_copy, true);
45807         return ret_ref;
45808 }
45809
45810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
45811         void* a_ptr = untag_ptr(a);
45812         CHECK_ACCESS(a_ptr);
45813         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
45814         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
45815         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45816         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
45817         int64_t ret_ref = tag_ptr(ret_copy, true);
45818         return ret_ref;
45819 }
45820
45821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
45822         LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
45823         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
45824         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
45825         int64_t ret_ref = tag_ptr(ret_copy, true);
45826         return ret_ref;
45827 }
45828
45829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45830         LDKInvoice this_obj_conv;
45831         this_obj_conv.inner = untag_ptr(this_obj);
45832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45834         Invoice_free(this_obj_conv);
45835 }
45836
45837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45838         LDKInvoice a_conv;
45839         a_conv.inner = untag_ptr(a);
45840         a_conv.is_owned = ptr_is_owned(a);
45841         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45842         a_conv.is_owned = false;
45843         LDKInvoice b_conv;
45844         b_conv.inner = untag_ptr(b);
45845         b_conv.is_owned = ptr_is_owned(b);
45846         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45847         b_conv.is_owned = false;
45848         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
45849         return ret_conv;
45850 }
45851
45852 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
45853         LDKInvoice ret_var = Invoice_clone(arg);
45854         int64_t ret_ref = 0;
45855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45857         return ret_ref;
45858 }
45859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45860         LDKInvoice arg_conv;
45861         arg_conv.inner = untag_ptr(arg);
45862         arg_conv.is_owned = ptr_is_owned(arg);
45863         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45864         arg_conv.is_owned = false;
45865         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
45866         return ret_conv;
45867 }
45868
45869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45870         LDKInvoice orig_conv;
45871         orig_conv.inner = untag_ptr(orig);
45872         orig_conv.is_owned = ptr_is_owned(orig);
45873         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45874         orig_conv.is_owned = false;
45875         LDKInvoice ret_var = Invoice_clone(&orig_conv);
45876         int64_t ret_ref = 0;
45877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45879         return ret_ref;
45880 }
45881
45882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45883         LDKSignedRawInvoice this_obj_conv;
45884         this_obj_conv.inner = untag_ptr(this_obj);
45885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45887         SignedRawInvoice_free(this_obj_conv);
45888 }
45889
45890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45891         LDKSignedRawInvoice a_conv;
45892         a_conv.inner = untag_ptr(a);
45893         a_conv.is_owned = ptr_is_owned(a);
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45895         a_conv.is_owned = false;
45896         LDKSignedRawInvoice b_conv;
45897         b_conv.inner = untag_ptr(b);
45898         b_conv.is_owned = ptr_is_owned(b);
45899         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45900         b_conv.is_owned = false;
45901         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
45902         return ret_conv;
45903 }
45904
45905 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
45906         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
45907         int64_t ret_ref = 0;
45908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45910         return ret_ref;
45911 }
45912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45913         LDKSignedRawInvoice arg_conv;
45914         arg_conv.inner = untag_ptr(arg);
45915         arg_conv.is_owned = ptr_is_owned(arg);
45916         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45917         arg_conv.is_owned = false;
45918         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
45919         return ret_conv;
45920 }
45921
45922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45923         LDKSignedRawInvoice orig_conv;
45924         orig_conv.inner = untag_ptr(orig);
45925         orig_conv.is_owned = ptr_is_owned(orig);
45926         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45927         orig_conv.is_owned = false;
45928         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
45929         int64_t ret_ref = 0;
45930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45932         return ret_ref;
45933 }
45934
45935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45936         LDKRawInvoice this_obj_conv;
45937         this_obj_conv.inner = untag_ptr(this_obj);
45938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45940         RawInvoice_free(this_obj_conv);
45941 }
45942
45943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45944         LDKRawInvoice this_ptr_conv;
45945         this_ptr_conv.inner = untag_ptr(this_ptr);
45946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45948         this_ptr_conv.is_owned = false;
45949         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
45950         int64_t ret_ref = 0;
45951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45953         return ret_ref;
45954 }
45955
45956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45957         LDKRawInvoice this_ptr_conv;
45958         this_ptr_conv.inner = untag_ptr(this_ptr);
45959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45961         this_ptr_conv.is_owned = false;
45962         LDKRawDataPart val_conv;
45963         val_conv.inner = untag_ptr(val);
45964         val_conv.is_owned = ptr_is_owned(val);
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45966         val_conv = RawDataPart_clone(&val_conv);
45967         RawInvoice_set_data(&this_ptr_conv, val_conv);
45968 }
45969
45970 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45971         LDKRawInvoice a_conv;
45972         a_conv.inner = untag_ptr(a);
45973         a_conv.is_owned = ptr_is_owned(a);
45974         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45975         a_conv.is_owned = false;
45976         LDKRawInvoice b_conv;
45977         b_conv.inner = untag_ptr(b);
45978         b_conv.is_owned = ptr_is_owned(b);
45979         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45980         b_conv.is_owned = false;
45981         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
45982         return ret_conv;
45983 }
45984
45985 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
45986         LDKRawInvoice ret_var = RawInvoice_clone(arg);
45987         int64_t ret_ref = 0;
45988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45990         return ret_ref;
45991 }
45992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45993         LDKRawInvoice arg_conv;
45994         arg_conv.inner = untag_ptr(arg);
45995         arg_conv.is_owned = ptr_is_owned(arg);
45996         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45997         arg_conv.is_owned = false;
45998         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
45999         return ret_conv;
46000 }
46001
46002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46003         LDKRawInvoice orig_conv;
46004         orig_conv.inner = untag_ptr(orig);
46005         orig_conv.is_owned = ptr_is_owned(orig);
46006         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46007         orig_conv.is_owned = false;
46008         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
46009         int64_t ret_ref = 0;
46010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46012         return ret_ref;
46013 }
46014
46015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46016         LDKRawDataPart this_obj_conv;
46017         this_obj_conv.inner = untag_ptr(this_obj);
46018         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46020         RawDataPart_free(this_obj_conv);
46021 }
46022
46023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
46024         LDKRawDataPart this_ptr_conv;
46025         this_ptr_conv.inner = untag_ptr(this_ptr);
46026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46028         this_ptr_conv.is_owned = false;
46029         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
46030         int64_t ret_ref = 0;
46031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46033         return ret_ref;
46034 }
46035
46036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46037         LDKRawDataPart this_ptr_conv;
46038         this_ptr_conv.inner = untag_ptr(this_ptr);
46039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46041         this_ptr_conv.is_owned = false;
46042         LDKPositiveTimestamp val_conv;
46043         val_conv.inner = untag_ptr(val);
46044         val_conv.is_owned = ptr_is_owned(val);
46045         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46046         val_conv = PositiveTimestamp_clone(&val_conv);
46047         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
46048 }
46049
46050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46051         LDKRawDataPart a_conv;
46052         a_conv.inner = untag_ptr(a);
46053         a_conv.is_owned = ptr_is_owned(a);
46054         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46055         a_conv.is_owned = false;
46056         LDKRawDataPart b_conv;
46057         b_conv.inner = untag_ptr(b);
46058         b_conv.is_owned = ptr_is_owned(b);
46059         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46060         b_conv.is_owned = false;
46061         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
46062         return ret_conv;
46063 }
46064
46065 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
46066         LDKRawDataPart ret_var = RawDataPart_clone(arg);
46067         int64_t ret_ref = 0;
46068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46070         return ret_ref;
46071 }
46072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46073         LDKRawDataPart arg_conv;
46074         arg_conv.inner = untag_ptr(arg);
46075         arg_conv.is_owned = ptr_is_owned(arg);
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46077         arg_conv.is_owned = false;
46078         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
46079         return ret_conv;
46080 }
46081
46082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46083         LDKRawDataPart orig_conv;
46084         orig_conv.inner = untag_ptr(orig);
46085         orig_conv.is_owned = ptr_is_owned(orig);
46086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46087         orig_conv.is_owned = false;
46088         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
46089         int64_t ret_ref = 0;
46090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46092         return ret_ref;
46093 }
46094
46095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46096         LDKPositiveTimestamp this_obj_conv;
46097         this_obj_conv.inner = untag_ptr(this_obj);
46098         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46100         PositiveTimestamp_free(this_obj_conv);
46101 }
46102
46103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46104         LDKPositiveTimestamp a_conv;
46105         a_conv.inner = untag_ptr(a);
46106         a_conv.is_owned = ptr_is_owned(a);
46107         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46108         a_conv.is_owned = false;
46109         LDKPositiveTimestamp b_conv;
46110         b_conv.inner = untag_ptr(b);
46111         b_conv.is_owned = ptr_is_owned(b);
46112         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46113         b_conv.is_owned = false;
46114         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
46115         return ret_conv;
46116 }
46117
46118 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
46119         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
46120         int64_t ret_ref = 0;
46121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46123         return ret_ref;
46124 }
46125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46126         LDKPositiveTimestamp arg_conv;
46127         arg_conv.inner = untag_ptr(arg);
46128         arg_conv.is_owned = ptr_is_owned(arg);
46129         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46130         arg_conv.is_owned = false;
46131         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
46132         return ret_conv;
46133 }
46134
46135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46136         LDKPositiveTimestamp orig_conv;
46137         orig_conv.inner = untag_ptr(orig);
46138         orig_conv.is_owned = ptr_is_owned(orig);
46139         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46140         orig_conv.is_owned = false;
46141         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
46142         int64_t ret_ref = 0;
46143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46145         return ret_ref;
46146 }
46147
46148 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46149         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
46150         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
46151         return ret_conv;
46152 }
46153
46154 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
46155         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
46156         return ret_conv;
46157 }
46158
46159 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
46160         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
46161         return ret_conv;
46162 }
46163
46164 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
46165         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
46166         return ret_conv;
46167 }
46168
46169 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
46170         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
46171         return ret_conv;
46172 }
46173
46174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46175         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
46176         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
46177         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
46178         return ret_conv;
46179 }
46180
46181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
46182         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
46183         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
46184         return ret_conv;
46185 }
46186
46187 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46188         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
46189         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
46190         return ret_conv;
46191 }
46192
46193 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
46194         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
46195         return ret_conv;
46196 }
46197
46198 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
46199         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
46200         return ret_conv;
46201 }
46202
46203 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
46204         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
46205         return ret_conv;
46206 }
46207
46208 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
46209         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
46210         return ret_conv;
46211 }
46212
46213 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
46214         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
46215         return ret_conv;
46216 }
46217
46218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
46219         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
46220         int64_t ret_conv = Currency_hash(o_conv);
46221         return ret_conv;
46222 }
46223
46224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46225         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
46226         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
46227         jboolean ret_conv = Currency_eq(a_conv, b_conv);
46228         return ret_conv;
46229 }
46230
46231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46232         LDKSha256 this_obj_conv;
46233         this_obj_conv.inner = untag_ptr(this_obj);
46234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46236         Sha256_free(this_obj_conv);
46237 }
46238
46239 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
46240         LDKSha256 ret_var = Sha256_clone(arg);
46241         int64_t ret_ref = 0;
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46244         return ret_ref;
46245 }
46246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46247         LDKSha256 arg_conv;
46248         arg_conv.inner = untag_ptr(arg);
46249         arg_conv.is_owned = ptr_is_owned(arg);
46250         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46251         arg_conv.is_owned = false;
46252         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
46253         return ret_conv;
46254 }
46255
46256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46257         LDKSha256 orig_conv;
46258         orig_conv.inner = untag_ptr(orig);
46259         orig_conv.is_owned = ptr_is_owned(orig);
46260         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46261         orig_conv.is_owned = false;
46262         LDKSha256 ret_var = Sha256_clone(&orig_conv);
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
46269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
46270         LDKSha256 o_conv;
46271         o_conv.inner = untag_ptr(o);
46272         o_conv.is_owned = ptr_is_owned(o);
46273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46274         o_conv.is_owned = false;
46275         int64_t ret_conv = Sha256_hash(&o_conv);
46276         return ret_conv;
46277 }
46278
46279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46280         LDKSha256 a_conv;
46281         a_conv.inner = untag_ptr(a);
46282         a_conv.is_owned = ptr_is_owned(a);
46283         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46284         a_conv.is_owned = false;
46285         LDKSha256 b_conv;
46286         b_conv.inner = untag_ptr(b);
46287         b_conv.is_owned = ptr_is_owned(b);
46288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46289         b_conv.is_owned = false;
46290         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
46291         return ret_conv;
46292 }
46293
46294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46295         LDKDescription this_obj_conv;
46296         this_obj_conv.inner = untag_ptr(this_obj);
46297         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46299         Description_free(this_obj_conv);
46300 }
46301
46302 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
46303         LDKDescription ret_var = Description_clone(arg);
46304         int64_t ret_ref = 0;
46305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46307         return ret_ref;
46308 }
46309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46310         LDKDescription arg_conv;
46311         arg_conv.inner = untag_ptr(arg);
46312         arg_conv.is_owned = ptr_is_owned(arg);
46313         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46314         arg_conv.is_owned = false;
46315         int64_t ret_conv = Description_clone_ptr(&arg_conv);
46316         return ret_conv;
46317 }
46318
46319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46320         LDKDescription orig_conv;
46321         orig_conv.inner = untag_ptr(orig);
46322         orig_conv.is_owned = ptr_is_owned(orig);
46323         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46324         orig_conv.is_owned = false;
46325         LDKDescription ret_var = Description_clone(&orig_conv);
46326         int64_t ret_ref = 0;
46327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46329         return ret_ref;
46330 }
46331
46332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
46333         LDKDescription o_conv;
46334         o_conv.inner = untag_ptr(o);
46335         o_conv.is_owned = ptr_is_owned(o);
46336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46337         o_conv.is_owned = false;
46338         int64_t ret_conv = Description_hash(&o_conv);
46339         return ret_conv;
46340 }
46341
46342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46343         LDKDescription a_conv;
46344         a_conv.inner = untag_ptr(a);
46345         a_conv.is_owned = ptr_is_owned(a);
46346         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46347         a_conv.is_owned = false;
46348         LDKDescription b_conv;
46349         b_conv.inner = untag_ptr(b);
46350         b_conv.is_owned = ptr_is_owned(b);
46351         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46352         b_conv.is_owned = false;
46353         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
46354         return ret_conv;
46355 }
46356
46357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46358         LDKPayeePubKey this_obj_conv;
46359         this_obj_conv.inner = untag_ptr(this_obj);
46360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46362         PayeePubKey_free(this_obj_conv);
46363 }
46364
46365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46366         LDKPayeePubKey this_ptr_conv;
46367         this_ptr_conv.inner = untag_ptr(this_ptr);
46368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46370         this_ptr_conv.is_owned = false;
46371         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46372         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
46373         return ret_arr;
46374 }
46375
46376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46377         LDKPayeePubKey this_ptr_conv;
46378         this_ptr_conv.inner = untag_ptr(this_ptr);
46379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46381         this_ptr_conv.is_owned = false;
46382         LDKPublicKey val_ref;
46383         CHECK((*env)->GetArrayLength(env, val) == 33);
46384         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46385         PayeePubKey_set_a(&this_ptr_conv, val_ref);
46386 }
46387
46388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
46389         LDKPublicKey a_arg_ref;
46390         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
46391         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
46392         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
46393         int64_t ret_ref = 0;
46394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46396         return ret_ref;
46397 }
46398
46399 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
46400         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
46401         int64_t ret_ref = 0;
46402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46404         return ret_ref;
46405 }
46406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46407         LDKPayeePubKey arg_conv;
46408         arg_conv.inner = untag_ptr(arg);
46409         arg_conv.is_owned = ptr_is_owned(arg);
46410         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46411         arg_conv.is_owned = false;
46412         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
46413         return ret_conv;
46414 }
46415
46416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46417         LDKPayeePubKey orig_conv;
46418         orig_conv.inner = untag_ptr(orig);
46419         orig_conv.is_owned = ptr_is_owned(orig);
46420         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46421         orig_conv.is_owned = false;
46422         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
46423         int64_t ret_ref = 0;
46424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46426         return ret_ref;
46427 }
46428
46429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
46430         LDKPayeePubKey o_conv;
46431         o_conv.inner = untag_ptr(o);
46432         o_conv.is_owned = ptr_is_owned(o);
46433         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46434         o_conv.is_owned = false;
46435         int64_t ret_conv = PayeePubKey_hash(&o_conv);
46436         return ret_conv;
46437 }
46438
46439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46440         LDKPayeePubKey a_conv;
46441         a_conv.inner = untag_ptr(a);
46442         a_conv.is_owned = ptr_is_owned(a);
46443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46444         a_conv.is_owned = false;
46445         LDKPayeePubKey b_conv;
46446         b_conv.inner = untag_ptr(b);
46447         b_conv.is_owned = ptr_is_owned(b);
46448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46449         b_conv.is_owned = false;
46450         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
46451         return ret_conv;
46452 }
46453
46454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46455         LDKExpiryTime this_obj_conv;
46456         this_obj_conv.inner = untag_ptr(this_obj);
46457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46459         ExpiryTime_free(this_obj_conv);
46460 }
46461
46462 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
46463         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
46464         int64_t ret_ref = 0;
46465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46467         return ret_ref;
46468 }
46469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46470         LDKExpiryTime arg_conv;
46471         arg_conv.inner = untag_ptr(arg);
46472         arg_conv.is_owned = ptr_is_owned(arg);
46473         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46474         arg_conv.is_owned = false;
46475         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
46476         return ret_conv;
46477 }
46478
46479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46480         LDKExpiryTime orig_conv;
46481         orig_conv.inner = untag_ptr(orig);
46482         orig_conv.is_owned = ptr_is_owned(orig);
46483         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46484         orig_conv.is_owned = false;
46485         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
46486         int64_t ret_ref = 0;
46487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46489         return ret_ref;
46490 }
46491
46492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
46493         LDKExpiryTime o_conv;
46494         o_conv.inner = untag_ptr(o);
46495         o_conv.is_owned = ptr_is_owned(o);
46496         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46497         o_conv.is_owned = false;
46498         int64_t ret_conv = ExpiryTime_hash(&o_conv);
46499         return ret_conv;
46500 }
46501
46502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46503         LDKExpiryTime a_conv;
46504         a_conv.inner = untag_ptr(a);
46505         a_conv.is_owned = ptr_is_owned(a);
46506         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46507         a_conv.is_owned = false;
46508         LDKExpiryTime b_conv;
46509         b_conv.inner = untag_ptr(b);
46510         b_conv.is_owned = ptr_is_owned(b);
46511         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46512         b_conv.is_owned = false;
46513         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
46514         return ret_conv;
46515 }
46516
46517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46518         LDKMinFinalCltvExpiry this_obj_conv;
46519         this_obj_conv.inner = untag_ptr(this_obj);
46520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46522         MinFinalCltvExpiry_free(this_obj_conv);
46523 }
46524
46525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
46526         LDKMinFinalCltvExpiry this_ptr_conv;
46527         this_ptr_conv.inner = untag_ptr(this_ptr);
46528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46530         this_ptr_conv.is_owned = false;
46531         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
46532         return ret_conv;
46533 }
46534
46535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46536         LDKMinFinalCltvExpiry this_ptr_conv;
46537         this_ptr_conv.inner = untag_ptr(this_ptr);
46538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46540         this_ptr_conv.is_owned = false;
46541         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
46542 }
46543
46544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
46545         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
46546         int64_t ret_ref = 0;
46547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46549         return ret_ref;
46550 }
46551
46552 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
46553         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
46554         int64_t ret_ref = 0;
46555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46557         return ret_ref;
46558 }
46559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46560         LDKMinFinalCltvExpiry arg_conv;
46561         arg_conv.inner = untag_ptr(arg);
46562         arg_conv.is_owned = ptr_is_owned(arg);
46563         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46564         arg_conv.is_owned = false;
46565         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
46566         return ret_conv;
46567 }
46568
46569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46570         LDKMinFinalCltvExpiry orig_conv;
46571         orig_conv.inner = untag_ptr(orig);
46572         orig_conv.is_owned = ptr_is_owned(orig);
46573         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46574         orig_conv.is_owned = false;
46575         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
46576         int64_t ret_ref = 0;
46577         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46578         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46579         return ret_ref;
46580 }
46581
46582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
46583         LDKMinFinalCltvExpiry o_conv;
46584         o_conv.inner = untag_ptr(o);
46585         o_conv.is_owned = ptr_is_owned(o);
46586         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46587         o_conv.is_owned = false;
46588         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
46589         return ret_conv;
46590 }
46591
46592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46593         LDKMinFinalCltvExpiry a_conv;
46594         a_conv.inner = untag_ptr(a);
46595         a_conv.is_owned = ptr_is_owned(a);
46596         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46597         a_conv.is_owned = false;
46598         LDKMinFinalCltvExpiry b_conv;
46599         b_conv.inner = untag_ptr(b);
46600         b_conv.is_owned = ptr_is_owned(b);
46601         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46602         b_conv.is_owned = false;
46603         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
46604         return ret_conv;
46605 }
46606
46607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46608         if (!ptr_is_owned(this_ptr)) return;
46609         void* this_ptr_ptr = untag_ptr(this_ptr);
46610         CHECK_ACCESS(this_ptr_ptr);
46611         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
46612         FREE(untag_ptr(this_ptr));
46613         Fallback_free(this_ptr_conv);
46614 }
46615
46616 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
46617         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46618         *ret_copy = Fallback_clone(arg);
46619         int64_t ret_ref = tag_ptr(ret_copy, true);
46620         return ret_ref;
46621 }
46622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46623         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
46624         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
46625         return ret_conv;
46626 }
46627
46628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46629         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
46630         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46631         *ret_copy = Fallback_clone(orig_conv);
46632         int64_t ret_ref = tag_ptr(ret_copy, true);
46633         return ret_ref;
46634 }
46635
46636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
46637         
46638         LDKCVec_u8Z program_ref;
46639         program_ref.datalen = (*env)->GetArrayLength(env, program);
46640         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
46641         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
46642         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46643         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
46644         int64_t ret_ref = tag_ptr(ret_copy, true);
46645         return ret_ref;
46646 }
46647
46648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46649         LDKTwentyBytes a_ref;
46650         CHECK((*env)->GetArrayLength(env, a) == 20);
46651         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46652         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46653         *ret_copy = Fallback_pub_key_hash(a_ref);
46654         int64_t ret_ref = tag_ptr(ret_copy, true);
46655         return ret_ref;
46656 }
46657
46658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
46659         LDKTwentyBytes a_ref;
46660         CHECK((*env)->GetArrayLength(env, a) == 20);
46661         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
46662         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
46663         *ret_copy = Fallback_script_hash(a_ref);
46664         int64_t ret_ref = tag_ptr(ret_copy, true);
46665         return ret_ref;
46666 }
46667
46668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
46669         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
46670         int64_t ret_conv = Fallback_hash(o_conv);
46671         return ret_conv;
46672 }
46673
46674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46675         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
46676         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
46677         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
46678         return ret_conv;
46679 }
46680
46681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46682         LDKInvoiceSignature this_obj_conv;
46683         this_obj_conv.inner = untag_ptr(this_obj);
46684         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46686         InvoiceSignature_free(this_obj_conv);
46687 }
46688
46689 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
46690         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
46691         int64_t ret_ref = 0;
46692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46694         return ret_ref;
46695 }
46696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46697         LDKInvoiceSignature arg_conv;
46698         arg_conv.inner = untag_ptr(arg);
46699         arg_conv.is_owned = ptr_is_owned(arg);
46700         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46701         arg_conv.is_owned = false;
46702         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
46703         return ret_conv;
46704 }
46705
46706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46707         LDKInvoiceSignature orig_conv;
46708         orig_conv.inner = untag_ptr(orig);
46709         orig_conv.is_owned = ptr_is_owned(orig);
46710         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46711         orig_conv.is_owned = false;
46712         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
46713         int64_t ret_ref = 0;
46714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46716         return ret_ref;
46717 }
46718
46719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46720         LDKInvoiceSignature a_conv;
46721         a_conv.inner = untag_ptr(a);
46722         a_conv.is_owned = ptr_is_owned(a);
46723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46724         a_conv.is_owned = false;
46725         LDKInvoiceSignature b_conv;
46726         b_conv.inner = untag_ptr(b);
46727         b_conv.is_owned = ptr_is_owned(b);
46728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46729         b_conv.is_owned = false;
46730         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
46731         return ret_conv;
46732 }
46733
46734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46735         LDKPrivateRoute this_obj_conv;
46736         this_obj_conv.inner = untag_ptr(this_obj);
46737         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46739         PrivateRoute_free(this_obj_conv);
46740 }
46741
46742 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
46743         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
46744         int64_t ret_ref = 0;
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46747         return ret_ref;
46748 }
46749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46750         LDKPrivateRoute arg_conv;
46751         arg_conv.inner = untag_ptr(arg);
46752         arg_conv.is_owned = ptr_is_owned(arg);
46753         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46754         arg_conv.is_owned = false;
46755         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
46756         return ret_conv;
46757 }
46758
46759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46760         LDKPrivateRoute orig_conv;
46761         orig_conv.inner = untag_ptr(orig);
46762         orig_conv.is_owned = ptr_is_owned(orig);
46763         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46764         orig_conv.is_owned = false;
46765         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
46766         int64_t ret_ref = 0;
46767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46769         return ret_ref;
46770 }
46771
46772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
46773         LDKPrivateRoute o_conv;
46774         o_conv.inner = untag_ptr(o);
46775         o_conv.is_owned = ptr_is_owned(o);
46776         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46777         o_conv.is_owned = false;
46778         int64_t ret_conv = PrivateRoute_hash(&o_conv);
46779         return ret_conv;
46780 }
46781
46782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46783         LDKPrivateRoute a_conv;
46784         a_conv.inner = untag_ptr(a);
46785         a_conv.is_owned = ptr_is_owned(a);
46786         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46787         a_conv.is_owned = false;
46788         LDKPrivateRoute b_conv;
46789         b_conv.inner = untag_ptr(b);
46790         b_conv.is_owned = ptr_is_owned(b);
46791         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46792         b_conv.is_owned = false;
46793         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
46794         return ret_conv;
46795 }
46796
46797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
46798         LDKSignedRawInvoice this_arg_conv;
46799         this_arg_conv.inner = untag_ptr(this_arg);
46800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46802         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
46803         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
46804         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
46805         return tag_ptr(ret_conv, true);
46806 }
46807
46808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
46809         LDKSignedRawInvoice this_arg_conv;
46810         this_arg_conv.inner = untag_ptr(this_arg);
46811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46813         this_arg_conv.is_owned = false;
46814         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
46815         int64_t ret_ref = 0;
46816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46818         return ret_ref;
46819 }
46820
46821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46822         LDKSignedRawInvoice this_arg_conv;
46823         this_arg_conv.inner = untag_ptr(this_arg);
46824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46826         this_arg_conv.is_owned = false;
46827         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46828         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
46829         return ret_arr;
46830 }
46831
46832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46833         LDKSignedRawInvoice this_arg_conv;
46834         this_arg_conv.inner = untag_ptr(this_arg);
46835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46837         this_arg_conv.is_owned = false;
46838         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
46839         int64_t ret_ref = 0;
46840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46842         return ret_ref;
46843 }
46844
46845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46846         LDKSignedRawInvoice this_arg_conv;
46847         this_arg_conv.inner = untag_ptr(this_arg);
46848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46850         this_arg_conv.is_owned = false;
46851         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
46852         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
46853         return tag_ptr(ret_conv, true);
46854 }
46855
46856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
46857         LDKSignedRawInvoice this_arg_conv;
46858         this_arg_conv.inner = untag_ptr(this_arg);
46859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46861         this_arg_conv.is_owned = false;
46862         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
46863         return ret_conv;
46864 }
46865
46866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46867         LDKRawInvoice this_arg_conv;
46868         this_arg_conv.inner = untag_ptr(this_arg);
46869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46871         this_arg_conv.is_owned = false;
46872         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46873         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
46874         return ret_arr;
46875 }
46876
46877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46878         LDKRawInvoice this_arg_conv;
46879         this_arg_conv.inner = untag_ptr(this_arg);
46880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46882         this_arg_conv.is_owned = false;
46883         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
46884         int64_t ret_ref = 0;
46885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46887         return ret_ref;
46888 }
46889
46890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
46891         LDKRawInvoice this_arg_conv;
46892         this_arg_conv.inner = untag_ptr(this_arg);
46893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46895         this_arg_conv.is_owned = false;
46896         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
46897         int64_t ret_ref = 0;
46898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46900         return ret_ref;
46901 }
46902
46903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
46904         LDKRawInvoice this_arg_conv;
46905         this_arg_conv.inner = untag_ptr(this_arg);
46906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46908         this_arg_conv.is_owned = false;
46909         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
46910         int64_t ret_ref = 0;
46911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46913         return ret_ref;
46914 }
46915
46916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
46917         LDKRawInvoice this_arg_conv;
46918         this_arg_conv.inner = untag_ptr(this_arg);
46919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46921         this_arg_conv.is_owned = false;
46922         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
46923         int64_t ret_ref = 0;
46924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46926         return ret_ref;
46927 }
46928
46929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
46930         LDKRawInvoice this_arg_conv;
46931         this_arg_conv.inner = untag_ptr(this_arg);
46932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46934         this_arg_conv.is_owned = false;
46935         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
46936         int64_t ret_ref = 0;
46937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46939         return ret_ref;
46940 }
46941
46942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
46943         LDKRawInvoice this_arg_conv;
46944         this_arg_conv.inner = untag_ptr(this_arg);
46945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46947         this_arg_conv.is_owned = false;
46948         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
46949         int64_t ret_ref = 0;
46950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46952         return ret_ref;
46953 }
46954
46955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
46956         LDKRawInvoice this_arg_conv;
46957         this_arg_conv.inner = untag_ptr(this_arg);
46958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46960         this_arg_conv.is_owned = false;
46961         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46962         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
46963         return ret_arr;
46964 }
46965
46966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
46967         LDKRawInvoice this_arg_conv;
46968         this_arg_conv.inner = untag_ptr(this_arg);
46969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46971         this_arg_conv.is_owned = false;
46972         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
46973         int64_t ret_ref = 0;
46974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46976         return ret_ref;
46977 }
46978
46979 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
46980         LDKRawInvoice this_arg_conv;
46981         this_arg_conv.inner = untag_ptr(this_arg);
46982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46984         this_arg_conv.is_owned = false;
46985         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
46986         int64_tArray ret_arr = NULL;
46987         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46988         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46989         for (size_t o = 0; o < ret_var.datalen; o++) {
46990                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
46991                 int64_t ret_conv_14_ref = 0;
46992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
46993                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
46994                 ret_arr_ptr[o] = ret_conv_14_ref;
46995         }
46996         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46997         FREE(ret_var.data);
46998         return ret_arr;
46999 }
47000
47001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
47002         LDKRawInvoice this_arg_conv;
47003         this_arg_conv.inner = untag_ptr(this_arg);
47004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47006         this_arg_conv.is_owned = false;
47007         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47008         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
47009         int64_t ret_ref = tag_ptr(ret_copy, true);
47010         return ret_ref;
47011 }
47012
47013 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47014         LDKRawInvoice this_arg_conv;
47015         this_arg_conv.inner = untag_ptr(this_arg);
47016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47018         this_arg_conv.is_owned = false;
47019         jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
47020         return ret_conv;
47021 }
47022
47023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
47024         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47025         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
47026         return tag_ptr(ret_conv, true);
47027 }
47028
47029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
47030         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47031         *ret_conv = PositiveTimestamp_from_system_time(time);
47032         return tag_ptr(ret_conv, true);
47033 }
47034
47035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
47036         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
47037         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
47038         return tag_ptr(ret_conv, true);
47039 }
47040
47041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47042         LDKPositiveTimestamp this_arg_conv;
47043         this_arg_conv.inner = untag_ptr(this_arg);
47044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47046         this_arg_conv.is_owned = false;
47047         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
47048         return ret_conv;
47049 }
47050
47051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47052         LDKPositiveTimestamp this_arg_conv;
47053         this_arg_conv.inner = untag_ptr(this_arg);
47054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47056         this_arg_conv.is_owned = false;
47057         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
47058         return ret_conv;
47059 }
47060
47061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47062         LDKPositiveTimestamp this_arg_conv;
47063         this_arg_conv.inner = untag_ptr(this_arg);
47064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47066         this_arg_conv.is_owned = false;
47067         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
47068         return ret_conv;
47069 }
47070
47071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
47072         LDKInvoice this_arg_conv;
47073         this_arg_conv.inner = untag_ptr(this_arg);
47074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47076         this_arg_conv = Invoice_clone(&this_arg_conv);
47077         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
47078         int64_t ret_ref = 0;
47079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47081         return ret_ref;
47082 }
47083
47084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
47085         LDKInvoice this_arg_conv;
47086         this_arg_conv.inner = untag_ptr(this_arg);
47087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47089         this_arg_conv.is_owned = false;
47090         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
47091         *ret_conv = Invoice_check_signature(&this_arg_conv);
47092         return tag_ptr(ret_conv, true);
47093 }
47094
47095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
47096         LDKSignedRawInvoice signed_invoice_conv;
47097         signed_invoice_conv.inner = untag_ptr(signed_invoice);
47098         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
47099         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
47100         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
47101         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
47102         *ret_conv = Invoice_from_signed(signed_invoice_conv);
47103         return tag_ptr(ret_conv, true);
47104 }
47105
47106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
47107         LDKInvoice this_arg_conv;
47108         this_arg_conv.inner = untag_ptr(this_arg);
47109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47111         this_arg_conv.is_owned = false;
47112         int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
47113         return ret_conv;
47114 }
47115
47116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
47117         LDKInvoice this_arg_conv;
47118         this_arg_conv.inner = untag_ptr(this_arg);
47119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47121         this_arg_conv.is_owned = false;
47122         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
47123         return ret_conv;
47124 }
47125
47126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
47127         LDKInvoice this_arg_conv;
47128         this_arg_conv.inner = untag_ptr(this_arg);
47129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47131         this_arg_conv.is_owned = false;
47132         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47133         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
47134         return ret_arr;
47135 }
47136
47137 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47138         LDKInvoice this_arg_conv;
47139         this_arg_conv.inner = untag_ptr(this_arg);
47140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47142         this_arg_conv.is_owned = false;
47143         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47144         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
47145         return ret_arr;
47146 }
47147
47148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
47149         LDKInvoice this_arg_conv;
47150         this_arg_conv.inner = untag_ptr(this_arg);
47151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47153         this_arg_conv.is_owned = false;
47154         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47155         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
47156         return ret_arr;
47157 }
47158
47159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
47160         LDKInvoice this_arg_conv;
47161         this_arg_conv.inner = untag_ptr(this_arg);
47162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47164         this_arg_conv.is_owned = false;
47165         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
47166         int64_t ret_ref = 0;
47167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47169         return ret_ref;
47170 }
47171
47172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
47173         LDKInvoice this_arg_conv;
47174         this_arg_conv.inner = untag_ptr(this_arg);
47175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47177         this_arg_conv.is_owned = false;
47178         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47179         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
47180         return ret_arr;
47181 }
47182
47183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
47184         LDKInvoice this_arg_conv;
47185         this_arg_conv.inner = untag_ptr(this_arg);
47186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47188         this_arg_conv.is_owned = false;
47189         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
47190         return ret_conv;
47191 }
47192
47193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
47194         LDKInvoice this_arg_conv;
47195         this_arg_conv.inner = untag_ptr(this_arg);
47196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47198         this_arg_conv.is_owned = false;
47199         jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
47200         return ret_conv;
47201 }
47202
47203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
47204         LDKInvoice this_arg_conv;
47205         this_arg_conv.inner = untag_ptr(this_arg);
47206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47208         this_arg_conv.is_owned = false;
47209         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
47210         return ret_conv;
47211 }
47212
47213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
47214         LDKInvoice this_arg_conv;
47215         this_arg_conv.inner = untag_ptr(this_arg);
47216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47218         this_arg_conv.is_owned = false;
47219         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
47220         return ret_conv;
47221 }
47222
47223 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
47224         LDKInvoice this_arg_conv;
47225         this_arg_conv.inner = untag_ptr(this_arg);
47226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47228         this_arg_conv.is_owned = false;
47229         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
47230         int64_tArray ret_arr = NULL;
47231         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47232         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47233         for (size_t o = 0; o < ret_var.datalen; o++) {
47234                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47235                 int64_t ret_conv_14_ref = 0;
47236                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47237                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47238                 ret_arr_ptr[o] = ret_conv_14_ref;
47239         }
47240         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47241         FREE(ret_var.data);
47242         return ret_arr;
47243 }
47244
47245 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
47246         LDKInvoice this_arg_conv;
47247         this_arg_conv.inner = untag_ptr(this_arg);
47248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47250         this_arg_conv.is_owned = false;
47251         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
47252         int64_tArray ret_arr = NULL;
47253         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47254         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47255         for (size_t l = 0; l < ret_var.datalen; l++) {
47256                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
47257                 int64_t ret_conv_11_ref = 0;
47258                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
47259                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
47260                 ret_arr_ptr[l] = ret_conv_11_ref;
47261         }
47262         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47263         FREE(ret_var.data);
47264         return ret_arr;
47265 }
47266
47267 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
47268         LDKInvoice this_arg_conv;
47269         this_arg_conv.inner = untag_ptr(this_arg);
47270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47272         this_arg_conv.is_owned = false;
47273         jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
47274         return ret_conv;
47275 }
47276
47277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
47278         LDKInvoice this_arg_conv;
47279         this_arg_conv.inner = untag_ptr(this_arg);
47280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47282         this_arg_conv.is_owned = false;
47283         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47284         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
47285         int64_t ret_ref = tag_ptr(ret_copy, true);
47286         return ret_ref;
47287 }
47288
47289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
47290         LDKStr description_conv = java_to_owned_str(env, description);
47291         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
47292         *ret_conv = Description_new(description_conv);
47293         return tag_ptr(ret_conv, true);
47294 }
47295
47296 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47297         LDKDescription this_arg_conv;
47298         this_arg_conv.inner = untag_ptr(this_arg);
47299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47301         this_arg_conv = Description_clone(&this_arg_conv);
47302         LDKStr ret_str = Description_into_inner(this_arg_conv);
47303         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47304         Str_free(ret_str);
47305         return ret_conv;
47306 }
47307
47308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
47309         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
47310         int64_t ret_ref = 0;
47311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47313         return ret_ref;
47314 }
47315
47316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
47317         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
47318         int64_t ret_ref = 0;
47319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47321         return ret_ref;
47322 }
47323
47324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
47325         LDKExpiryTime this_arg_conv;
47326         this_arg_conv.inner = untag_ptr(this_arg);
47327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47329         this_arg_conv.is_owned = false;
47330         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
47331         return ret_conv;
47332 }
47333
47334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
47335         LDKExpiryTime this_arg_conv;
47336         this_arg_conv.inner = untag_ptr(this_arg);
47337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47339         this_arg_conv.is_owned = false;
47340         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
47341         return ret_conv;
47342 }
47343
47344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
47345         LDKRouteHint hops_conv;
47346         hops_conv.inner = untag_ptr(hops);
47347         hops_conv.is_owned = ptr_is_owned(hops);
47348         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
47349         hops_conv = RouteHint_clone(&hops_conv);
47350         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
47351         *ret_conv = PrivateRoute_new(hops_conv);
47352         return tag_ptr(ret_conv, true);
47353 }
47354
47355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
47356         LDKPrivateRoute this_arg_conv;
47357         this_arg_conv.inner = untag_ptr(this_arg);
47358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47360         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
47361         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
47362         int64_t ret_ref = 0;
47363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47365         return ret_ref;
47366 }
47367
47368 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47369         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
47370         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
47371         return ret_conv;
47372 }
47373
47374 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
47375         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
47376         return ret_conv;
47377 }
47378
47379 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
47380         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
47381         return ret_conv;
47382 }
47383
47384 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
47385         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
47386         return ret_conv;
47387 }
47388
47389 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
47390         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
47391         return ret_conv;
47392 }
47393
47394 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
47395         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
47396         return ret_conv;
47397 }
47398
47399 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47400         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
47401         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
47402         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
47403         return ret_conv;
47404 }
47405
47406 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47407         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
47408         LDKStr ret_str = CreationError_to_str(o_conv);
47409         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47410         Str_free(ret_str);
47411         return ret_conv;
47412 }
47413
47414 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47415         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
47416         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
47417         return ret_conv;
47418 }
47419
47420 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
47421         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
47422         return ret_conv;
47423 }
47424
47425 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
47426         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
47427         return ret_conv;
47428 }
47429
47430 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
47431         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
47432         return ret_conv;
47433 }
47434
47435 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
47436         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
47437         return ret_conv;
47438 }
47439
47440 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
47441         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
47442         return ret_conv;
47443 }
47444
47445 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
47446         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
47447         return ret_conv;
47448 }
47449
47450 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
47451         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
47452         return ret_conv;
47453 }
47454
47455 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
47456         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
47457         return ret_conv;
47458 }
47459
47460 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
47461         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
47462         return ret_conv;
47463 }
47464
47465 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
47466         jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
47467         return ret_conv;
47468 }
47469
47470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47471         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
47472         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
47473         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
47474         return ret_conv;
47475 }
47476
47477 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47478         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
47479         LDKStr ret_str = SemanticError_to_str(o_conv);
47480         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47481         Str_free(ret_str);
47482         return ret_conv;
47483 }
47484
47485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47486         if (!ptr_is_owned(this_ptr)) return;
47487         void* this_ptr_ptr = untag_ptr(this_ptr);
47488         CHECK_ACCESS(this_ptr_ptr);
47489         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
47490         FREE(untag_ptr(this_ptr));
47491         SignOrCreationError_free(this_ptr_conv);
47492 }
47493
47494 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
47495         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47496         *ret_copy = SignOrCreationError_clone(arg);
47497         int64_t ret_ref = tag_ptr(ret_copy, true);
47498         return ret_ref;
47499 }
47500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47501         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
47502         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
47503         return ret_conv;
47504 }
47505
47506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47507         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
47508         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47509         *ret_copy = SignOrCreationError_clone(orig_conv);
47510         int64_t ret_ref = tag_ptr(ret_copy, true);
47511         return ret_ref;
47512 }
47513
47514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
47515         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47516         *ret_copy = SignOrCreationError_sign_error();
47517         int64_t ret_ref = tag_ptr(ret_copy, true);
47518         return ret_ref;
47519 }
47520
47521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
47522         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
47523         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
47524         *ret_copy = SignOrCreationError_creation_error(a_conv);
47525         int64_t ret_ref = tag_ptr(ret_copy, true);
47526         return ret_ref;
47527 }
47528
47529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47530         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
47531         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
47532         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
47533         return ret_conv;
47534 }
47535
47536 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
47537         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
47538         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
47539         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47540         Str_free(ret_str);
47541         return ret_conv;
47542 }
47543
47544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47545         LDKInvoicePayer this_obj_conv;
47546         this_obj_conv.inner = untag_ptr(this_obj);
47547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47549         InvoicePayer_free(this_obj_conv);
47550 }
47551
47552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47553         if (!ptr_is_owned(this_ptr)) return;
47554         void* this_ptr_ptr = untag_ptr(this_ptr);
47555         CHECK_ACCESS(this_ptr_ptr);
47556         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
47557         FREE(untag_ptr(this_ptr));
47558         Payer_free(this_ptr_conv);
47559 }
47560
47561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47562         if (!ptr_is_owned(this_ptr)) return;
47563         void* this_ptr_ptr = untag_ptr(this_ptr);
47564         CHECK_ACCESS(this_ptr_ptr);
47565         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
47566         FREE(untag_ptr(this_ptr));
47567         Router_free(this_ptr_conv);
47568 }
47569
47570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47571         if (!ptr_is_owned(this_ptr)) return;
47572         void* this_ptr_ptr = untag_ptr(this_ptr);
47573         CHECK_ACCESS(this_ptr_ptr);
47574         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
47575         FREE(untag_ptr(this_ptr));
47576         Retry_free(this_ptr_conv);
47577 }
47578
47579 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
47580         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47581         *ret_copy = Retry_clone(arg);
47582         int64_t ret_ref = tag_ptr(ret_copy, true);
47583         return ret_ref;
47584 }
47585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47586         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
47587         int64_t ret_conv = Retry_clone_ptr(arg_conv);
47588         return ret_conv;
47589 }
47590
47591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47592         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
47593         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47594         *ret_copy = Retry_clone(orig_conv);
47595         int64_t ret_ref = tag_ptr(ret_copy, true);
47596         return ret_ref;
47597 }
47598
47599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
47600         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47601         *ret_copy = Retry_attempts(a);
47602         int64_t ret_ref = tag_ptr(ret_copy, true);
47603         return ret_ref;
47604 }
47605
47606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
47607         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
47608         *ret_copy = Retry_timeout(a);
47609         int64_t ret_ref = tag_ptr(ret_copy, true);
47610         return ret_ref;
47611 }
47612
47613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47614         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
47615         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
47616         jboolean ret_conv = Retry_eq(a_conv, b_conv);
47617         return ret_conv;
47618 }
47619
47620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
47621         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
47622         int64_t ret_conv = Retry_hash(o_conv);
47623         return ret_conv;
47624 }
47625
47626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47627         if (!ptr_is_owned(this_ptr)) return;
47628         void* this_ptr_ptr = untag_ptr(this_ptr);
47629         CHECK_ACCESS(this_ptr_ptr);
47630         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
47631         FREE(untag_ptr(this_ptr));
47632         PaymentError_free(this_ptr_conv);
47633 }
47634
47635 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
47636         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47637         *ret_copy = PaymentError_clone(arg);
47638         int64_t ret_ref = tag_ptr(ret_copy, true);
47639         return ret_ref;
47640 }
47641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47642         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
47643         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
47644         return ret_conv;
47645 }
47646
47647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47648         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
47649         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47650         *ret_copy = PaymentError_clone(orig_conv);
47651         int64_t ret_ref = tag_ptr(ret_copy, true);
47652         return ret_ref;
47653 }
47654
47655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
47656         LDKStr a_conv = java_to_owned_str(env, a);
47657         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47658         *ret_copy = PaymentError_invoice(a_conv);
47659         int64_t ret_ref = tag_ptr(ret_copy, true);
47660         return ret_ref;
47661 }
47662
47663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
47664         LDKLightningError a_conv;
47665         a_conv.inner = untag_ptr(a);
47666         a_conv.is_owned = ptr_is_owned(a);
47667         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47668         a_conv = LightningError_clone(&a_conv);
47669         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47670         *ret_copy = PaymentError_routing(a_conv);
47671         int64_t ret_ref = tag_ptr(ret_copy, true);
47672         return ret_ref;
47673 }
47674
47675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
47676         void* a_ptr = untag_ptr(a);
47677         CHECK_ACCESS(a_ptr);
47678         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
47679         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
47680         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
47681         *ret_copy = PaymentError_sending(a_conv);
47682         int64_t ret_ref = tag_ptr(ret_copy, true);
47683         return ret_ref;
47684 }
47685
47686 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) {
47687         void* payer_ptr = untag_ptr(payer);
47688         CHECK_ACCESS(payer_ptr);
47689         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
47690         if (payer_conv.free == LDKPayer_JCalls_free) {
47691                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47692                 LDKPayer_JCalls_cloned(&payer_conv);
47693         }
47694         void* router_ptr = untag_ptr(router);
47695         CHECK_ACCESS(router_ptr);
47696         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
47697         if (router_conv.free == LDKRouter_JCalls_free) {
47698                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47699                 LDKRouter_JCalls_cloned(&router_conv);
47700         }
47701         LDKMultiThreadedLockableScore scorer_conv;
47702         scorer_conv.inner = untag_ptr(scorer);
47703         scorer_conv.is_owned = ptr_is_owned(scorer);
47704         CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
47705         scorer_conv.is_owned = false;
47706         void* logger_ptr = untag_ptr(logger);
47707         CHECK_ACCESS(logger_ptr);
47708         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47709         if (logger_conv.free == LDKLogger_JCalls_free) {
47710                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47711                 LDKLogger_JCalls_cloned(&logger_conv);
47712         }
47713         void* event_handler_ptr = untag_ptr(event_handler);
47714         CHECK_ACCESS(event_handler_ptr);
47715         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
47716         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
47717                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47718                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
47719         }
47720         void* retry_ptr = untag_ptr(retry);
47721         CHECK_ACCESS(retry_ptr);
47722         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
47723         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
47724         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_conv);
47725         int64_t ret_ref = 0;
47726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47728         return ret_ref;
47729 }
47730
47731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
47732         LDKInvoicePayer this_arg_conv;
47733         this_arg_conv.inner = untag_ptr(this_arg);
47734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47736         this_arg_conv.is_owned = false;
47737         LDKInvoice invoice_conv;
47738         invoice_conv.inner = untag_ptr(invoice);
47739         invoice_conv.is_owned = ptr_is_owned(invoice);
47740         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47741         invoice_conv.is_owned = false;
47742         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47743         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
47744         return tag_ptr(ret_conv, true);
47745 }
47746
47747 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) {
47748         LDKInvoicePayer this_arg_conv;
47749         this_arg_conv.inner = untag_ptr(this_arg);
47750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47752         this_arg_conv.is_owned = false;
47753         LDKInvoice invoice_conv;
47754         invoice_conv.inner = untag_ptr(invoice);
47755         invoice_conv.is_owned = ptr_is_owned(invoice);
47756         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
47757         invoice_conv.is_owned = false;
47758         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47759         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
47760         return tag_ptr(ret_conv, true);
47761 }
47762
47763 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) {
47764         LDKInvoicePayer this_arg_conv;
47765         this_arg_conv.inner = untag_ptr(this_arg);
47766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47768         this_arg_conv.is_owned = false;
47769         LDKPublicKey pubkey_ref;
47770         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
47771         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
47772         LDKThirtyTwoBytes payment_preimage_ref;
47773         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
47774         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
47775         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
47776         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
47777         return tag_ptr(ret_conv, true);
47778 }
47779
47780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
47781         LDKInvoicePayer this_arg_conv;
47782         this_arg_conv.inner = untag_ptr(this_arg);
47783         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47785         this_arg_conv.is_owned = false;
47786         unsigned char payment_hash_arr[32];
47787         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47788         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
47789         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
47790         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
47791 }
47792
47793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
47794         LDKInvoicePayer this_arg_conv;
47795         this_arg_conv.inner = untag_ptr(this_arg);
47796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47798         this_arg_conv.is_owned = false;
47799         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
47800         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
47801         return tag_ptr(ret_ret, true);
47802 }
47803
47804 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) {
47805         void* amt_msat_ptr = untag_ptr(amt_msat);
47806         CHECK_ACCESS(amt_msat_ptr);
47807         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47808         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47809         LDKThirtyTwoBytes payment_hash_ref;
47810         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47811         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47812         LDKStr description_conv = java_to_owned_str(env, description);
47813         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47814         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47815         if (phantom_route_hints_constr.datalen > 0)
47816                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47817         else
47818                 phantom_route_hints_constr.data = NULL;
47819         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47820         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47821                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47822                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47823                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
47824                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
47825                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47826                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47827                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47828         }
47829         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47830         void* keys_manager_ptr = untag_ptr(keys_manager);
47831         CHECK_ACCESS(keys_manager_ptr);
47832         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47833         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47835                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47836         }
47837         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47838         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47839         *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);
47840         return tag_ptr(ret_conv, true);
47841 }
47842
47843 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) {
47844         void* amt_msat_ptr = untag_ptr(amt_msat);
47845         CHECK_ACCESS(amt_msat_ptr);
47846         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47847         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47848         LDKThirtyTwoBytes payment_hash_ref;
47849         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47850         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47851         LDKSha256 description_hash_conv;
47852         description_hash_conv.inner = untag_ptr(description_hash);
47853         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47854         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47855         description_hash_conv = Sha256_clone(&description_hash_conv);
47856         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
47857         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
47858         if (phantom_route_hints_constr.datalen > 0)
47859                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
47860         else
47861                 phantom_route_hints_constr.data = NULL;
47862         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
47863         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
47864                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
47865                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
47866                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
47867                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
47868                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
47869                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
47870                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
47871         }
47872         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
47873         void* keys_manager_ptr = untag_ptr(keys_manager);
47874         CHECK_ACCESS(keys_manager_ptr);
47875         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47876         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47878                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47879         }
47880         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47881         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47882         *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);
47883         return tag_ptr(ret_conv, true);
47884 }
47885
47886 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) {
47887         LDKChannelManager channelmanager_conv;
47888         channelmanager_conv.inner = untag_ptr(channelmanager);
47889         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47890         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47891         channelmanager_conv.is_owned = false;
47892         void* keys_manager_ptr = untag_ptr(keys_manager);
47893         CHECK_ACCESS(keys_manager_ptr);
47894         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47895         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47896                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47897                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47898         }
47899         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47900         void* amt_msat_ptr = untag_ptr(amt_msat);
47901         CHECK_ACCESS(amt_msat_ptr);
47902         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47903         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47904         LDKStr description_conv = java_to_owned_str(env, description);
47905         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47906         *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs);
47907         return tag_ptr(ret_conv, true);
47908 }
47909
47910 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) {
47911         LDKChannelManager channelmanager_conv;
47912         channelmanager_conv.inner = untag_ptr(channelmanager);
47913         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47914         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47915         channelmanager_conv.is_owned = false;
47916         void* keys_manager_ptr = untag_ptr(keys_manager);
47917         CHECK_ACCESS(keys_manager_ptr);
47918         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47919         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47920                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47921                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47922         }
47923         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47924         void* amt_msat_ptr = untag_ptr(amt_msat);
47925         CHECK_ACCESS(amt_msat_ptr);
47926         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47927         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47928         LDKSha256 description_hash_conv;
47929         description_hash_conv.inner = untag_ptr(description_hash);
47930         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47931         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47932         description_hash_conv = Sha256_clone(&description_hash_conv);
47933         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47934         *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);
47935         return tag_ptr(ret_conv, true);
47936 }
47937
47938 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) {
47939         LDKChannelManager channelmanager_conv;
47940         channelmanager_conv.inner = untag_ptr(channelmanager);
47941         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47942         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47943         channelmanager_conv.is_owned = false;
47944         void* keys_manager_ptr = untag_ptr(keys_manager);
47945         CHECK_ACCESS(keys_manager_ptr);
47946         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47947         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47948                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47949                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47950         }
47951         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47952         void* amt_msat_ptr = untag_ptr(amt_msat);
47953         CHECK_ACCESS(amt_msat_ptr);
47954         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47955         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47956         LDKSha256 description_hash_conv;
47957         description_hash_conv.inner = untag_ptr(description_hash);
47958         description_hash_conv.is_owned = ptr_is_owned(description_hash);
47959         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
47960         description_hash_conv = Sha256_clone(&description_hash_conv);
47961         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47962         *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);
47963         return tag_ptr(ret_conv, true);
47964 }
47965
47966 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) {
47967         LDKChannelManager channelmanager_conv;
47968         channelmanager_conv.inner = untag_ptr(channelmanager);
47969         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
47970         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
47971         channelmanager_conv.is_owned = false;
47972         void* keys_manager_ptr = untag_ptr(keys_manager);
47973         CHECK_ACCESS(keys_manager_ptr);
47974         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
47975         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
47976                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47977                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
47978         }
47979         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
47980         void* amt_msat_ptr = untag_ptr(amt_msat);
47981         CHECK_ACCESS(amt_msat_ptr);
47982         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
47983         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
47984         LDKStr description_conv = java_to_owned_str(env, description);
47985         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
47986         *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);
47987         return tag_ptr(ret_conv, true);
47988 }
47989
47990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47991         LDKDefaultRouter this_obj_conv;
47992         this_obj_conv.inner = untag_ptr(this_obj);
47993         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47995         DefaultRouter_free(this_obj_conv);
47996 }
47997
47998 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) {
47999         LDKNetworkGraph network_graph_conv;
48000         network_graph_conv.inner = untag_ptr(network_graph);
48001         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48002         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48003         network_graph_conv.is_owned = false;
48004         void* logger_ptr = untag_ptr(logger);
48005         CHECK_ACCESS(logger_ptr);
48006         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48007         if (logger_conv.free == LDKLogger_JCalls_free) {
48008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48009                 LDKLogger_JCalls_cloned(&logger_conv);
48010         }
48011         LDKThirtyTwoBytes random_seed_bytes_ref;
48012         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
48013         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
48014         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
48015         int64_t ret_ref = 0;
48016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48018         return ret_ref;
48019 }
48020
48021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
48022         LDKDefaultRouter this_arg_conv;
48023         this_arg_conv.inner = untag_ptr(this_arg);
48024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48026         this_arg_conv.is_owned = false;
48027         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
48028         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
48029         return tag_ptr(ret_ret, true);
48030 }
48031
48032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
48033         LDKChannelManager this_arg_conv;
48034         this_arg_conv.inner = untag_ptr(this_arg);
48035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48037         this_arg_conv.is_owned = false;
48038         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
48039         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
48040         return tag_ptr(ret_ret, true);
48041 }
48042
48043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48044         LDKStr s_conv = java_to_owned_str(env, s);
48045         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
48046         *ret_conv = SiPrefix_from_str(s_conv);
48047         return tag_ptr(ret_conv, true);
48048 }
48049
48050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48051         LDKStr s_conv = java_to_owned_str(env, s);
48052         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
48053         *ret_conv = Invoice_from_str(s_conv);
48054         return tag_ptr(ret_conv, true);
48055 }
48056
48057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
48058         LDKStr s_conv = java_to_owned_str(env, s);
48059         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
48060         *ret_conv = SignedRawInvoice_from_str(s_conv);
48061         return tag_ptr(ret_conv, true);
48062 }
48063
48064 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48065         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
48066         LDKStr ret_str = ParseError_to_str(o_conv);
48067         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48068         Str_free(ret_str);
48069         return ret_conv;
48070 }
48071
48072 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48073         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
48074         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
48075         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48076         Str_free(ret_str);
48077         return ret_conv;
48078 }
48079
48080 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48081         LDKInvoice o_conv;
48082         o_conv.inner = untag_ptr(o);
48083         o_conv.is_owned = ptr_is_owned(o);
48084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48085         o_conv.is_owned = false;
48086         LDKStr ret_str = Invoice_to_str(&o_conv);
48087         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48088         Str_free(ret_str);
48089         return ret_conv;
48090 }
48091
48092 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48093         LDKSignedRawInvoice o_conv;
48094         o_conv.inner = untag_ptr(o);
48095         o_conv.is_owned = ptr_is_owned(o);
48096         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48097         o_conv.is_owned = false;
48098         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
48099         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48100         Str_free(ret_str);
48101         return ret_conv;
48102 }
48103
48104 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48105         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
48106         LDKStr ret_str = Currency_to_str(o_conv);
48107         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48108         Str_free(ret_str);
48109         return ret_conv;
48110 }
48111
48112 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
48113         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
48114         LDKStr ret_str = SiPrefix_to_str(o_conv);
48115         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
48116         Str_free(ret_str);
48117         return ret_conv;
48118 }
48119
48120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
48121         LDKRapidGossipSync this_obj_conv;
48122         this_obj_conv.inner = untag_ptr(this_obj);
48123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48125         RapidGossipSync_free(this_obj_conv);
48126 }
48127
48128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph) {
48129         LDKNetworkGraph network_graph_conv;
48130         network_graph_conv.inner = untag_ptr(network_graph);
48131         network_graph_conv.is_owned = ptr_is_owned(network_graph);
48132         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
48133         network_graph_conv.is_owned = false;
48134         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
48135         int64_t ret_ref = 0;
48136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48138         return ret_ref;
48139 }
48140
48141 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) {
48142         LDKRapidGossipSync this_arg_conv;
48143         this_arg_conv.inner = untag_ptr(this_arg);
48144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48146         this_arg_conv.is_owned = false;
48147         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
48148         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48149         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
48150         return tag_ptr(ret_conv, true);
48151 }
48152
48153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
48154         LDKRapidGossipSync this_arg_conv;
48155         this_arg_conv.inner = untag_ptr(this_arg);
48156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48158         this_arg_conv.is_owned = false;
48159         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
48160         return ret_conv;
48161 }
48162
48163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48164         if (!ptr_is_owned(this_ptr)) return;
48165         void* this_ptr_ptr = untag_ptr(this_ptr);
48166         CHECK_ACCESS(this_ptr_ptr);
48167         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
48168         FREE(untag_ptr(this_ptr));
48169         GraphSyncError_free(this_ptr_conv);
48170 }
48171
48172 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
48173         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48174         *ret_copy = GraphSyncError_clone(arg);
48175         int64_t ret_ref = tag_ptr(ret_copy, true);
48176         return ret_ref;
48177 }
48178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
48179         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
48180         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
48181         return ret_conv;
48182 }
48183
48184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48185         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
48186         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48187         *ret_copy = GraphSyncError_clone(orig_conv);
48188         int64_t ret_ref = tag_ptr(ret_copy, true);
48189         return ret_ref;
48190 }
48191
48192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
48193         LDKDecodeError a_conv;
48194         a_conv.inner = untag_ptr(a);
48195         a_conv.is_owned = ptr_is_owned(a);
48196         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48197         a_conv = DecodeError_clone(&a_conv);
48198         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48199         *ret_copy = GraphSyncError_decode_error(a_conv);
48200         int64_t ret_ref = tag_ptr(ret_copy, true);
48201         return ret_ref;
48202 }
48203
48204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
48205         LDKLightningError a_conv;
48206         a_conv.inner = untag_ptr(a);
48207         a_conv.is_owned = ptr_is_owned(a);
48208         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48209         a_conv = LightningError_clone(&a_conv);
48210         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
48211         *ret_copy = GraphSyncError_lightning_error(a_conv);
48212         int64_t ret_ref = tag_ptr(ret_copy, true);
48213         return ret_ref;
48214 }
48215
48216 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) {
48217         LDKRapidGossipSync this_arg_conv;
48218         this_arg_conv.inner = untag_ptr(this_arg);
48219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48221         this_arg_conv.is_owned = false;
48222         LDKu8slice update_data_ref;
48223         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
48224         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
48225         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
48226         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
48227         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
48228         return tag_ptr(ret_conv, true);
48229 }
48230